Skip to content
76 linesCodeBlameRaw
1import { ArrowUp, AtSign, BookMarked, ChevronDown, MessageSquare, Plus, Sparkles } from "lucide-react";
2import type { ReactNode } from "react";
3
4import { Badge } from "./ui/badge";
5import { Card } from "./ui/card";
6import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
7
8/**
9 * Mission control's place to ask g1t for anything: a question, a plan it
10 * splits into issues for agents, or work started straight away. Shown so
11 * it is clear where this will be, and not usable yet: nothing here sends,
12 * and every control says so. Until then the actions under it do the work.
13 */
14export function AskComposer({ children }: { children?: ReactNode }) {
15 return (
16 <section aria-label="Agent" className="space-y-3">
17 <Card aria-disabled="true" className="opacity-80">
18 <p className="flex items-center gap-2 px-4 pt-3 text-sm font-medium text-fg">
19 <Sparkles size={14} className="text-accent" aria-hidden="true" />
20 Agent
21 <Badge className="px-1.5 py-0 font-normal">Coming soon</Badge>
22 </p>
23 <label htmlFor="ask-g1t" className="sr-only">
24 Ask the agent (coming soon)
25 </label>
26 <textarea
27 id="ask-g1t"
28 disabled
29 rows={2}
30 placeholder="Ask anything, plan something out, or describe work to start. Type @ to add context."
31 className="block w-full cursor-not-allowed resize-none bg-transparent px-4 pt-3.5 pb-2 text-sm text-fg placeholder:text-muted focus:outline-none"
32 />
33 <div className="flex flex-wrap items-center gap-2 px-3 pb-3">
34 <Soon label="Mode">
35 <MessageSquare size={14} /> Ask <ChevronDown size={13} className="text-faint" />
36 </Soon>
37 <Soon label="Scope">
38 <BookMarked size={14} /> All repositories <ChevronDown size={13} className="text-faint" />
39 </Soon>
40 <Soon label="Add context" icon>
41 <Plus size={15} />
42 </Soon>
43 <Soon label="Mention" icon>
44 <AtSign size={14} />
45 </Soon>
46 <span className="ml-auto" />
47 <Soon label="Send" icon>
48 <ArrowUp size={15} />
49 </Soon>
50 </div>
51 </Card>
52 {children && <div className="flex flex-wrap items-center gap-2">{children}</div>}
53 </section>
54 );
55}
56
57/** One of the composer's controls: there, disabled, with a tooltip saying why. */
58function Soon({ label, icon, children }: { label: string; icon?: boolean; children: ReactNode }) {
59 return (
60 <Tooltip>
61 <TooltipTrigger asChild>
62 <span tabIndex={0} className="inline-flex rounded-md outline-none focus-visible:ring-2 focus-visible:ring-accent">
63 <button
64 type="button"
65 disabled
66 aria-label={`${label} (coming soon)`}
67 className={`pointer-events-none inline-flex h-8 items-center gap-1.5 rounded-md border border-line text-sm text-muted ${icon ? "w-8 justify-center" : "px-2.5"}`}
68 >
69 {children}
70 </button>
71 </span>
72 </TooltipTrigger>
73 <TooltipContent>Agent is coming soon</TooltipContent>
74 </Tooltip>
75 );
76}