The best way to control Claude Code, Codex and more from any computer or phone

main
tsx 79 lines 2.67 KB
Raw
1 import { msg, T, Var } from "gt-react";
2 import { useCopyToClipboard } from "~/hooks/useCopyToClipboard";
3 import { TRIAGE_CLI_COMMAND } from "~/hooks/useStartTriage";
4
5 import { InlineButton } from "../ui/button";
6 import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
7
8 /**
9 * The empty-draft hero for a triage session, in place of "What should we work on?".
10 * Keeps the regular hero's heading-plus-one-line rhythm above the composer.
11 */
12 export function TriageDraftHero(props: {
13 readonly machineLabel: string | null;
14 readonly serverVersion: string | null;
15 }) {
16 const { copyToClipboard, isCopied } = useCopyToClipboard({
17 timeout: 1500,
18 target: {
19 target: "command",
20 unavailableMessage: msg("Clipboard API is unavailable while copying command."),
21 failureMessage: msg("Failed to copy command to the clipboard."),
22 },
23 });
24 return (
25 <div className="mx-auto flex w-full max-w-5xl flex-col items-center">
26 <h1 className="w-full text-center font-normal text-2xl text-foreground tracking-tight sm:text-3xl">
27 <T>What went wrong?</T>
28 </h1>
29 <p className="mt-2 flex h-6 w-full items-center justify-center gap-1.5 text-sm">
30 <Tooltip>
31 <TooltipTrigger
32 render={<span tabIndex={0} className="min-w-0 truncate font-medium text-foreground" />}
33 >
34 {props.machineLabel ?? <T>This machine</T>}
35 {props.serverVersion === null ? null : (
36 <span className="ml-1.5 font-normal text-muted-foreground">
37 v{props.serverVersion}
38 </span>
39 )}
40 </TooltipTrigger>
41 <TooltipPopup side="bottom">
42 <T>
43 The agent reads T3 Code's logs and source here, and asks before it applies a fix or
44 posts anything.
45 </T>
46 </TooltipPopup>
47 </Tooltip>
48 <span aria-hidden className="text-muted-foreground">
49 ·
50 </span>
51 <Tooltip>
52 <TooltipTrigger
53 render={
54 <InlineButton
55 tone="muted"
56 className="pointer-events-auto"
57 onClick={() => copyToClipboard(TRIAGE_CLI_COMMAND, undefined)}
58 />
59 }
60 >
61 {isCopied ? (
62 <T>Copied</T>
63 ) : (
64 <T>
65 or run
66 <code className="ml-1 font-mono text-xs">
67 <Var>{TRIAGE_CLI_COMMAND}</Var>
68 </code>
69 </T>
70 )}
71 </TooltipTrigger>
72 <TooltipPopup side="bottom">
73 <T>Copy command, for a terminal</T>
74 </TooltipPopup>
75 </Tooltip>
76 </p>
77 </div>
78 );
79 }