@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 55 lines 1.76 KB
Raw
1 import { Plural, T, useGT, Var } from "gt-react-native";
2 import { Pressable, View } from "react-native";
3
4 import { AppText } from "../../components/ui/AppText";
5 import { SymbolView } from "../../components/ui/AppSymbol";
6
7 export function DevicePreviewButton(props: {
8 readonly count: number;
9 readonly onPress: () => void;
10 readonly compact?: boolean;
11 }) {
12 const compact = props.compact ?? true;
13 const gt = useGT();
14 return (
15 <Pressable
16 accessibilityRole="button"
17 accessibilityLabel={gt("{count, plural, =1 {View device} other {View {count} devices}}", {
18 count: props.count,
19 })}
20 accessibilityHint={gt("Watch and control devices open in this thread")}
21 onPress={props.onPress}
22 className={
23 compact
24 ? "size-11 shrink-0 items-center justify-center rounded-full active:bg-subtle"
25 : "h-11 shrink-0 flex-row items-center justify-center gap-2 rounded-full px-4 active:bg-subtle"
26 }
27 >
28 <SymbolView
29 name={{ ios: "iphone", android: "smartphone" }}
30 size={20}
31 tintColorClassName="accent-icon"
32 type="monochrome"
33 />
34 {!compact ? (
35 <AppText className="font-t3-medium text-xs text-foreground">
36 <T>
37 <Plural
38 n={props.count}
39 singular="One device open"
40 other={
41 <>
42 <Var>{props.count}</Var> devices open
43 </>
44 }
45 />
46 </T>
47 </AppText>
48 ) : props.count > 1 ? (
49 <View className="absolute right-1.5 top-1.5 min-w-4 items-center rounded-full bg-primary px-1">
50 <AppText className="text-2xs font-t3-bold text-primary-foreground">{props.count}</AppText>
51 </View>
52 ) : null}
53 </Pressable>
54 );
55 }