parent
fba983ff52
commit
16af3c0592
1 changed files with 12 additions and 9 deletions
|
@ -8,12 +8,7 @@ import {
|
||||||
type Component,
|
type Component,
|
||||||
} from "solid-js";
|
} from "solid-js";
|
||||||
import Scaffold from "../material/Scaffold";
|
import Scaffold from "../material/Scaffold";
|
||||||
import {
|
import { AppBar, CircularProgress, IconButton, Toolbar } from "@suid/material";
|
||||||
AppBar,
|
|
||||||
CircularProgress,
|
|
||||||
IconButton,
|
|
||||||
Toolbar,
|
|
||||||
} from "@suid/material";
|
|
||||||
import { Title } from "../material/typography";
|
import { Title } from "../material/typography";
|
||||||
import {
|
import {
|
||||||
ArrowBack as BackIcon,
|
ArrowBack as BackIcon,
|
||||||
|
@ -41,8 +36,6 @@ function getCache(acct: string, id: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const TootBottomSheet: Component = (props) => {
|
const TootBottomSheet: Component = (props) => {
|
||||||
const params = useParams<{ acct: string; id: string }>();
|
const params = useParams<{ acct: string; id: string }>();
|
||||||
const location = useLocation<{ tootBottomSheetPushedCount?: number }>();
|
const location = useLocation<{ tootBottomSheetPushedCount?: number }>();
|
||||||
|
@ -122,6 +115,11 @@ const TootBottomSheet: Component = (props) => {
|
||||||
const onBookmark = async () => {
|
const onBookmark = async () => {
|
||||||
const status = remoteToot()!;
|
const status = remoteToot()!;
|
||||||
const client = actSession()!.client;
|
const client = actSession()!.client;
|
||||||
|
setRemoteToot(
|
||||||
|
Object.assign({}, status, {
|
||||||
|
bookmarked: !status.bookmarked,
|
||||||
|
}),
|
||||||
|
);
|
||||||
const result = await (status.bookmarked
|
const result = await (status.bookmarked
|
||||||
? client.v1.statuses.$select(status.id).unbookmark()
|
? client.v1.statuses.$select(status.id).unbookmark()
|
||||||
: client.v1.statuses.$select(status.id).bookmark());
|
: client.v1.statuses.$select(status.id).bookmark());
|
||||||
|
@ -141,12 +139,17 @@ const TootBottomSheet: Component = (props) => {
|
||||||
? client.v1.statuses.$select(status.id).unreblog()
|
? client.v1.statuses.$select(status.id).unreblog()
|
||||||
: client.v1.statuses.$select(status.id).reblog());
|
: client.v1.statuses.$select(status.id).reblog());
|
||||||
vibrate([20, 30]);
|
vibrate([20, 30]);
|
||||||
setRemoteToot(result);
|
setRemoteToot(result.reblog!);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onFav = async () => {
|
const onFav = async () => {
|
||||||
const status = remoteToot()!;
|
const status = remoteToot()!;
|
||||||
const client = actSession()!.client;
|
const client = actSession()!.client;
|
||||||
|
setRemoteToot(
|
||||||
|
Object.assign({}, status, {
|
||||||
|
favourited: !status.favourited,
|
||||||
|
}),
|
||||||
|
);
|
||||||
const result = await (status.favourited
|
const result = await (status.favourited
|
||||||
? client.v1.statuses.$select(status.id).favourite()
|
? client.v1.statuses.$select(status.id).favourite()
|
||||||
: client.v1.statuses.$select(status.id).unfavourite());
|
: client.v1.statuses.$select(status.id).unfavourite());
|
||||||
|
|
Loading…
Reference in a new issue