From 3c3ec76d776616cda56f7470f62996f84333b3e0 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Tue, 14 Jul 2026 00:15:38 +0530 Subject: [PATCH] feat(thread): add inline chat-unavailable notice to composer --- .../components/assistant-ui/thread.tsx | 68 +++++++++++++++++-- 1 file changed, 62 insertions(+), 6 deletions(-) diff --git a/surfsense_web/components/assistant-ui/thread.tsx b/surfsense_web/components/assistant-ui/thread.tsx index 0cee0d078..9e03c2577 100644 --- a/surfsense_web/components/assistant-ui/thread.tsx +++ b/surfsense_web/components/assistant-ui/thread.tsx @@ -24,7 +24,7 @@ import { } from "lucide-react"; import { AnimatePresence, motion } from "motion/react"; import Image from "next/image"; -import { useParams } from "next/navigation"; +import { useParams, useRouter } from "next/navigation"; import { type FC, useCallback, useEffect, useMemo, useRef, useState } from "react"; import { agentToolsAtom, @@ -444,6 +444,52 @@ const ClipboardChip: FC<{ text: string; onDismiss: () => void }> = ({ text, onDi ); }; +/** + * Inline "this workspace can't chat yet" tray, mirrored on top of the composer + * (same visual treatment as the "Connect your tools" tray below it). + * + * Replaces the old full-screen onboarding redirect: a workspace with no usable + * chat model (fresh install, or an admin deleted the last model) renders the + * composer in place with this notice instead of navigating away. Configurable + * members get a CTA to connect one; everyone else is told to ask an admin. The + * send button stays disabled independently, and the backend rejects any send + * that slips through, so this is purely guidance. + * + * Presentational: visibility is decided by the parent so the composer can flatten + * its top shadow for a seamless join. + */ +const ChatUnavailableNotice: FC<{ workspaceId: number; canConfigure: boolean }> = ({ + workspaceId, + canConfigure, +}) => { + const router = useRouter(); + + return ( +