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
| 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 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( |
| 18 | "{count, plural, =1 {View browser} other {View {count} browser tabs}}", |
| 19 | { |
| 20 | count: props.count, |
| 21 | }, |
| 22 | )} |
| 23 | accessibilityHint={gt("Watch and control browser tabs open in this thread")} |
| 24 | onPress={props.onPress} |
| 25 | className={ |
| 26 | compact |
| 27 | ? "size-11 shrink-0 items-center justify-center rounded-full active:bg-subtle" |
| 28 | : "h-11 shrink-0 flex-row items-center justify-center gap-2 rounded-full px-4 active:bg-subtle" |
| 29 | } |
| 30 | > |
| 31 | <SymbolView name="globe" size={20} tintColorClassName="accent-icon" type="monochrome" /> |
| 32 | {!compact ? ( |
| 33 | <AppText className="font-t3-medium text-xs text-foreground"> |
| 34 | <T> |
| 35 | <Plural |
| 36 | n={props.count} |
| 37 | singular="One tab open" |
| 38 | other={ |
| 39 | <> |
| 40 | <Var>{props.count}</Var> tabs open |
| 41 | </> |
| 42 | } |
| 43 | /> |
| 44 | </T> |
| 45 | </AppText> |
| 46 | ) : props.count > 1 ? ( |
| 47 | <View className="absolute right-1.5 top-1.5 min-w-4 items-center rounded-full bg-primary px-1"> |
| 48 | <AppText className="text-2xs font-t3-bold text-primary-foreground">{props.count}</AppText> |
| 49 | </View> |
| 50 | ) : null} |
| 51 | </Pressable> |
| 52 | ); |
| 53 | } |