From cd1ae210e7667d9f9acffa8c9aa8389352a9d8ae Mon Sep 17 00:00:00 2001 From: thislight Date: Sat, 9 Nov 2024 16:38:41 +0800 Subject: [PATCH] minor cleanup --- src/timelines/TimelinePanel.tsx | 1 - src/timelines/TootBottomSheet.tsx | 1 - src/timelines/TootList.tsx | 6 +- src/timelines/TootThread.tsx | 102 ------------------------------ 4 files changed, 2 insertions(+), 108 deletions(-) delete mode 100644 src/timelines/TootThread.tsx diff --git a/src/timelines/TimelinePanel.tsx b/src/timelines/TimelinePanel.tsx index b733da2..edd1806 100644 --- a/src/timelines/TimelinePanel.tsx +++ b/src/timelines/TimelinePanel.tsx @@ -1,6 +1,5 @@ import { Component, - For, onCleanup, createSignal, Show, diff --git a/src/timelines/TootBottomSheet.tsx b/src/timelines/TootBottomSheet.tsx index c2b29e3..40d04ad 100644 --- a/src/timelines/TootBottomSheet.tsx +++ b/src/timelines/TootBottomSheet.tsx @@ -12,7 +12,6 @@ import Scaffold from "../material/Scaffold"; import { AppBar, CircularProgress, IconButton, Toolbar } from "@suid/material"; import { Title } from "../material/typography"; import { - ArrowBack as BackIcon, Close as CloseIcon, } from "@suid/icons-material"; import { useSessionForAcctStr } from "../masto/clients"; diff --git a/src/timelines/TootList.tsx b/src/timelines/TootList.tsx index 48a7836..85a0541 100644 --- a/src/timelines/TootList.tsx +++ b/src/timelines/TootList.tsx @@ -1,6 +1,5 @@ import { Component, - For, createSignal, ErrorBoundary, type Ref, @@ -20,7 +19,6 @@ import RegularToot, { findRootToot, } from "./RegularToot"; import cardStyle from "../material/cards.module.css"; -import type { ReactiveMap } from "@solid-primitives/map"; import type { ThreadNode } from "../masto/timelines"; function positionTootInThread(index: number, threadLength: number) { @@ -73,7 +71,7 @@ const TootList: Component<{ }); } - /* const result = reblogged + const result = reblogged ? await client.v1.statuses.$select(status.id).unreblog() : (await client.v1.statuses.$select(status.id).reblog()).reblog!; @@ -84,7 +82,7 @@ const TootList: Component<{ }); } else { props.onChangeToot(status.id, result); - } */ + } }; const toggleFavourite = async (status: mastodon.v1.Status) => { diff --git a/src/timelines/TootThread.tsx b/src/timelines/TootThread.tsx deleted file mode 100644 index 4c8047c..0000000 --- a/src/timelines/TootThread.tsx +++ /dev/null @@ -1,102 +0,0 @@ -import type { mastodon } from "masto"; -import { Show, createResource, createSignal, type Component, type Ref } from "solid-js"; -import CompactToot from "./CompactToot"; -import { useTimeSource } from "../platform/timesrc"; -import RegularToot from "./RegularToot"; -import cardStyle from "../material/cards.module.css"; -import { css } from "solid-styled"; - -type TootThreadProps = { - ref?: Ref, - status: mastodon.v1.Status; - client: mastodon.rest.Client; - expanded?: 0 | 1 | 2; - - onBoost?(client: mastodon.rest.Client, status: mastodon.v1.Status): void; - onBookmark?(client: mastodon.rest.Client, status: mastodon.v1.Status): void; - onReply?(client: mastodon.rest.Client, status: mastodon.v1.Status): void - onExpandChange?(level: 0 | 1 | 2): void; -}; - -const TootThread: Component = (props) => { - const status = () => props.status; - const now = useTimeSource(); - const expanded = () => props.expanded ?? 0; - - const [inReplyTo] = createResource( - () => [props.client, status().inReplyToId || null] as const, - async ([client, replyToId]) => { - if (!(client && replyToId)) return null; - return await client.v1.statuses.$select(replyToId).fetch(); - }, - ); - - const boost = (status: mastodon.v1.Status) => { - props.onBoost?.(props.client, status); - }; - - const bookmark = (status: mastodon.v1.Status) => { - props.onBookmark?.(props.client, status); - }; - - const reply = (status: mastodon.v1.Status) => { - props.onReply?.(props.client, status) - } - - css` - article { - transition: - margin 90ms var(--tutu-anim-curve-sharp), - var(--tutu-transition-shadow); - user-select: none; - cursor: pointer; - } - - .thread-line { - position: relative; - &::before { - content: ""; - position: absolute; - left: 36px; - top: 16px; - bottom: 0; - background-color: var(--tutu-color-secondary); - width: 2px; - display: block; - } - } - - .expanded { - margin-block: 20px; - box-shadow: var(--tutu-shadow-e9); - } - `; - - const nextExpandLevel = [1, 2, 2] as const; - - return ( -
0 }} - onClick={() => props.onExpandChange?.(nextExpandLevel[expanded()])} - > - - - - 0} - onBookmark={(s) => bookmark(s)} - onRetoot={(s) => boost(s)} - onReply={s => reply(s)} - /> -
- ); -}; - -export default TootThread;