import { useState } from "react"; import { useNavigate } from "react-router-dom"; import { ChevronDown, CornerDownLeft } from "lucide-react"; import { cn } from "@/lib/utils"; const CONTEXT_TAGS = [ { tag: "/running", filter: "running" }, { tag: "/stopped", filter: "stopped" }, { tag: "/attention", filter: "attention" }, ]; function SparkleIcon() { return ( ); } /** Inline explore-prompt: typed (or tag-clicked) queries jump to the Stacks * page with a matching filter — no LLM behind it (yet). */ export function AiPromptBar({ onSubmit }: { onSubmit?: (query: string) => void }) { const [open, setOpen] = useState(true); const [value, setValue] = useState(""); const navigate = useNavigate(); const submit = (raw: string) => { const query = raw.trim(); if (!query) return; if (onSubmit) { onSubmit(query); return; } const tag = CONTEXT_TAGS.find((t) => query.startsWith(t.tag)); if (tag) navigate(`/stacks?filter=${tag.filter}`); else navigate(`/stacks?q=${encodeURIComponent(query)}`); }; return (
{open && (
{ e.preventDefault(); submit(value); }} className="flex items-center gap-2 rounded-xl border border-sp-border bg-sp-surface px-3 py-2" > setValue(e.target.value)} placeholder="Show me stacks that are…" className="min-w-0 flex-1 bg-transparent text-sm text-sp-text-1 placeholder:text-sp-text-3 focus:outline-none" />
{CONTEXT_TAGS.map(({ tag }) => ( ))}
)}
); }