added shortcut to reply

This commit is contained in:
thislight 2024-09-28 15:29:21 +08:00
parent dd6051aea7
commit cefa4a1b83
No known key found for this signature in database
GPG key ID: A50F9451AC56A63E
4 changed files with 43 additions and 13 deletions

View file

@ -58,6 +58,7 @@ const TimelinePanel: Component<{
openFullScreenToot: (
toot: mastodon.v1.Status,
srcElement?: HTMLElement,
reply?: boolean,
) => void;
}> = (props) => {
const [scrollLinked, setScrollLinked] = createSignal<HTMLElement>();
@ -153,7 +154,7 @@ const TimelinePanel: Component<{
isTyping={typing()}
onTypingChange={setTyping}
client={props.client}
onSent={() => refetchTimeline({direction: "new"})}
onSent={() => refetchTimeline({ direction: "new" })}
/>
</Show>
<For each={timeline}>
@ -165,6 +166,9 @@ const TimelinePanel: Component<{
status={item}
onBoost={(...args) => onBoost(index(), ...args)}
onBookmark={(...args) => onBookmark(index(), ...args)}
onReply={(client, status) =>
props.openFullScreenToot(status, element, true)
}
client={props.client}
expanded={item.id === expandedThreadId() ? 1 : 0}
onExpandChange={(x) => {
@ -327,6 +331,7 @@ const Home: ParentComponent = (props) => {
const openFullScreenToot = (
toot: mastodon.v1.Status,
srcElement?: HTMLElement,
reply?: boolean,
) => {
const p = profiles()[0];
const inf = p.account.inf ?? profile();
@ -338,7 +343,13 @@ const Home: ParentComponent = (props) => {
setHeroSrc((x) => Object.assign({}, x, { [BOTTOM_SHEET_HERO]: rect }));
const acct = `${inf.username}@${p.account.site}`;
setTootBottomSheetCache(acct, toot);
navigate(`/${encodeURIComponent(acct)}/${toot.id}`);
navigate(`/${encodeURIComponent(acct)}/${toot.id}`, {
state: reply
? {
tootReply: true,
}
: undefined,
});
};
css`