import './settings.css'; import { useRef, useState } from 'preact/hooks'; import Avatar from '../components/avatar'; import Icon from '../components/icon'; import NameText from '../components/name-text'; import store from '../utils/store'; /* Settings component that shows these settings: - Accounts list for switching - Dark/light/auto theme switch (done with adding/removing 'is-light' or 'is-dark' class on the body) */ export default ({ onClose }) => { // Accounts const accounts = store.local.getJSON('accounts'); const currentAccount = store.session.get('currentAccount'); const currentTheme = store.local.get('theme') || 'auto'; const themeFormRef = useRef(); const moreThanOneAccount = accounts.length > 1; const [currentDefault, setCurrentDefault] = useState(0); return (
Note: Default account will always be used for first load. Switched accounts will persist during the session.
)}