@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 74 lines 1.94 KB
Raw
1 import type { EnvironmentMachineKind } from "@t3tools/contracts";
2 import { msg } from "gt-react";
3 import { CloudIcon, LaptopIcon, MonitorIcon, ServerIcon, type LucideProps } from "lucide-react";
4 import type { FunctionComponent, SVGProps } from "react";
5 import { LinuxIcon } from "./Icons";
6
7 function LucideLike(props: SVGProps<SVGSVGElement>) {
8 return (
9 <svg
10 xmlns="http://www.w3.org/2000/svg"
11 width="24"
12 height="24"
13 viewBox="0 0 24 24"
14 fill="none"
15 stroke="currentColor"
16 strokeWidth="1.75"
17 strokeLinecap="round"
18 strokeLinejoin="round"
19 {...props}
20 />
21 );
22 }
23
24 function MacMiniIcon(props: SVGProps<SVGSVGElement>) {
25 return (
26 <LucideLike {...props}>
27 <rect width="18" height="12" x="3" y="6" rx="2.5" />
28 <circle cx="7.5" cy="12" r="1" fill="currentColor" stroke="none" />
29 </LucideLike>
30 );
31 }
32
33 function MacStudioIcon(props: SVGProps<SVGSVGElement>) {
34 return (
35 <LucideLike {...props}>
36 <rect width="18" height="14" x="3" y="5" rx="2" />
37 <path d="M7 15h.01M11 15h.01M15 15h.01" />
38 </LucideLike>
39 );
40 }
41
42 const ICON_BY_KIND: Record<EnvironmentMachineKind, FunctionComponent<LucideProps>> = {
43 server: ServerIcon,
44 cloud: CloudIcon,
45 linux: LinuxIcon,
46 desktop: MonitorIcon,
47 laptop: LaptopIcon,
48 "mac-mini": MacMiniIcon,
49 "mac-studio": MacStudioIcon,
50 };
51
52 export const ENVIRONMENT_MACHINE_KIND_LABELS: Record<EnvironmentMachineKind, string> = {
53 server: msg("Server"),
54 cloud: msg("Cloud VM"),
55 linux: msg("Linux/WSL"),
56 desktop: msg("Desktop"),
57 laptop: msg("Laptop"),
58 "mac-mini": msg("Mini PC"),
59 "mac-studio": msg("Workstation"),
60 };
61
62 export function environmentMachineIcon(
63 kind: EnvironmentMachineKind,
64 ): FunctionComponent<LucideProps> {
65 return ICON_BY_KIND[kind];
66 }
67
68 export function EnvironmentMachineIcon({
69 kind,
70 ...props
71 }: LucideProps & { readonly kind: EnvironmentMachineKind }) {
72 const Icon = ICON_BY_KIND[kind];
73 return <Icon {...props} />;
74 }