@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 398 lines 17.6 KB
Raw
1 import type { Icon } from "@tabler/icons-react-native/types";
2 /* Package-root imports eagerly register the entire Tabler icon set in Metro. */
3 import IconAdjustmentsHorizontal from "@tabler/icons-react-native/IconAdjustmentsHorizontal";
4 import IconAlarm from "@tabler/icons-react-native/IconAlarm";
5 import IconAlignLeft from "@tabler/icons-react-native/IconAlignLeft";
6 import IconAlertCircle from "@tabler/icons-react-native/IconAlertCircle";
7 import IconAlertTriangle from "@tabler/icons-react-native/IconAlertTriangle";
8 import IconApps from "@tabler/icons-react-native/IconApps";
9 import IconArchive from "@tabler/icons-react-native/IconArchive";
10 import IconCalendarClock from "@tabler/icons-react-native/IconCalendarClock";
11 import IconArrowBackUp from "@tabler/icons-react-native/IconArrowBackUp";
12 import IconArrowDown from "@tabler/icons-react-native/IconArrowDown";
13 import IconArrowForwardUp from "@tabler/icons-react-native/IconArrowForwardUp";
14 import IconArrowLeft from "@tabler/icons-react-native/IconArrowLeft";
15 import IconArrowRight from "@tabler/icons-react-native/IconArrowRight";
16 import IconArrowDownCircle from "@tabler/icons-react-native/IconArrowDownCircle";
17 import IconArrowRightCircle from "@tabler/icons-react-native/IconArrowRightCircle";
18 import IconArrowUp from "@tabler/icons-react-native/IconArrowUp";
19 import IconArrowUpCircle from "@tabler/icons-react-native/IconArrowUpCircle";
20 import IconArrowUpRight from "@tabler/icons-react-native/IconArrowUpRight";
21 import IconArrowUpRightCircle from "@tabler/icons-react-native/IconArrowUpRightCircle";
22 import IconArrowsLeftRight from "@tabler/icons-react-native/IconArrowsLeftRight";
23 import IconArrowsDiagonal2 from "@tabler/icons-react-native/IconArrowsDiagonal2";
24 import IconArrowsMinimize from "@tabler/icons-react-native/IconArrowsMinimize";
25 import IconBan from "@tabler/icons-react-native/IconBan";
26 import IconBellRinging from "@tabler/icons-react-native/IconBellRinging";
27 import IconBolt from "@tabler/icons-react-native/IconBolt";
28 import IconBox from "@tabler/icons-react-native/IconBox";
29 import IconBrain from "@tabler/icons-react-native/IconBrain";
30 import IconCamera from "@tabler/icons-react-native/IconCamera";
31 import IconCar from "@tabler/icons-react-native/IconCar";
32 import IconChartBar from "@tabler/icons-react-native/IconChartBar";
33 import IconCheck from "@tabler/icons-react-native/IconCheck";
34 import IconCloud from "@tabler/icons-react-native/IconCloud";
35 import IconChevronDown from "@tabler/icons-react-native/IconChevronDown";
36 import IconChevronLeft from "@tabler/icons-react-native/IconChevronLeft";
37 import IconChevronRight from "@tabler/icons-react-native/IconChevronRight";
38 import IconChevronUp from "@tabler/icons-react-native/IconChevronUp";
39 import IconCircle from "@tabler/icons-react-native/IconCircle";
40 import IconCircleFilled from "@tabler/icons-react-native/IconCircleFilled";
41 import IconCircleCheck from "@tabler/icons-react-native/IconCircleCheck";
42 import IconCircleDashed from "@tabler/icons-react-native/IconCircleDashed";
43 import IconCircleDot from "@tabler/icons-react-native/IconCircleDot";
44 import IconCircleXFilled from "@tabler/icons-react-native/IconCircleXFilled";
45 import IconMoodPlus from "@tabler/icons-react-native/IconMoodPlus";
46 import IconTag from "@tabler/icons-react-native/IconTag";
47 import IconTicket from "@tabler/icons-react-native/IconTicket";
48 import IconClock from "@tabler/icons-react-native/IconClock";
49 import IconClipboard from "@tabler/icons-react-native/IconClipboard";
50 import IconCode from "@tabler/icons-react-native/IconCode";
51 import IconCopy from "@tabler/icons-react-native/IconCopy";
52 import IconDatabase from "@tabler/icons-react-native/IconDatabase";
53 import IconDeviceDesktop from "@tabler/icons-react-native/IconDeviceDesktop";
54 import IconDeviceLaptop from "@tabler/icons-react-native/IconDeviceLaptop";
55 import IconDeviceMobile from "@tabler/icons-react-native/IconDeviceMobile";
56 import IconDots from "@tabler/icons-react-native/IconDots";
57 import IconPlusMinus from "@tabler/icons-react-native/IconPlusMinus";
58 import IconDotsVertical from "@tabler/icons-react-native/IconDotsVertical";
59 import IconDotsCircleHorizontal from "@tabler/icons-react-native/IconDotsCircleHorizontal";
60 import IconEdit from "@tabler/icons-react-native/IconEdit";
61 import IconExternalLink from "@tabler/icons-react-native/IconExternalLink";
62 import IconEyeOff from "@tabler/icons-react-native/IconEyeOff";
63 import IconEye from "@tabler/icons-react-native/IconEye";
64 import IconFileText from "@tabler/icons-react-native/IconFileText";
65 import IconFileDiff from "@tabler/icons-react-native/IconFileDiff";
66 import IconFilter from "@tabler/icons-react-native/IconFilter";
67 import IconFilterFilled from "@tabler/icons-react-native/IconFilterFilled";
68 import IconFlask from "@tabler/icons-react-native/IconFlask";
69 import IconFolder from "@tabler/icons-react-native/IconFolder";
70 import IconFolderOpen from "@tabler/icons-react-native/IconFolderOpen";
71 import IconHeadphones from "@tabler/icons-react-native/IconHeadphones";
72 import IconFolderPlus from "@tabler/icons-react-native/IconFolderPlus";
73 import IconGitPullRequestClosed from "@tabler/icons-react-native/IconGitPullRequestClosed";
74 import IconGitPullRequestDraft from "@tabler/icons-react-native/IconGitPullRequestDraft";
75 import IconGitCommit from "@tabler/icons-react-native/IconGitCommit";
76 import IconGitBranch from "@tabler/icons-react-native/IconGitBranch";
77 import IconGitMerge from "@tabler/icons-react-native/IconGitMerge";
78 import IconGitPullRequest from "@tabler/icons-react-native/IconGitPullRequest";
79 import IconHammer from "@tabler/icons-react-native/IconHammer";
80 import IconHome from "@tabler/icons-react-native/IconHome";
81 import IconInfoCircle from "@tabler/icons-react-native/IconInfoCircle";
82 import IconKeyboard from "@tabler/icons-react-native/IconKeyboard";
83 import IconKeyboardHide from "@tabler/icons-react-native/IconKeyboardHide";
84 import IconLock from "@tabler/icons-react-native/IconLock";
85 import IconLayoutColumns from "@tabler/icons-react-native/IconLayoutColumns";
86 import IconLayoutSidebar from "@tabler/icons-react-native/IconLayoutSidebar";
87 import IconLayoutSidebarRight from "@tabler/icons-react-native/IconLayoutSidebarRight";
88 import IconLetterSpacing from "@tabler/icons-react-native/IconLetterSpacing";
89 import IconMicrophone from "@tabler/icons-react-native/IconMicrophone";
90 import IconLink from "@tabler/icons-react-native/IconLink";
91 import IconListNumbers from "@tabler/icons-react-native/IconListNumbers";
92 import IconMenu2 from "@tabler/icons-react-native/IconMenu2";
93 import IconMessageCircleQuestion from "@tabler/icons-react-native/IconMessageCircleQuestion";
94 import IconMessage from "@tabler/icons-react-native/IconMessage";
95 import IconMail from "@tabler/icons-react-native/IconMail";
96 import IconMessageDots from "@tabler/icons-react-native/IconMessageDots";
97 import IconMessagePlus from "@tabler/icons-react-native/IconMessagePlus";
98 import IconMinus from "@tabler/icons-react-native/IconMinus";
99 import IconMoon from "@tabler/icons-react-native/IconMoon";
100 import IconNetwork from "@tabler/icons-react-native/IconNetwork";
101 import IconPalette from "@tabler/icons-react-native/IconPalette";
102 import IconPencil from "@tabler/icons-react-native/IconPencil";
103 import IconPlug from "@tabler/icons-react-native/IconPlug";
104 import IconPhoto from "@tabler/icons-react-native/IconPhoto";
105 import IconPin from "@tabler/icons-react-native/IconPin";
106 import IconPinnedOff from "@tabler/icons-react-native/IconPinnedOff";
107 import IconPlayerPause from "@tabler/icons-react-native/IconPlayerPause";
108 import IconPlayerPlay from "@tabler/icons-react-native/IconPlayerPlay";
109 import IconPlayerStopFilled from "@tabler/icons-react-native/IconPlayerStopFilled";
110 import IconPlus from "@tabler/icons-react-native/IconPlus";
111 import IconQrcode from "@tabler/icons-react-native/IconQrcode";
112 import IconRefresh from "@tabler/icons-react-native/IconRefresh";
113 import IconRobot from "@tabler/icons-react-native/IconRobot";
114 import IconSearch from "@tabler/icons-react-native/IconSearch";
115 import IconShare from "@tabler/icons-react-native/IconShare";
116 import IconServer from "@tabler/icons-react-native/IconServer";
117 import IconSettings from "@tabler/icons-react-native/IconSettings";
118 import IconStack2 from "@tabler/icons-react-native/IconStack2";
119 import IconStar from "@tabler/icons-react-native/IconStar";
120 import IconStarFilled from "@tabler/icons-react-native/IconStarFilled";
121 import IconStethoscope from "@tabler/icons-react-native/IconStethoscope";
122 import IconSun from "@tabler/icons-react-native/IconSun";
123 import IconShieldQuestion from "@tabler/icons-react-native/IconShieldQuestion";
124 import IconTarget from "@tabler/icons-react-native/IconTarget";
125 import IconTerminal2 from "@tabler/icons-react-native/IconTerminal2";
126 import IconTextDecrease from "@tabler/icons-react-native/IconTextDecrease";
127 import IconTextIncrease from "@tabler/icons-react-native/IconTextIncrease";
128 import IconTool from "@tabler/icons-react-native/IconTool";
129 import IconTrash from "@tabler/icons-react-native/IconTrash";
130 import IconTypography from "@tabler/icons-react-native/IconTypography";
131 import IconDownload from "@tabler/icons-react-native/IconDownload";
132 import IconSitemap from "@tabler/icons-react-native/IconSitemap";
133 import IconUpload from "@tabler/icons-react-native/IconUpload";
134 import IconUserCircle from "@tabler/icons-react-native/IconUserCircle";
135 import IconUserCheck from "@tabler/icons-react-native/IconUserCheck";
136 import IconUserX from "@tabler/icons-react-native/IconUserX";
137 import IconUserQuestion from "@tabler/icons-react-native/IconUserQuestion";
138 import IconUserPlus from "@tabler/icons-react-native/IconUserPlus";
139 import IconUsers from "@tabler/icons-react-native/IconUsers";
140 import IconWifi from "@tabler/icons-react-native/IconWifi";
141 import IconWifiOff from "@tabler/icons-react-native/IconWifiOff";
142 import IconWorld from "@tabler/icons-react-native/IconWorld";
143 import IconX from "@tabler/icons-react-native/IconX";
144 import type { AndroidSymbol, SFSymbol, SymbolViewProps } from "expo-symbols";
145 import { StyleSheet, View } from "react-native";
146 import { withUniwind } from "uniwind";
147
148 const ANDROID_ICON_BY_SF_SYMBOL = {
149 plusminus: IconPlusMinus,
150 "git.pull-request.closed": IconGitPullRequestClosed,
151 "git.pull-request.draft": IconGitPullRequestDraft,
152 "git.commit": IconGitCommit,
153 "git.issue": IconCircleDot,
154 "arrow.branch": IconGitBranch,
155 "arrow.left": IconArrowLeft,
156 "arrow.right": IconArrowRight,
157 "arrow.left.arrow.right": IconArrowsLeftRight,
158 "arrow.clockwise": IconRefresh,
159 "arrow.down": IconArrowDown,
160 "arrow.down.circle": IconArrowDownCircle,
161 "arrow.right.circle": IconArrowRightCircle,
162 "arrow.triangle.branch": IconGitBranch,
163 "arrow.triangle.merge": IconGitMerge,
164 "arrow.triangle.pull": IconGitPullRequest,
165 "square.3.layers.3d": IconStack2,
166 "arrow.turn.left.up": IconArrowBackUp,
167 "arrow.up": IconArrowUp,
168 "arrow.up.circle": IconArrowUpCircle,
169 "arrow.up.left.and.arrow.down.right": IconArrowsDiagonal2,
170 "arrow.down.right.and.arrow.up.left": IconArrowsMinimize,
171 "arrow.up.right": IconArrowUpRight,
172 "arrow.up.right.circle": IconArrowUpRightCircle,
173 "arrow.uturn.backward": IconArrowBackUp,
174 "arrow.uturn.forward": IconArrowForwardUp,
175 archivebox: IconArchive,
176 "archivebox.fill": IconArchive,
177 "bell.badge": IconBellRinging,
178 "bolt.circle": IconBolt,
179 "bolt.horizontal.circle": IconBolt,
180 brain: IconBrain,
181 "cable.connector": IconPlug,
182 camera: IconCamera,
183 car: IconCar,
184 "chart.bar.xaxis": IconChartBar,
185 checkmark: IconCheck,
186 "checkmark.circle": IconCircleCheck,
187 "checkmark.circle.fill": IconCircleCheck,
188 circle: IconCircle,
189 "circle.fill": IconCircleFilled,
190 "circle.dashed": IconCircleDashed,
191 "circle.inset.filled": IconCircleDot,
192 "circle.dashed.inset.filled": IconCircleDot,
193 "calendar.badge.clock": IconCalendarClock,
194 alarm: IconAlarm,
195 clock: IconClock,
196 timer: IconClock,
197 "face.smiling": IconMoodPlus,
198 tag: IconTag,
199 ticket: IconTicket,
200 cloud: IconCloud,
201 cube: IconBox,
202 "chevron.down": IconChevronDown,
203 "chevron.left": IconChevronLeft,
204 "chevron.left.forwardslash.chevron.right": IconCode,
205 "chevron.right": IconChevronRight,
206 "chevron.up": IconChevronUp,
207 desktopcomputer: IconDeviceDesktop,
208 doc: IconFileText,
209 "doc.on.doc": IconCopy,
210 "doc.text": IconFileText,
211 "file.diff": IconFileDiff,
212 ellipsis: IconDots,
213 moon: IconMoon,
214 "ellipsis.circle": IconDotsCircleHorizontal,
215 "envelope.badge": IconMail,
216 "exclamationmark.triangle": IconAlertTriangle,
217 "exclamationmark.circle": IconAlertCircle,
218 eye: IconEye,
219 "eye.slash": IconEyeOff,
220 flask: IconFlask,
221 folder: IconFolder,
222 "folder.badge.plus": IconFolderPlus,
223 "folder.fill": IconFolder,
224 gearshape: IconSettings,
225 globe: IconWorld,
226 hammer: IconHammer,
227 headphones: IconHeadphones,
228 house: IconHome,
229 "info.circle": IconInfoCircle,
230 internaldrive: IconDatabase,
231 iphone: IconDeviceMobile,
232 keyboard: IconKeyboard,
233 laptopcomputer: IconDeviceLaptop,
234 link: IconLink,
235 "list.number": IconListNumbers,
236 "line.3.horizontal": IconMenu2,
237 "line.3.horizontal.decrease": IconFilter,
238 "line.3.horizontal.decrease.circle": IconFilter,
239 "line.3.horizontal.decrease.circle.fill": IconFilterFilled,
240 macmini: IconServer,
241 macstudio: IconDeviceDesktop,
242 magnifyingglass: IconSearch,
243 mic: IconMicrophone,
244 paintbrush: IconPalette,
245 pencil: IconPencil,
246 "person.crop.circle": IconUserCircle,
247 "person.2": IconUsers,
248 "person.fill.checkmark": IconUserCheck,
249 "person.fill.xmark": IconUserX,
250 "person.badge.clock": IconUserQuestion,
251 "person.badge.plus": IconUserPlus,
252 photo: IconPhoto,
253 pin: IconPin,
254 "pin.slash": IconPinnedOff,
255 play: IconPlayerPlay,
256 pause: IconPlayerPause,
257 plus: IconPlus,
258 minus: IconMinus,
259 "slash.circle": IconBan,
260 "qrcode.viewfinder": IconQrcode,
261 "point.3.connected.trianglepath.dotted": IconNetwork,
262 flowchart: IconSitemap,
263 "point.topleft.down.curvedto.point.bottomright.up": IconGitMerge,
264 safari: IconExternalLink,
265 "server.rack": IconServer,
266 stethoscope: IconStethoscope,
267 "sidebar.left": IconLayoutSidebar,
268 "sidebar.right": IconLayoutSidebarRight,
269 "slider.horizontal.3": IconAdjustmentsHorizontal,
270 "square.and.arrow.up": IconShare,
271 "square.and.pencil": IconEdit,
272 "square.on.square": IconCopy,
273 "square.grid.2x2": IconApps,
274 "square.split.2x1": IconLayoutColumns,
275 star: IconStar,
276 "star.fill": IconStarFilled,
277 "sun.max": IconSun,
278 "stop.fill": IconPlayerStopFilled,
279 target: IconTarget,
280 terminal: IconTerminal2,
281 "text.alignleft": IconAlignLeft,
282 "text.bubble": IconMessage,
283 "questionmark.bubble": IconMessageCircleQuestion,
284 "exclamationmark.shield": IconShieldQuestion,
285 "bubble.left.and.bubble.right": IconMessage,
286 "bubble.left": IconMessage,
287 "plus.bubble": IconMessagePlus,
288 "ellipsis.bubble": IconMessageDots,
289 robot: IconRobot,
290 "text.word.spacing": IconLetterSpacing,
291 "textformat.size": IconTypography,
292 "textformat.size.larger": IconTextIncrease,
293 "textformat.size.smaller": IconTextDecrease,
294 "tray.and.arrow.down": IconDownload,
295 "tray.and.arrow.up": IconUpload,
296 trash: IconTrash,
297 wifi: IconWifi,
298 "wifi.slash": IconWifiOff,
299 "wrench.and.screwdriver": IconTool,
300 xmark: IconX,
301 "xmark.circle.fill": IconCircleXFilled,
302 } satisfies Partial<
303 Record<
304 | SFSymbol
305 | "git.pull-request.closed"
306 | "git.pull-request.draft"
307 | "git.commit"
308 | "git.issue"
309 | "file.diff"
310 | "robot",
311 Icon
312 >
313 >;
314 const SF_ICON_LOOKUP: Partial<
315 Record<
316 | SFSymbol
317 | "git.pull-request.closed"
318 | "git.pull-request.draft"
319 | "git.commit"
320 | "git.issue"
321 | "file.diff"
322 | "robot",
323 Icon
324 >
325 > = ANDROID_ICON_BY_SF_SYMBOL;
326
327 const ANDROID_ICON_BY_MATERIAL_NAME = {
328 bolt: IconBolt,
329 build: IconTool,
330 chat: IconMessage,
331 chat_bubble: IconMessage,
332 check: IconCheck,
333 close: IconX,
334 construction: IconHammer,
335 content_copy: IconCopy,
336 content_paste: IconClipboard,
337 desktop_windows: IconDeviceDesktop,
338 edit: IconEdit,
339 error: IconAlertCircle,
340 folder: IconFolder,
341 folder_open: IconFolderOpen,
342 keyboard: IconKeyboard,
343 keyboard_arrow_down: IconChevronDown,
344 keyboard_arrow_up: IconChevronUp,
345 keyboard_hide: IconKeyboardHide,
346 lock: IconLock,
347 more_vert: IconDotsVertical,
348 merge: IconGitMerge,
349 psychology: IconBrain,
350 public: IconWorld,
351 remove: IconMinus,
352 smartphone: IconDeviceMobile,
353 terminal: IconTerminal2,
354 visibility: IconEye,
355 } satisfies Partial<Record<AndroidSymbol, Icon>>;
356
357 export type { SFSymbol } from "expo-symbols";
358 export type AppSymbolName =
359 | keyof typeof ANDROID_ICON_BY_SF_SYMBOL
360 | {
361 ios: SFSymbol;
362 android: keyof typeof ANDROID_ICON_BY_MATERIAL_NAME;
363 };
364
365 export type AppSymbolViewProps = Omit<SymbolViewProps, "name"> & { name: AppSymbolName };
366
367 export function isAppSymbolName(name: string): name is Extract<AppSymbolName, string> {
368 return Object.prototype.hasOwnProperty.call(ANDROID_ICON_BY_SF_SYMBOL, name);
369 }
370
371 function AppSymbolView(props: AppSymbolViewProps) {
372 const materialName = typeof props.name === "string" ? undefined : props.name.android;
373 const sfSymbol = typeof props.name === "string" ? props.name : props.name.ios;
374 const AndroidIcon =
375 (materialName ? ANDROID_ICON_BY_MATERIAL_NAME[materialName] : undefined) ??
376 (sfSymbol ? SF_ICON_LOOKUP[sfSymbol] : undefined);
377
378 if (!AndroidIcon) {
379 return props.fallback ?? null;
380 }
381
382 // react-native-svg applies style.transform to its inner path around (0,0), so a
383 // rotated icon draws outside its box. Transform a wrapping View instead.
384 const transformed = StyleSheet.flatten(props.style)?.transform !== undefined;
385 const icon = (
386 <AndroidIcon
387 accessibilityLabel={props.accessibilityLabel}
388 color={props.tintColor}
389 size={props.size}
390 strokeWidth={2}
391 style={transformed ? undefined : props.style}
392 testID={props.testID}
393 />
394 );
395 return transformed ? <View style={props.style}>{icon}</View> : icon;
396 }
397
398 export const SymbolView = withUniwind(AppSymbolView);