added shortcut to reply

This commit is contained in:
thislight 2024-09-28 15:29:21 +08:00
parent e0d1136230
commit 40cb0a0681
4 changed files with 43 additions and 13 deletions

View file

@ -39,7 +39,10 @@ function getCache(acct: string, id: string) {
const TootBottomSheet: Component = (props) => {
const params = useParams<{ acct: string; id: string }>();
const location = useLocation<{ tootBottomSheetPushedCount?: number }>();
const location = useLocation<{
tootBottomSheetPushedCount?: number;
tootReply?: boolean;
}>();
const navigate = useNavigate();
const allSession = useSessions();
const time = createTimeSource();
@ -84,7 +87,13 @@ const TootBottomSheet: Component = (props) => {
return tootId;
});
const [tootContext, {refetch: refetchContext}] = createResource(
createEffect(() => {
if (location.state?.tootReply) {
setInTyping(true);
}
});
const [tootContext, { refetch: refetchContext }] = createResource(
() => [session().client, params.id] as const,
async ([client, id]) => {
return await client.v1.statuses.$select(id).context.fetch();
@ -172,16 +181,16 @@ const TootBottomSheet: Component = (props) => {
};
const defaultMentions = () => {
const tootAcct = remoteToot()?.reblog?.account ?? remoteToot()?.account
const tootAcct = remoteToot()?.reblog?.account ?? remoteToot()?.account;
if (!tootAcct) {
return
return;
}
const others = ancestors().map(x => x.account)
const others = ancestors().map((x) => x.account);
const values = [tootAcct, ...others].map(x => `@${x.acct}`)
return Array.from(new Set(values).keys())
}
const values = [tootAcct, ...others].map((x) => `@${x.acct}`);
return Array.from(new Set(values).keys());
};
css`
.name :global(img) {
@ -286,7 +295,7 @@ const TootBottomSheet: Component = (props) => {
)}
</For>
</TimeSourceProvider>
<div style={{height: "var(--safe-area-inset-bottom, 0)"}}></div>
<div style={{ height: "var(--safe-area-inset-bottom, 0)" }}></div>
</Scaffold>
);
};