import { children, createSignal, For, Show, type ParentComponent, } from "solid-js"; import Scaffold from "../material/Scaffold.js"; import { AppBar, Divider, IconButton, List, ListItem, ListItemButton, ListItemIcon, ListItemSecondaryAction, ListItemText, ListSubheader, Switch, Toolbar, } from "@suid/material"; import { Animation as AnimationIcon, Close as CloseIcon, Logout, Public as PublicIcon, Refresh as RefreshIcon, Translate as TranslateIcon, } from "@suid/icons-material"; import { A, useNavigate } from "@solidjs/router"; import { Title } from "../material/typography.jsx"; import { css } from "solid-styled"; import { signOut, type Account } from "../accounts/stores.js"; import { format } from "date-fns"; import { useStore } from "@nanostores/solid"; import { $settings } from "./stores.js"; import { autoMatchLangTag, autoMatchRegion, createTranslator, useDateFnLocale, } from "../platform/i18n.jsx"; import { type Template } from "@solid-primitives/i18n"; import BottomSheet from "../material/BottomSheet.jsx"; import { useServiceWorker } from "../platform/host.js"; import { useSessions } from "../masto/clients.js"; type Strings = { ["lang.auto"]: Template<{ detected: string }>; } & Record; const Settings: ParentComponent = (props) => { const [t] = createTranslator( (code) => import(`./i18n/${code}.json`) as Promise<{ default: Strings; }>, () => import(`./i18n/lang-names.json`), ); const navigate = useNavigate(); const settings$ = useStore($settings); const { needRefresh, offlineReady } = useServiceWorker(); const dateFnLocale = useDateFnLocale(); const profiles = useSessions(); const doSignOut = (acct: Account) => { signOut((a) => a.site === acct.site && a.accessToken === acct.accessToken); }; const subpage = children(() => props.children); css` ul { padding: 0; } .setting-list { padding-bottom: calc(var(--safe-area-inset-bottom, 0px) + 16px); } `; return ( {t("Settings")} } > navigate(-1)}> {subpage()}
    • {t("Accounts")} {t("All Notifications")} {t("Sign in...")}
    {({ account: acct }) => (
      {`@${acct.inf?.username ?? "..."}@${new URL(acct.site).host}`} {t("Notifications")} {t("Sign out")}
    )}
  • {t("timelines")} $settings.setKey( "prefetchTootsDisabled", !settings$().prefetchTootsDisabled, ) } > {t("Prefetch Toots")} {t("motions")}
  • {t("This Application")} {t("Language")} {t("Region")} {t("About Tutu")} {needRefresh() ? t("updates.ready") : t("updates.no")} window.location.reload()} >
  • ); }; export default Settings;