From 67f797232e2590d0444ec0df67f9db090aecf1a1 Mon Sep 17 00:00:00 2001 From: CREDO23 Date: Mon, 2 Feb 2026 16:40:11 +0200 Subject: [PATCH] feat: add public chat links settings page --- .../[search_space_id]/settings/page.tsx | 11 +++++++++++ .../public-chat-snapshots-manager.tsx | 16 ++++++++++++++-- surfsense_web/messages/en.json | 2 ++ surfsense_web/messages/zh.json | 2 ++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/surfsense_web/app/dashboard/[search_space_id]/settings/page.tsx b/surfsense_web/app/dashboard/[search_space_id]/settings/page.tsx index 8c8bdb2e9..1a727f1b6 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/settings/page.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/settings/page.tsx @@ -6,6 +6,7 @@ import { Brain, ChevronRight, FileText, + Globe, type LucideIcon, Menu, MessageSquare, @@ -16,6 +17,7 @@ import { AnimatePresence, motion } from "motion/react"; import { useParams, useRouter } from "next/navigation"; import { useTranslations } from "next-intl"; import { useCallback, useEffect, useState } from "react"; +import { PublicChatSnapshotsManager } from "@/components/public-chat-snapshots/public-chat-snapshots-manager"; import { GeneralSettingsManager } from "@/components/settings/general-settings-manager"; import { LLMRoleManager } from "@/components/settings/llm-role-manager"; import { ModelConfigManager } from "@/components/settings/model-config-manager"; @@ -56,6 +58,12 @@ const settingsNavItems: SettingsNavItem[] = [ descriptionKey: "nav_system_instructions_desc", icon: MessageSquare, }, + { + id: "public-links", + labelKey: "nav_public_links", + descriptionKey: "nav_public_links_desc", + icon: Globe, + }, ]; function SettingsSidebar({ @@ -276,6 +284,9 @@ function SettingsContent({ {activeSection === "models" && } {activeSection === "roles" && } {activeSection === "prompts" && } + {activeSection === "public-links" && ( + + )} diff --git a/surfsense_web/components/public-chat-snapshots/public-chat-snapshots-manager.tsx b/surfsense_web/components/public-chat-snapshots/public-chat-snapshots-manager.tsx index a24efcd77..1c5c1fe42 100644 --- a/surfsense_web/components/public-chat-snapshots/public-chat-snapshots-manager.tsx +++ b/surfsense_web/components/public-chat-snapshots/public-chat-snapshots-manager.tsx @@ -1,7 +1,7 @@ "use client"; import { useAtomValue } from "jotai"; -import { Globe, Info } from "lucide-react"; +import { AlertCircle, Globe, Info } from "lucide-react"; import { useCallback, useMemo, useState } from "react"; import { toast } from "sonner"; import { deletePublicChatSnapshotMutationAtom } from "@/atoms/public-chat-snapshots/public-chat-snapshots-mutation.atoms"; @@ -23,7 +23,7 @@ export function PublicChatSnapshotsManager({ const [deletingId, setDeletingId] = useState(); // Data fetching - const { data: snapshotsData, isLoading, refetch } = useAtomValue(publicChatSnapshotsAtom); + const { data: snapshotsData, isLoading, isError, refetch } = useAtomValue(publicChatSnapshotsAtom); // Permissions const { data: access } = useAtomValue(myAccessAtom); @@ -84,6 +84,18 @@ export function PublicChatSnapshotsManager({ ); } + // Error state + if (isError) { + return ( + + + + Failed to load public chat links. Please try again later. + + + ); + } + // Permission denied if (!canView) { return ( diff --git a/surfsense_web/messages/en.json b/surfsense_web/messages/en.json index a9a75d8dc..409a6fb6f 100644 --- a/surfsense_web/messages/en.json +++ b/surfsense_web/messages/en.json @@ -731,6 +731,8 @@ "nav_role_assignments_desc": "Assign configs to agent roles", "nav_system_instructions": "System Instructions", "nav_system_instructions_desc": "SearchSpace-wide AI instructions", + "nav_public_links": "Public Chat Links", + "nav_public_links_desc": "Manage publicly shared chat links", "general_name_label": "Name", "general_name_placeholder": "Enter search space name", "general_name_description": "A unique name for your search space.", diff --git a/surfsense_web/messages/zh.json b/surfsense_web/messages/zh.json index 7c0fd8400..750902915 100644 --- a/surfsense_web/messages/zh.json +++ b/surfsense_web/messages/zh.json @@ -716,6 +716,8 @@ "nav_role_assignments_desc": "为代理角色分配配置", "nav_system_instructions": "系统指令", "nav_system_instructions_desc": "搜索空间级别的 AI 指令", + "nav_public_links": "公开聊天链接", + "nav_public_links_desc": "管理公开分享的聊天链接", "general_name_label": "名称", "general_name_placeholder": "输入搜索空间名称", "general_name_description": "您的搜索空间的唯一名称。",