first prototype of StackedRouter

This commit is contained in:
thislight 2024-11-16 20:04:55 +08:00
parent 607fa64c05
commit 0710aaf4f3
No known key found for this signature in database
GPG key ID: FCFE5192241CCD4E
21 changed files with 442 additions and 109 deletions

View file

@ -29,11 +29,11 @@ import BottomSheet, {
import { $settings } from "../settings/stores";
import { useStore } from "@nanostores/solid";
import { HeroSourceProvider, type HeroSource } from "../platform/anim";
import { useNavigate } from "@solidjs/router";
import { setCache as setTootBottomSheetCache } from "./TootBottomSheet";
import TrendTimelinePanel from "./TrendTimelinePanel";
import TimelinePanel from "./TimelinePanel";
import { useSessions } from "../masto/clients";
import { useNavigator } from "../platform/StackedRouter";
const Home: ParentComponent = (props) => {
let panelList: HTMLDivElement;
@ -53,7 +53,7 @@ const Home: ParentComponent = (props) => {
const all = profiles();
return all?.[0]?.client;
};
const navigate = useNavigate();
const {pop, push} = useNavigator();
const [heroSrc, setHeroSrc] = createSignal<HeroSource>({});
const [panelOffset, setPanelOffset] = createSignal(0);
@ -151,7 +151,7 @@ const Home: ParentComponent = (props) => {
);
const acct = `${inf.username}@${p.account.site}`;
setTootBottomSheetCache(acct, toot);
navigate(`/${encodeURIComponent(acct)}/toot/${toot.id}`, {
push(`/${encodeURIComponent(acct)}/toot/${toot.id}`, {
state: reply
? {
tootReply: true,
@ -276,7 +276,7 @@ const Home: ParentComponent = (props) => {
</Show>
</TimeSourceProvider>
<Suspense>
<BottomSheet open={!!child()} onClose={() => navigate(-1)}>
<BottomSheet open={!!child()} onClose={() => pop(1)}>
{child()}
</BottomSheet>
</Suspense>