From 33530f2c275f852637e9ed6cf8f815e30a560e85 Mon Sep 17 00:00:00 2001 From: d0zingcat Date: Fri, 23 Jan 2026 22:20:02 +0800 Subject: [PATCH] feat: add toggle global topic action in admin dashboard --- apps/web/src/views/AdminView.tsx | 43 ++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/apps/web/src/views/AdminView.tsx b/apps/web/src/views/AdminView.tsx index 5b4d524..206f789 100644 --- a/apps/web/src/views/AdminView.tsx +++ b/apps/web/src/views/AdminView.tsx @@ -252,6 +252,21 @@ function TopicsManagement() { } }; + const handleToggleGlobal = async (topic: Topic) => { + try { + await client.api.topics[":id"].$post( + { + param: { id: topic.id }, + json: { isGlobal: !topic.isGlobal }, + }, + { init: { credentials: "include" } }, + ); + fetchAllTopics(); + } catch (error) { + console.error(error); + } + }; + if (loading) return
Loading topics...
; return ( @@ -320,13 +335,27 @@ function TopicsManagement() { {topic.approver?.name || "-"} - +
+ + +
))}