StackedRouter: new router simulates app behaviour #45

Merged
Rubicon merged 18 commits from stacky into master 2024-11-18 10:35:30 +00:00
Showing only changes of commit 00554a045f - Show all commits

View file

@ -1,10 +1,7 @@
import { import {
children,
createSignal,
For, For,
Show, Show,
type JSX, type Component,
type ParentComponent,
} from "solid-js"; } from "solid-js";
import Scaffold from "../material/Scaffold.js"; import Scaffold from "../material/Scaffold.js";
import { import {
@ -44,7 +41,6 @@ import {
useDateFnLocale, useDateFnLocale,
} from "../platform/i18n.jsx"; } from "../platform/i18n.jsx";
import { type Template } from "@solid-primitives/i18n"; import { type Template } from "@solid-primitives/i18n";
import BottomSheet from "../material/BottomSheet.jsx";
import { useServiceWorker } from "../platform/host.js"; import { useServiceWorker } from "../platform/host.js";
import { useSessions } from "../masto/clients.js"; import { useSessions } from "../masto/clients.js";
import { useNavigator } from "../platform/StackedRouter.jsx"; import { useNavigator } from "../platform/StackedRouter.jsx";
@ -163,7 +159,7 @@ type Strings = {
["lang.auto"]: Template<{ detected: string }>; ["lang.auto"]: Template<{ detected: string }>;
} & Record<string, string | undefined>; } & Record<string, string | undefined>;
const Settings: ParentComponent = (props) => { const Settings: Component = () => {
const [t] = createTranslator( const [t] = createTranslator(
(code) => (code) =>
import(`./i18n/${code}.json`) as Promise<{ import(`./i18n/${code}.json`) as Promise<{
@ -173,7 +169,7 @@ const Settings: ParentComponent = (props) => {
); );
const {pop} = useNavigator(); const {pop} = useNavigator();
const settings$ = useStore($settings); const settings$ = useStore($settings);
const { needRefresh, offlineReady } = useServiceWorker(); const { needRefresh } = useServiceWorker();
const dateFnLocale = useDateFnLocale(); const dateFnLocale = useDateFnLocale();
const profiles = useSessions(); const profiles = useSessions();
@ -182,8 +178,6 @@ const Settings: ParentComponent = (props) => {
signOut((a) => a.site === acct.site && a.accessToken === acct.accessToken); signOut((a) => a.site === acct.site && a.accessToken === acct.accessToken);
}; };
const subpage = children(() => props.children);
css` css`
ul { ul {
padding: 0; padding: 0;
@ -209,10 +203,6 @@ const Settings: ParentComponent = (props) => {
</AppBar> </AppBar>
} }
> >
<BottomSheet open={!!subpage()} onClose={() => pop(1)}>
{subpage()}
</BottomSheet>
<List class="setting-list" use:solid-styled> <List class="setting-list" use:solid-styled>
<li> <li>
<ul> <ul>