Skip to content

g1t/apps/web/app/components/ask-composer.tsx

72 lines3,030 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

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