1import { Pressable, View } from "react-native";
2
3import { AppText } from "../../components/AppText";
4import { SymbolView } from "../../components/AppSymbol";
5
6export function DevicePreviewButton(props: {
7 readonly count: number;
8 readonly onPress: () => void;
9 readonly compact?: boolean;
10}) {
11 const compact = props.compact ?? true;
12 return (
13 <Pressable
14 accessibilityRole="button"
15 accessibilityLabel={props.count === 1 ? "View device" : `View ${props.count} devices`}
16 accessibilityHint="Watch and control devices open in this thread"
17 onPress={props.onPress}
18 className={
19 compact
20 ? "size-11 shrink-0 items-center justify-center rounded-full active:bg-subtle"
21 : "h-11 shrink-0 flex-row items-center justify-center gap-2 rounded-full px-4 active:bg-subtle"
22 }
23 >
24 <SymbolView
25 name={{ ios: "iphone", android: "smartphone" }}
26 size={20}
27 tintColorClassName="accent-icon"
28 type="monochrome"
29 />
30 {!compact ? (
31 <AppText className="font-t3-medium text-xs text-foreground">
32 {props.count === 1 ? "One device open" : `${props.count} devices open`}
33 </AppText>
34 ) : props.count > 1 ? (
35 <View className="absolute right-1.5 top-1.5 min-w-4 items-center rounded-full bg-primary px-1">
36 <AppText className="text-2xs font-t3-bold text-primary-foreground">{props.count}</AppText>
37 </View>
38 ) : null}
39 </Pressable>
40 );
41}