"use client"; 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 { CHAT_EXAMPLE_CATEGORIES } from "@/lib/chat/example-prompts"; interface ChatExamplePromptsProps { /** Called with the chosen prompt text; the caller prefills the composer. */ onSelect: (prompt: string) => void; } const CATEGORY_ICONS: Record = { search: Search, create: FilePlus2, automate: Workflow, tools: Settings2, }; const ExamplePromptButton = memo(function ExamplePromptButton({ prompt, onSelect, }: { prompt: string; onSelect: (prompt: string) => void; }) { const handleClick = useCallback(() => onSelect(prompt), [prompt, onSelect]); return ( ); }); export function ChatExamplePrompts({ onSelect }: ChatExamplePromptsProps) { const [activeCategoryId, setActiveCategoryId] = useState(null); const activeCategory = CHAT_EXAMPLE_CATEGORIES.find( (category) => category.id === activeCategoryId ); return (
{activeCategory ? null : (
{CHAT_EXAMPLE_CATEGORIES.map((category) => { const Icon = CATEGORY_ICONS[category.id] ?? WandSparkles; return ( ); })}
)} {activeCategory ? (
{activeCategory.label}
    {activeCategory.prompts.map((prompt) => (
  • ))}
) : null}
); }