The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import type { ServerProcessSignal } from "@t3tools/contracts"; |
| 2 | import { T, useGT, Var } from "gt-react"; |
| 3 | |
| 4 | import { InlineButton } from "../ui/button"; |
| 5 | import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; |
| 6 | |
| 7 | const SIGNAL_SHORT_NAMES = { SIGINT: "INT", SIGKILL: "KILL" } as const; |
| 8 | |
| 9 | export function ProcessSignalActions({ |
| 10 | disabled, |
| 11 | onSignal, |
| 12 | }: { |
| 13 | disabled: boolean; |
| 14 | onSignal: (signal: ServerProcessSignal) => void; |
| 15 | }) { |
| 16 | const gt = useGT(); |
| 17 | return ( |
| 18 | <div className="flex items-center justify-end gap-1.5"> |
| 19 | <Tooltip> |
| 20 | <TooltipTrigger |
| 21 | render={ |
| 22 | <InlineButton |
| 23 | disabled={disabled} |
| 24 | aria-label={gt("Send {signal}", { signal: "SIGINT" })} |
| 25 | tone="muted" |
| 26 | onClick={() => onSignal("SIGINT")} |
| 27 | > |
| 28 | {SIGNAL_SHORT_NAMES.SIGINT} |
| 29 | </InlineButton> |
| 30 | } |
| 31 | /> |
| 32 | <TooltipPopup side="top"> |
| 33 | <T> |
| 34 | Send <Var>{"SIGINT"}</Var> |
| 35 | </T> |
| 36 | </TooltipPopup> |
| 37 | </Tooltip> |
| 38 | <Tooltip> |
| 39 | <TooltipTrigger |
| 40 | render={ |
| 41 | <InlineButton |
| 42 | disabled={disabled} |
| 43 | aria-label={gt("Send {signal}", { signal: "SIGKILL" })} |
| 44 | tone="destructive" |
| 45 | onClick={() => onSignal("SIGKILL")} |
| 46 | > |
| 47 | {SIGNAL_SHORT_NAMES.SIGKILL} |
| 48 | </InlineButton> |
| 49 | } |
| 50 | /> |
| 51 | <TooltipPopup side="top"> |
| 52 | <T> |
| 53 | Send <Var>{"SIGKILL"}</Var> |
| 54 | </T> |
| 55 | </TooltipPopup> |
| 56 | </Tooltip> |
| 57 | </div> |
| 58 | ); |
| 59 | } |