@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

main
tsx 53 lines 1.53 KB
Raw
1 import { msg, T, useGT } from "gt-react";
2
3 import { APP_VERSION } from "../../branding";
4 import { useCopyToClipboard } from "../../hooks/useCopyToClipboard";
5 import { InlineButton } from "../ui/button";
6 import { stackedThreadToast, toastManager } from "../ui/toast";
7 import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
8
9 export function AboutVersionTitle() {
10 const gt = useGT();
11 const { copyToClipboard } = useCopyToClipboard<void>({
12 target: {
13 target: "version",
14 unavailableMessage: msg("Clipboard API is unavailable while copying version."),
15 failureMessage: msg("Failed to copy version to the clipboard."),
16 },
17 onError: (error) => {
18 toastManager.add(
19 stackedThreadToast({
20 type: "error",
21 title: gt("Could not copy version"),
22 description: error.message,
23 }),
24 );
25 },
26 });
27
28 return (
29 <span className="inline-flex items-baseline gap-2">
30 <span>
31 <T>Version</T>
32 </span>
33 <code className="text-2xs font-medium">
34 <Tooltip>
35 <TooltipTrigger
36 render={
37 <InlineButton
38 tone="muted"
39 aria-label={gt("Copy version {version}", { version: APP_VERSION })}
40 onClick={() => copyToClipboard(APP_VERSION, undefined)}
41 >
42 {APP_VERSION}
43 </InlineButton>
44 }
45 />
46 <TooltipPopup>
47 <T>Copy version</T>
48 </TooltipPopup>
49 </Tooltip>
50 </code>
51 </span>
52 );
53 }