Open History to see the last commit
1import { Select, T, useGT, Var, plural, part } from "gt-react-native";
2import { Pressable, View } from "react-native";
3
4import { AppText } from "../../components/ui/AppText";
5import { SymbolView } from "../../components/ui/AppSymbol";
6
7export function BrowserPreviewButton(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`${plural(
18 { count: props.count },
19 {
20 "=1": "View browser",
21 other: part`View ${{ count: props.count }} browser tabs`,
22 },
23 )}`}
24 accessibilityHint={gt`Watch and control browser tabs open in this thread`}
25 onPress={props.onPress}
26 className={
27 compact
28 ? "size-11 shrink-0 items-center justify-center rounded-full active:bg-subtle"
29 : "h-11 shrink-0 flex-row items-center justify-center gap-2 rounded-full px-4 active:bg-subtle"
30 }
31 >
32 <SymbolView name="globe" size={20} tintColorClassName="accent-icon" type="monochrome" />
33 {!compact ? (
34 <AppText className="font-t3-medium text-xs text-foreground">
35 <T>
36 <Select value={props.count === 1 ? "singular" : "other"} singular="One tab open">
37 <Var>{props.count}</Var> tabs open
38 </Select>
39 </T>
40 </AppText>
41 ) : props.count > 1 ? (
42 <View className="absolute right-1.5 top-1.5 min-w-4 items-center rounded-full bg-primary px-1">
43 <AppText className="text-2xs font-t3-bold text-primary-foreground">{props.count}</AppText>
44 </View>
45 ) : null}
46 </Pressable>
47 );
48}