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

@ -20,6 +20,7 @@ import RegularToot, {
} from "./RegularToot";
import cardStyle from "../material/cards.module.css";
import type { ThreadNode } from "../masto/timelines";
import { useNavigator } from "../platform/StackedRouter";
function positionTootInThread(index: number, threadLength: number) {
if (index === 0) {
@ -40,7 +41,7 @@ const TootList: Component<{
const session = useDefaultSession();
const heroSrc = useHeroSource();
const [expandedThreadId, setExpandedThreadId] = createSignal<string>();
const navigate = useNavigate();
const {push} = useNavigator();
const onBookmark = async (status: mastodon.v1.Status) => {
const client = session()?.client;
@ -115,7 +116,7 @@ const TootList: Component<{
const acct = `${inf.username}@${p.site}`;
setTootBottomSheetCache(acct, toot);
navigate(`/${encodeURIComponent(acct)}/toot/${toot.id}`, {
push(`/${encodeURIComponent(acct)}/toot/${toot.id}`, {
state: reply
? {
tootReply: true,
@ -146,7 +147,7 @@ const TootList: Component<{
target.dataset.client || `@${new URL(target.href).origin}`,
);
navigate(`/${acct}/profile/${target.dataset.acctId}`);
push(`/${acct}/profile/${target.dataset.acctId}`);
return;
} else {