TypeScript
revert(mobile): git sheets back to Platform.OS ternaries (un-guarded uniwind variants broke both platforms) (#13169)
Julius Marminge6dcde218ad6c
diff --git a/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx b/apps/mobile/src/features/threads/git/GitBranchesSheet.tsxindex d16b72d13d8..7ca5085965f 100644--- a/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx+++ b/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx@@ -63,7 +63,7 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {return (<Viewcollapsable={false}- className="bg-sheet ios:flex-1"+ className={Platform.OS === "android" ? "bg-sheet" : "flex-1 bg-sheet"}style={Platform.OS === "android" ? { maxHeight: windowHeight * 0.92 } : undefined}>{Platform.OS === "android" ? (@@ -83,19 +83,31 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {) : null}<MaterialScreenContent fitToContents><ScrollView- className="android:shrink android:grow-0 ios:flex-1"+ className={Platform.OS === "android" ? "shrink grow-0" : "flex-1"}keyboardShouldPersistTaps="handled"showsVerticalScrollIndicator={false}contentInset={{ bottom: Math.max(insets.bottom, 18) + 18 }}- contentContainerClassName="android:gap-2 android:p-2 ios:gap-4 ios:px-5 ios:pt-2"+ contentContainerClassName={Platform.OS === "android" ? "gap-2 p-2" : "gap-4 px-5 pt-2"}contentContainerStyle={Platform.OS === "android"? { paddingBottom: Math.max(insets.bottom, 18) + 18 }: undefined}>- <View className="bg-card android:gap-3 android:rounded-[20px] android:p-4 ios:gap-2 ios:rounded-[18px] ios:border ios:border-border ios:px-4 ios:py-4">- <Text className="android:text-foreground android:text-base android:font-t3-medium ios:text-foreground-secondary ios:text-2xs ios:font-t3-bold ios:tracking-[1px] ios:uppercase">+ <View+ className={+ Platform.OS === "android"+ ? "gap-3 rounded-[20px] bg-card p-4"+ : "gap-2 rounded-[18px] border border-border bg-card px-4 py-4"+ }+ >+ <Text+ className={+ Platform.OS === "android"+ ? "text-foreground text-base font-t3-medium"+ : "text-foreground-secondary text-2xs font-t3-bold tracking-[1px] uppercase"+ }+ >New branch</Text><TextInput@@ -103,7 +115,7 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {onChangeText={setNewBranchName}placeholder="feature/mobile-polish"accessibilityLabel="New branch name"- className="android:rounded-xl android:bg-sheet-solid ios:rounded-[18px]"+ className={Platform.OS === "android" ? "rounded-xl bg-sheet-solid" : "rounded-[18px]"}/><SheetActionButtonicon="plus"@@ -121,8 +133,20 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {/></View>- <View className="bg-card android:gap-3 android:rounded-[20px] android:p-4 ios:gap-2 ios:rounded-[18px] ios:border ios:border-border ios:px-4 ios:py-4">- <Text className="android:text-foreground android:text-base android:font-t3-medium ios:text-foreground-secondary ios:text-2xs ios:font-t3-bold ios:tracking-[1px] ios:uppercase">+ <View+ className={+ Platform.OS === "android"+ ? "gap-3 rounded-[20px] bg-card p-4"+ : "gap-2 rounded-[18px] border border-border bg-card px-4 py-4"+ }+ >+ <Text+ className={+ Platform.OS === "android"+ ? "text-foreground text-base font-t3-medium"+ : "text-foreground-secondary text-2xs font-t3-bold tracking-[1px] uppercase"+ }+ >New worktree</Text>{Platform.OS === "android" ? (@@ -133,7 +157,7 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {onChangeText={setWorktreeBaseBranch}placeholder="main"accessibilityLabel="Worktree base branch"- className="android:rounded-xl android:bg-sheet-solid ios:rounded-[18px]"+ className={Platform.OS === "android" ? "rounded-xl bg-sheet-solid" : "rounded-[18px]"}/>{Platform.OS === "android" ? (<Text className="text-foreground-secondary text-sm">New branch</Text>@@ -143,7 +167,7 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {onChangeText={setWorktreeBranchName}placeholder="feature/mobile-thread"accessibilityLabel="Worktree branch name"- className="android:rounded-xl android:bg-sheet-solid ios:rounded-[18px]"+ className={Platform.OS === "android" ? "rounded-xl bg-sheet-solid" : "rounded-[18px]"}/><SheetActionButtonicon="square.split.2x1"@@ -169,16 +193,32 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {</View><View className="gap-2">- <Text className="text-foreground-secondary android:px-4 android:pb-1 android:pt-3 android:text-sm android:font-t3-medium ios:text-2xs ios:font-t3-bold ios:tracking-[1px] ios:uppercase">+ <Text+ className={+ Platform.OS === "android"+ ? "px-4 pb-1 pt-3 text-foreground-secondary text-sm font-t3-medium"+ : "text-foreground-secondary text-2xs font-t3-bold tracking-[1px] uppercase"+ }+ >Existing branches</Text>{branchesLoading ? (- <Text className="text-foreground-secondary text-sm font-medium android:px-4">+ <Text+ className={cn(+ "text-foreground-secondary text-sm font-medium",+ Platform.OS === "android" && "px-4",+ )}+ >Loading branches...</Text>) : null}{!branchesLoading && availableBranches.length === 0 ? (- <Text className="text-foreground-secondary text-sm font-medium android:px-4">+ <Text+ className={cn(+ "text-foreground-secondary text-sm font-medium",+ Platform.OS === "android" && "px-4",+ )}+ >No local branches found.</Text>) : null}@@ -196,10 +236,16 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {<Pressablekey={branch.name}className={cn(- "gap-1 px-4 py-3 disabled:opacity-[0.45] android:rounded-[20px] android:active:bg-subtle ios:rounded-[18px] ios:border",- branch.current- ? "android:bg-secondary ios:border-subtle-strong"- : "android:bg-card ios:border-border",+ "gap-1 px-4 py-3 disabled:opacity-[0.45]",+ Platform.OS === "android"+ ? cn(+ "rounded-[20px] active:bg-subtle",+ branch.current ? "bg-secondary" : "bg-card",+ )+ : cn(+ "rounded-[18px] border",+ branch.current ? "border-subtle-strong" : "border-border",+ ),)}accessibilityRole="button"accessibilityState={{ selected: branch.current, disabled: busy || disabled }}@@ -213,7 +259,12 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {{Platform.OS !== "android" ? (<View className="absolute inset-0 rounded-[18px] bg-card" />) : null}- <Text className="text-foreground text-base android:font-t3-medium ios:font-t3-bold">+ <Text+ className={cn(+ "text-foreground text-base",+ Platform.OS === "android" ? "font-t3-medium" : "font-t3-bold",+ )}+ >{branch.name}</Text><Text className="text-foreground-secondary text-xs font-medium">{subtitle}</Text>diff --git a/apps/mobile/src/features/threads/git/GitCommitSheet.tsx b/apps/mobile/src/features/threads/git/GitCommitSheet.tsxindex 19d77a327de..7f70a39d937 100644--- a/apps/mobile/src/features/threads/git/GitCommitSheet.tsx+++ b/apps/mobile/src/features/threads/git/GitCommitSheet.tsx@@ -72,7 +72,7 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {return (<Viewcollapsable={false}- className="bg-sheet ios:flex-1"+ className={Platform.OS === "android" ? "bg-sheet" : "flex-1 bg-sheet"}style={Platform.OS === "android" ? { maxHeight: windowHeight * 0.92 } : undefined}>{Platform.OS === "android" ? (@@ -92,21 +92,35 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {) : null}<MaterialScreenContent fitToContents><ScrollView- className="android:shrink android:grow-0 ios:flex-1"+ className={Platform.OS === "android" ? "shrink grow-0" : "flex-1"}keyboardShouldPersistTaps="handled"showsVerticalScrollIndicator={false}contentInset={{ bottom: Math.max(insets.bottom, 18) + 18 }}- contentContainerClassName="android:gap-2 android:p-2 ios:gap-4 ios:px-5 ios:pt-2"+ contentContainerClassName={Platform.OS === "android" ? "gap-2 p-2" : "gap-4 px-5 pt-2"}contentContainerStyle={Platform.OS === "android"? { paddingBottom: Math.max(insets.bottom, 18) + 18 }: undefined}>- <View className="gap-3 bg-card p-4 android:rounded-[20px] ios:rounded-[22px] ios:border ios:border-border">- <View className="android:gap-1 ios:flex-row ios:items-center ios:justify-between ios:gap-3">+ <View+ className={cn(+ "gap-3 bg-card p-4",+ Platform.OS === "android" ? "rounded-[20px]" : "rounded-[22px] border border-border",+ )}+ >+ <View+ className={+ Platform.OS === "android" ? "gap-1" : "flex-row items-center justify-between gap-3"+ }+ ><Text className="text-foreground-muted text-sm font-medium">Branch</Text>- <Text className="text-foreground text-base android:font-t3-medium ios:font-t3-bold">+ <Text+ className={cn(+ "text-foreground text-base",+ Platform.OS === "android" ? "font-t3-medium" : "font-t3-bold",+ )}+ >{gitStatus.data?.refName ?? "(detached HEAD)"}</Text></View>@@ -117,10 +131,20 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {) : null}</View>- <View className="gap-3 bg-card p-4 android:rounded-[20px] ios:rounded-[22px] ios:border ios:border-border">+ <View+ className={cn(+ "gap-3 bg-card p-4",+ Platform.OS === "android" ? "rounded-[20px]" : "rounded-[22px] border border-border",+ )}+ ><View className="flex-row items-center justify-between gap-3"><View className="gap-1">- <Text className="text-foreground text-base android:font-t3-medium ios:font-t3-bold">+ <Text+ className={cn(+ "text-foreground text-base",+ Platform.OS === "android" ? "font-t3-medium" : "font-t3-bold",+ )}+ >Files</Text><Text className="text-foreground-muted text-xs leading-normal">@@ -130,19 +154,39 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {<View className="flex-row items-center gap-2">{!allSelected && isEditingFiles ? (<Pressable- className="rounded-full px-3 android:min-h-12 android:justify-center android:active:bg-subtle ios:bg-subtle ios:py-2"+ className={+ Platform.OS === "android"+ ? "min-h-12 justify-center rounded-full px-3 active:bg-subtle"+ : "bg-subtle rounded-full px-3 py-2"+ }onPress={() => setExcludedFiles(new Set())}>- <Text className="android:text-primary-text android:text-sm android:font-t3-medium ios:text-foreground ios:text-2xs ios:font-t3-bold ios:uppercase">+ <Text+ className={+ Platform.OS === "android"+ ? "text-primary-text text-sm font-t3-medium"+ : "text-foreground text-2xs font-t3-bold uppercase"+ }+ >Reset</Text></Pressable>) : null}<Pressable- className="rounded-full px-3 android:min-h-12 android:justify-center android:active:bg-subtle ios:bg-subtle ios:py-2"+ className={+ Platform.OS === "android"+ ? "min-h-12 justify-center rounded-full px-3 active:bg-subtle"+ : "bg-subtle rounded-full px-3 py-2"+ }onPress={() => setIsEditingFiles((current) => !current)}>- <Text className="android:text-primary-text android:text-sm android:font-t3-medium ios:text-foreground ios:text-2xs ios:font-t3-bold ios:uppercase">+ <Text+ className={+ Platform.OS === "android"+ ? "text-primary-text text-sm font-t3-medium"+ : "text-foreground text-2xs font-t3-bold uppercase"+ }+ >{isEditingFiles ? "Done" : "Edit"}</Text></Pressable>@@ -182,10 +226,15 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {<Pressablekey={file.path}className={cn(- "px-4 py-3 android:rounded-xl ios:rounded-[18px] ios:border",- included- ? "android:bg-subtle ios:border-border"- : "ios:border-border-subtle",+ "px-4 py-3",+ Platform.OS === "android"+ ? included+ ? "rounded-xl bg-subtle"+ : "rounded-xl"+ : cn(+ "rounded-[18px] border",+ included ? "border-border" : "border-border-subtle",+ ),)}accessibilityRole="checkbox"accessibilityLabel={file.path}@@ -254,8 +303,16 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {)}</View>- <View className="android:gap-3 android:rounded-[20px] android:bg-card android:p-4 ios:gap-2">- <Text className="text-foreground android:text-base android:font-t3-medium ios:text-sm ios:font-t3-bold">+ <View+ className={Platform.OS === "android" ? "gap-3 rounded-[20px] bg-card p-4" : "gap-2"}+ >+ <Text+ className={+ Platform.OS === "android"+ ? "text-foreground text-base font-t3-medium"+ : "text-foreground text-sm font-t3-bold"+ }+ >Commit message</Text><TextInput@@ -265,12 +322,15 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {onChangeText={setDialogCommitMessage}placeholder="Leave empty to auto-generate"textAlignVertical="top"- className="min-h-[128px] px-4 py-3.5 android:rounded-xl android:bg-sheet-solid ios:rounded-[20px]"+ className={cn(+ "min-h-[128px] px-4 py-3.5",+ Platform.OS === "android" ? "rounded-xl bg-sheet-solid" : "rounded-[20px]",+ )}/></View>- <View className="android:gap-2 ios:flex-row ios:gap-3">- <View className="ios:flex-1">+ <View className={Platform.OS === "android" ? "gap-2" : "flex-row gap-3"}>+ <View className={Platform.OS === "android" ? undefined : "flex-1"}><SheetActionButtonicon="arrow.branch"label="Commit on new branch"@@ -278,7 +338,7 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {onPress={() => void runCommitAction(true)}/></View>- <View className="ios:flex-1">+ <View className={Platform.OS === "android" ? undefined : "flex-1"}><SheetActionButtonicon="checkmark.circle"label="Commit"diff --git a/apps/mobile/src/features/threads/git/GitConfirmSheet.tsx b/apps/mobile/src/features/threads/git/GitConfirmSheet.tsxindex 06cce85791f..bc5e88f3fd6 100644--- a/apps/mobile/src/features/threads/git/GitConfirmSheet.tsx+++ b/apps/mobile/src/features/threads/git/GitConfirmSheet.tsx@@ -107,7 +107,7 @@ export function GitConfirmSheet(props: GitConfirmSheetProps) {return (<Viewcollapsable={false}- className="bg-sheet ios:flex-1"+ className={Platform.OS === "android" ? "bg-sheet" : "flex-1 bg-sheet"}style={Platform.OS === "android" ? { maxHeight: windowHeight * 0.92 } : undefined}>{Platform.OS === "android" ? (@@ -130,31 +130,49 @@ export function GitConfirmSheet(props: GitConfirmSheetProps) {<MaterialScreenContent fitToContents><ScrollView- className="android:shrink android:grow-0 ios:flex-1"+ className={Platform.OS === "android" ? "shrink grow-0" : "flex-1"}showsVerticalScrollIndicator={false}- contentContainerClassName="android:gap-2 android:p-2"+ contentContainerClassName={Platform.OS === "android" ? "gap-2 p-2" : undefined}contentContainerStyle={Platform.OS === "android"? { paddingBottom: Math.max(insets.bottom, 18) + 8 }: undefined}>- <View className="android:gap-2 android:rounded-[20px] android:bg-card android:p-3 ios:items-center ios:gap-1 ios:px-5 ios:pb-3 ios:pt-4">+ <View+ className={+ Platform.OS === "android"+ ? "gap-2 rounded-[20px] bg-card p-3"+ : "items-center gap-1 px-5 pb-3 pt-4"+ }+ >{Platform.OS !== "android" ? (<Text className="text-xs font-t3-bold tracking-[1px] uppercase text-foreground-muted">Confirm</Text>) : null}- <Text className="android:text-xl android:font-t3-medium ios:text-center ios:text-3xl ios:font-t3-bold">+ <Text+ className={+ Platform.OS === "android"+ ? "text-xl font-t3-medium"+ : "text-center text-3xl font-t3-bold"+ }+ >{copy?.title ?? "Run action on default branch?"}</Text>- <Text className="text-foreground-secondary leading-normal android:text-base ios:text-center ios:text-sm ios:font-medium">+ <Text+ className={+ Platform.OS === "android"+ ? "text-foreground-secondary text-base leading-normal"+ : "text-center text-foreground-secondary text-sm font-medium leading-normal"+ }+ >{copy?.description ?? "Choose how to continue."}</Text></View><View- className="android:gap-2 ios:gap-3 ios:px-5 ios:pt-2"+ className={Platform.OS === "android" ? "gap-2" : "gap-3 px-5 pt-2"}style={Platform.OS === "android"? undefineddiff --git a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsxindex 831ef1145ce..7293173ecee 100644--- a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx+++ b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx@@ -234,7 +234,7 @@ export function GitOverviewSheet(props: GitOverviewSheetProps) {const content = (<ScrollViewalwaysBounceVertical- className="flex-1 android:bg-sheet-solid ios:bg-screen"+ className={Platform.OS === "android" ? "flex-1 bg-sheet-solid" : "flex-1 bg-screen"}contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}showsVerticalScrollIndicator={false}contentInset={{ bottom: Math.max(insets.bottom, 18) + 18 }}@@ -248,9 +248,13 @@ export function GitOverviewSheet(props: GitOverviewSheetProps) {}><View- className={`overflow-hidden bg-card android:rounded-[20px] ios:border ios:border-border ${- isInspector ? "ios:rounded-2xl ios:px-3 ios:py-1" : "ios:rounded-[22px] ios:px-4 ios:py-1"- }`}+ className={+ Platform.OS === "android"+ ? "overflow-hidden rounded-[20px] bg-card"+ : isInspector+ ? "overflow-hidden rounded-2xl border border-border bg-card px-3 py-1"+ : "overflow-hidden rounded-[22px] border border-border bg-card px-4 py-1"+ }>{sheetMenuItems.map(({ item, disabledReason }, index) => (<View key={`${item.id}-${item.label}`}>@@ -316,7 +320,11 @@ export function GitOverviewSheet(props: GitOverviewSheetProps) {{linkedPrChains.map((chain) => (<Viewkey={threadPullRequestKeyOf(chain.layers[0]!)}- className="overflow-hidden bg-card android:rounded-[20px] ios:rounded-2xl ios:border ios:border-border ios:px-3 ios:py-1"+ className={+ Platform.OS === "android"+ ? "overflow-hidden rounded-[20px] bg-card"+ : "overflow-hidden rounded-2xl border border-border bg-card px-3 py-1"+ }>{chain.layers.length > 1 ? (<View className="flex-row items-center gap-2 px-1 pt-2 pb-1">@@ -475,7 +483,13 @@ export function GitOverviewSheet(props: GitOverviewSheetProps) {) : null}{isInspector ? (- <View className="gap-1 px-4 pb-4 pt-3 android:bg-header ios:border-b ios:border-border">+ <View+ className={+ Platform.OS === "android"+ ? "gap-1 bg-header px-4 pb-4 pt-3"+ : "gap-1 border-b border-border px-4 pb-4 pt-3"+ }+ >{Platform.OS === "android" ? (<View className="absolute right-3 top-4 z-[1]">{refreshMenu}</View>) : (diff --git a/apps/mobile/src/features/threads/git/gitSheetComponents.tsx b/apps/mobile/src/features/threads/git/gitSheetComponents.tsxindex c358466e22d..daf494cb79c 100644--- a/apps/mobile/src/features/threads/git/gitSheetComponents.tsx+++ b/apps/mobile/src/features/threads/git/gitSheetComponents.tsx@@ -71,7 +71,13 @@ export function SheetActionButton(props: {export function MetaCard(props: { readonly label: string; readonly value: string }) {return (- <View className="bg-card px-4 py-3 android:rounded-[20px] ios:rounded-[18px] ios:border ios:border-border">+ <View+ className={+ Platform.OS === "android"+ ? "rounded-[20px] bg-card px-4 py-3"+ : "rounded-[18px] border border-border bg-card px-4 py-3"+ }+ ><Text className="text-foreground-muted text-2xs font-t3-bold tracking-[0.9px] uppercase">{props.label}</Text>@@ -91,11 +97,21 @@ export function SheetListRow(props: {}) {return (<Pressable- className="flex-row items-center py-3 disabled:opacity-[0.45] android:min-h-16 android:gap-4 android:px-4 android:active:bg-subtle ios:gap-3 ios:px-1"+ className={+ Platform.OS === "android"+ ? "min-h-16 flex-row items-center gap-4 px-4 py-3 active:bg-subtle disabled:opacity-[0.45]"+ : "flex-row items-center gap-3 px-1 py-3 disabled:opacity-[0.45]"+ }disabled={props.disabled}onPress={props.onPress}>- <View className="items-center justify-center android:size-6 ios:bg-subtle ios:h-9 ios:w-9 ios:rounded-full">+ <View+ className={+ Platform.OS === "android"+ ? "size-6 items-center justify-center"+ : "bg-subtle h-9 w-9 items-center justify-center rounded-full"+ }+ ><SymbolViewname={props.icon}size={Platform.OS === "android" ? 24 : 16}@@ -104,7 +120,13 @@ export function SheetListRow(props: {/></View><View className="flex-1 gap-0.5">- <Text className="text-foreground text-base android:font-t3-medium ios:font-t3-bold">+ <Text+ className={+ Platform.OS === "android"+ ? "text-foreground text-base font-t3-medium"+ : "text-foreground text-base font-t3-bold"+ }+ >{props.title}</Text>{props.subtitle ? (