From 5fce4e162133ddf7ac499e4211e1095fb700376a Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Tue, 2 Jun 2026 22:52:48 +0530 Subject: [PATCH] feat(chat): enhance ChatViewport with conditional footer rendering and update ChatExamplePrompts for improved category selection --- .../components/assistant-ui/chat-viewport.tsx | 22 ++-- .../new-chat/chat-example-prompts.tsx | 114 ++++++++++++------ surfsense_web/lib/chat/example-prompts.ts | 4 - 3 files changed, 87 insertions(+), 53 deletions(-) diff --git a/surfsense_web/components/assistant-ui/chat-viewport.tsx b/surfsense_web/components/assistant-ui/chat-viewport.tsx index cb0fd2005..83308b642 100644 --- a/surfsense_web/components/assistant-ui/chat-viewport.tsx +++ b/surfsense_web/components/assistant-ui/chat-viewport.tsx @@ -1,6 +1,6 @@ "use client"; -import { ThreadPrimitive } from "@assistant-ui/react"; +import { AuiIf, ThreadPrimitive } from "@assistant-ui/react"; import { ArrowDownIcon } from "lucide-react"; import type { FC, ReactNode } from "react"; import { Button } from "@/components/ui/button"; @@ -40,15 +40,17 @@ export const ChatViewport: FC = ({ children, footer }) => ( /> {children} {footer ? ( - -
- - {footer} -
-
+ !thread.isEmpty}> + +
+ + {footer} +
+
+
) : null} ); diff --git a/surfsense_web/components/new-chat/chat-example-prompts.tsx b/surfsense_web/components/new-chat/chat-example-prompts.tsx index 95d7a0eaa..f36247f37 100644 --- a/surfsense_web/components/new-chat/chat-example-prompts.tsx +++ b/surfsense_web/components/new-chat/chat-example-prompts.tsx @@ -1,10 +1,17 @@ "use client"; -import { CornerDownLeft, Lightbulb } from "lucide-react"; -import { memo, useCallback } from "react"; +import { + FilePlus2, + Search, + Settings2, + type LucideIcon, + WandSparkles, + Workflow, + X, +} from "lucide-react"; +import { memo, useCallback, useState } from "react"; import { Button } from "@/components/ui/button"; import { ScrollArea } from "@/components/ui/scroll-area"; -import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { CHAT_EXAMPLE_CATEGORIES } from "@/lib/chat/example-prompts"; interface ChatExamplePromptsProps { @@ -12,6 +19,13 @@ interface ChatExamplePromptsProps { onSelect: (prompt: string) => void; } +const CATEGORY_ICONS: Record = { + search: Search, + create: FilePlus2, + automate: Workflow, + tools: Settings2, +}; + const ExamplePromptButton = memo(function ExamplePromptButton({ prompt, onSelect, @@ -26,50 +40,72 @@ const ExamplePromptButton = memo(function ExamplePromptButton({ type="button" variant="ghost" onClick={handleClick} - className="h-auto w-full items-start justify-start gap-2.5 whitespace-normal rounded-md border bg-background px-3 py-2 text-left font-normal text-muted-foreground hover:bg-accent hover:text-accent-foreground" + className="h-auto w-full items-start justify-start whitespace-normal rounded-lg bg-transparent px-2.5 py-1.5 text-left font-normal text-muted-foreground shadow-none hover:bg-foreground/10 hover:text-foreground sm:rounded-xl sm:px-3 sm:py-2" > -