From 25ff067ea0c0c77f3c40d6ef0e3e2da7412717a9 Mon Sep 17 00:00:00 2001 From: xCyanGrizzly Date: Mon, 22 Jun 2026 04:15:46 +0200 Subject: [PATCH] feat(telegram): add Topics action to forum channels in Channels tab Forum source channels get a Topics menu item that opens the TopicsDrawer. Non-forum channels are unaffected. Co-Authored-By: Claude Opus 4.8 --- .../(app)/telegram/_components/channel-columns.tsx | 11 +++++++++++ .../(app)/telegram/_components/channels-tab.tsx | 14 ++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/app/(app)/telegram/_components/channel-columns.tsx b/src/app/(app)/telegram/_components/channel-columns.tsx index b50ef6f..d2c2abb 100644 --- a/src/app/(app)/telegram/_components/channel-columns.tsx +++ b/src/app/(app)/telegram/_components/channel-columns.tsx @@ -9,6 +9,7 @@ import { ArrowUpFromLine, RefreshCcw, Tag, + MessagesSquare, } from "lucide-react"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; @@ -27,6 +28,7 @@ interface ChannelColumnsProps { onSetType: (id: string, type: "SOURCE" | "DESTINATION") => void; onRescan: (id: string) => void; onSetCategory: (id: string, category: string | null) => void; + onManageTopics: (id: string) => void; } export function getChannelColumns({ @@ -35,6 +37,7 @@ export function getChannelColumns({ onSetType, onRescan, onSetCategory, + onManageTopics, }: ChannelColumnsProps): ColumnDef[] { return [ { @@ -147,6 +150,14 @@ export function getChannelColumns({ Rescan Channel )} + {row.original.type === "SOURCE" && row.original.isForum && ( + onManageTopics(row.original.id)} + > + + Topics + + )} { const cat = prompt("Enter category (e.g. STL, PDF, D&D, Cosplay):", row.original.category ?? ""); diff --git a/src/app/(app)/telegram/_components/channels-tab.tsx b/src/app/(app)/telegram/_components/channels-tab.tsx index a3391e7..a3926b2 100644 --- a/src/app/(app)/telegram/_components/channels-tab.tsx +++ b/src/app/(app)/telegram/_components/channels-tab.tsx @@ -7,6 +7,7 @@ import { getChannelColumns } from "./channel-columns"; import { DestinationCard } from "./destination-card"; import { ChannelPickerDialog } from "./channel-picker-dialog"; import { JoinChannelDialog } from "./join-channel-dialog"; +import { TopicsDrawer } from "./topics-drawer"; import { deleteChannel, toggleChannelActive, @@ -32,6 +33,7 @@ export function ChannelsTab({ channels, globalDestination, accounts }: ChannelsT const [rescanId, setRescanId] = useState(null); const [fetchChannelsAccountId, setFetchChannelsAccountId] = useState(null); const [joinDialogOpen, setJoinDialogOpen] = useState(false); + const [topicsChannelId, setTopicsChannelId] = useState(null); // Find the first authenticated account for "Fetch Channels" const authenticatedAccounts = accounts.filter((a) => a.authState === "AUTHENTICATED" && a.isActive); @@ -60,6 +62,7 @@ export function ChannelsTab({ channels, globalDestination, accounts }: ChannelsT else toast.error(result.error); }); }, + onManageTopics: (id) => setTopicsChannelId(id), }); const { table } = useDataTable({ @@ -167,6 +170,17 @@ export function ChannelsTab({ channels, globalDestination, accounts }: ChannelsT open={joinDialogOpen} onOpenChange={setJoinDialogOpen} /> + + c.id === topicsChannelId)?.title + } + open={!!topicsChannelId} + onOpenChange={(open) => { + if (!open) setTopicsChannelId(null); + }} + /> ); }