2024-07-22 13:57:04 +00:00
|
|
|
import { createResource, For, type ParentComponent } from "solid-js";
|
|
|
|
import Scaffold from "../material/Scaffold.js";
|
|
|
|
import {
|
|
|
|
AppBar,
|
|
|
|
Divider,
|
|
|
|
IconButton,
|
|
|
|
List,
|
|
|
|
ListItem,
|
|
|
|
ListItemButton,
|
|
|
|
ListItemSecondaryAction,
|
|
|
|
ListItemText,
|
|
|
|
ListSubheader,
|
|
|
|
NativeSelect,
|
|
|
|
Select,
|
|
|
|
Switch,
|
|
|
|
Toolbar,
|
|
|
|
} from "@suid/material";
|
|
|
|
import { Close as CloseIcon } from "@suid/icons-material";
|
|
|
|
import { useNavigate } from "@solidjs/router";
|
|
|
|
import { Title } from "../material/typography.jsx";
|
|
|
|
import { useSessions } from "../masto/clients.js";
|
|
|
|
import { css } from "solid-styled";
|
|
|
|
import { useSignedInProfiles } from "../masto/acct.js";
|
|
|
|
import { signOut, type Account } from "../accounts/stores.js";
|
|
|
|
import { intlFormat } from "date-fns";
|
2024-07-23 00:28:47 +00:00
|
|
|
import { useStore } from "@nanostores/solid";
|
|
|
|
import { $settings } from "./stores.js";
|
2024-07-22 13:57:04 +00:00
|
|
|
|
|
|
|
const Settings: ParentComponent = () => {
|
|
|
|
const navigate = useNavigate();
|
2024-07-23 00:28:47 +00:00
|
|
|
const settings$ = useStore($settings);
|
2024-07-22 13:57:04 +00:00
|
|
|
|
|
|
|
const [profiles] = useSignedInProfiles();
|
|
|
|
|
|
|
|
const doSignOut = (acct: Account) => {
|
|
|
|
signOut((a) => a.site === acct.site && a.accessToken === acct.accessToken);
|
|
|
|
};
|
|
|
|
|
|
|
|
css`
|
|
|
|
ul {
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.setting-list {
|
2024-07-24 06:27:20 +00:00
|
|
|
padding-bottom: calc(var(--safe-area-inset-bottom, 0px) + 16px);
|
2024-07-22 13:57:04 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
return (
|
|
|
|
<Scaffold
|
|
|
|
topbar={
|
|
|
|
<AppBar position="static">
|
2024-08-05 11:05:39 +00:00
|
|
|
<Toolbar variant="dense" sx={{paddingTop: "var(--safe-area-inset-top, 0px)"}}>
|
2024-07-22 13:57:04 +00:00
|
|
|
<IconButton onClick={[navigate, -1]}>
|
|
|
|
<CloseIcon />
|
|
|
|
</IconButton>
|
|
|
|
<Title>Settings</Title>
|
|
|
|
</Toolbar>
|
|
|
|
</AppBar>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<List class="setting-list" use:solid-styled>
|
|
|
|
<li>
|
|
|
|
<ul>
|
|
|
|
<ListSubheader>Accounts</ListSubheader>
|
|
|
|
<ListItem>
|
|
|
|
<ListItemText>All Notifications</ListItemText>
|
|
|
|
<ListItemSecondaryAction>
|
|
|
|
<Switch />
|
|
|
|
</ListItemSecondaryAction>
|
|
|
|
</ListItem>
|
|
|
|
<ListItem>
|
|
|
|
<ListItemText>Sign in...</ListItemText>
|
|
|
|
</ListItem>
|
|
|
|
</ul>
|
|
|
|
<For each={profiles()}>
|
|
|
|
{({ account: acct, inf }) => (
|
|
|
|
<ul data-site={acct.site} data-username={inf?.username}>
|
|
|
|
<ListSubheader>{`@${inf?.username ?? "..."}@${new URL(acct.site).host}`}</ListSubheader>
|
|
|
|
<ListItem>
|
|
|
|
<ListItemText>Notifications</ListItemText>
|
|
|
|
<ListItemSecondaryAction>
|
|
|
|
<Switch />
|
|
|
|
</ListItemSecondaryAction>
|
|
|
|
</ListItem>
|
|
|
|
<ListItemButton onClick={[doSignOut, acct]}>
|
|
|
|
<ListItemText>Sign out</ListItemText>
|
|
|
|
</ListItemButton>
|
|
|
|
</ul>
|
|
|
|
)}
|
|
|
|
</For>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<ListSubheader>Reading</ListSubheader>
|
|
|
|
<ListItem>
|
|
|
|
<ListItemText secondary="Regular">Fonts</ListItemText>
|
|
|
|
</ListItem>
|
2024-08-05 10:57:43 +00:00
|
|
|
<ListItem onClick={(e) =>
|
|
|
|
$settings.setKey("prefetchTootsDisabled", !settings$().prefetchTootsDisabled)
|
|
|
|
}>
|
2024-07-22 13:57:04 +00:00
|
|
|
<ListItemText secondary="Tutu will download toots before you scroll to the position.">
|
|
|
|
Prefetch Toots
|
|
|
|
</ListItemText>
|
|
|
|
<ListItemSecondaryAction>
|
2024-07-23 00:28:47 +00:00
|
|
|
<Switch
|
|
|
|
checked={!settings$().prefetchTootsDisabled}
|
|
|
|
/>
|
2024-07-22 13:57:04 +00:00
|
|
|
</ListItemSecondaryAction>
|
|
|
|
</ListItem>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<ListSubheader>Controls</ListSubheader>
|
|
|
|
<ListItem>
|
|
|
|
<ListItemText>Optimized UI</ListItemText>
|
|
|
|
<ListItemSecondaryAction>
|
|
|
|
<NativeSelect value="auto">
|
|
|
|
<option value="auto">Tutu Decides (Mouse)</option>
|
|
|
|
<option value="mouse">Mouse</option>
|
|
|
|
<option value="touch">Touch</option>
|
|
|
|
<option value="controlpad">Control Pad</option>
|
|
|
|
</NativeSelect>
|
|
|
|
</ListItemSecondaryAction>
|
|
|
|
</ListItem>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<ListSubheader>This Application</ListSubheader>
|
|
|
|
<ListItem>
|
|
|
|
<ListItemText secondary="Comformtable tooting experience.">
|
|
|
|
About Tutu
|
|
|
|
</ListItemText>
|
|
|
|
</ListItem>
|
|
|
|
<ListItem>
|
|
|
|
<ListItemText
|
|
|
|
secondary={`Using v${import.meta.env.PACKAGE_VERSION} (built on ${intlFormat(import.meta.env.BUILT_AT)}, ${import.meta.env.MODE})`}
|
|
|
|
>
|
|
|
|
No updates
|
|
|
|
</ListItemText>
|
|
|
|
</ListItem>
|
|
|
|
</li>
|
|
|
|
</List>
|
|
|
|
</Scaffold>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Settings;
|