From cb1b56f5a0eddbf77446f415f2beda57c8305f85 Mon Sep 17 00:00:00 2001 From: polwex Date: Sun, 23 Nov 2025 01:12:53 +0700 Subject: wut --- packages/tweetdeck/src/components/ChatColumn.tsx | 62 ++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 packages/tweetdeck/src/components/ChatColumn.tsx (limited to 'packages/tweetdeck/src/components/ChatColumn.tsx') diff --git a/packages/tweetdeck/src/components/ChatColumn.tsx b/packages/tweetdeck/src/components/ChatColumn.tsx new file mode 100644 index 0000000..0c336e5 --- /dev/null +++ b/packages/tweetdeck/src/components/ChatColumn.tsx @@ -0,0 +1,62 @@ +import { useCallback, useEffect, useState } from "react"; +import type { DeckAccount, DeckColumn, ChatState } from "../types/app"; +import { twitterClient } from "../lib/client/twitterClient"; +import { ChatCard } from "./ChatCard"; + +interface ChatColumnProps { + column: DeckColumn & { kind: "chat" }; + account: DeckAccount; + onRemove: () => void; +} + +export function ChatColumn({ column, account, onRemove }: ChatColumnProps) { + const [state, setState] = useState({ entries: [], isLoading: false }); + const [error, setError] = useState(); + + const refresh = useCallback(async () => { + setState(prev => ({ ...prev, isLoading: true })); + setError(undefined); + try { + const notifications = await twitterClient.notifications({ cookie: account.cookie }); + setState({ entries: notifications, isLoading: false }); + } catch (err) { + setError(err instanceof Error ? err.message : "Failed to refresh chat"); + setState(prev => ({ ...prev, isLoading: false })); + } + }, [account.cookie]); + + useEffect(() => { + refresh(); + }, [refresh, account.id]); + + return ( +
+
+
+

Signal

+

{column.title || "Chat"}

+

Mentions, follows and notifications for {account.label}

+
+
+ + +
+
+ {error &&

{error}

} + {state.isLoading && !state.entries.length ? ( +
Loading…
+ ) : ( +
+ {state.entries.map(entry => ( + + ))} + {!state.entries.length &&

No recent notifications.

} +
+ )} +
+ ); +} -- cgit v1.2.3