added composing new toots

This commit is contained in:
thislight 2024-09-28 15:15:06 +08:00
parent 74770649c3
commit e0d1136230
3 changed files with 55 additions and 15 deletions

View file

@ -11,7 +11,7 @@ import {
Suspense,
Match,
Switch as JsSwitch,
ErrorBoundary
ErrorBoundary,
} from "solid-js";
import { useDocumentTitle } from "../utils";
import { type mastodon } from "masto";
@ -47,6 +47,7 @@ import { HeroSourceProvider, type HeroSource } from "../platform/anim";
import { useNavigate } from "@solidjs/router";
import { useSignedInProfiles } from "../masto/acct";
import { setCache as setTootBottomSheetCache } from "./TootBottomSheet";
import TootComposer from "./TootComposer";
const TimelinePanel: Component<{
client: mastodon.rest.Client;
@ -72,6 +73,7 @@ const TimelinePanel: Component<{
{ fullRefresh: props.fullRefetch },
);
const [expandedThreadId, setExpandedThreadId] = createSignal<string>();
const [typing, setTyping] = createSignal(false);
const tlEndObserver = new IntersectionObserver(() => {
if (untrack(() => props.prefetch) && !snapshot.loading)
@ -126,9 +128,11 @@ const TimelinePanel: Component<{
};
return (
<ErrorBoundary fallback={(err, reset) => {
return <p>Oops: {String(err)}</p>
}}>
<ErrorBoundary
fallback={(err, reset) => {
return <p>Oops: {String(err)}</p>;
}}
>
<PullDownToRefresh
linkedElement={scrollLinked()}
loading={snapshot.loading}
@ -141,6 +145,17 @@ const TimelinePanel: Component<{
}, 0)
}
>
<Show when={props.name === "home"}>
<TootComposer
style={{
"--scaffold-topbar-height": "0px",
}}
isTyping={typing()}
onTypingChange={setTyping}
client={props.client}
onSent={() => refetchTimeline({direction: "new"})}
/>
</Show>
<For each={timeline}>
{(item, index) => {
let element: HTMLElement | undefined;