refactor(mobile): remaining className platform ternaries become class variants (#13188)

Co-authored-by: julusy <[email protected]>
This commit is contained in:
Julius Marmingeandjulusy authored and GitHub committed 2026-09-22 19:35:56 -07:00
1 parent 21be723add
commit db898a3062
9 files changed
+18 -44

No files matched your search

@@ -264,7 +264,7 @@ export function ConnectionsNewRouteScreen({
{pairingConnectionError ? <ErrorBanner message={pairingConnectionError} /> : null}
<View className={Platform.OS === "android" ? "flex-row justify-end" : undefined}>
<View className="android:flex-row android:justify-end">
<ConnectionSheetButton
icon="plus"
label={isSubmitting ? "Pairing..." : "Add environment"}
@@ -147,7 +147,7 @@ export function ThreadFileNavigatorPane(props: {
}
>
<View
className={Platform.OS === "android" ? "bg-header" : "border-b border-border"}
className="ios:border-b ios:border-border android:bg-header"
style={{ paddingTop: Platform.OS === "android" ? 0 : props.headerInset }}
>
{Platform.OS === "android" ? (
+3 -3
View File
@@ -1106,7 +1106,7 @@ export function HomeScreen(props: HomeScreenProps) {
if (!hasAnyThreads) {
return (
<View className={Platform.OS === "android" ? "flex-1 bg-header" : "flex-1 bg-screen"}>
<View className="flex-1 bg-screen android:bg-header">
<View
className={cn(
"flex-1 items-center justify-center bg-screen px-8",
@@ -1217,7 +1217,7 @@ export function HomeScreen(props: HomeScreenProps) {
if (threadListV2Enabled) {
return (
<View className={Platform.OS === "android" ? "flex-1 bg-header" : "flex-1 bg-screen"}>
<View className="flex-1 bg-screen android:bg-header">
<View
className={
Platform.OS === "android"
@@ -1263,7 +1263,7 @@ export function HomeScreen(props: HomeScreenProps) {
}
return (
<View className={Platform.OS === "android" ? "flex-1 bg-header" : "flex-1 bg-screen"}>
<View className="flex-1 bg-screen android:bg-header">
<View
className={
Platform.OS === "android"
@@ -735,7 +735,7 @@ export function ReviewSheet(props: ReviewSheetProps) {
/>
<MaterialScreenContent>
<View className={Platform.OS === "android" ? "flex-1 bg-sheet-solid" : "flex-1 bg-sheet"}>
<View className="flex-1 bg-sheet android:bg-sheet-solid">
{showConnectionNotice ? (
<View className="flex-1" style={{ paddingTop: topContentInset }}>
<EnvironmentConnectionNotice
@@ -3,13 +3,12 @@ import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollVie
import { useAtomSet, useAtomValue } from "@effect/atom-react";
import { AsyncResult } from "effect/unstable/reactivity";
import { useRef, useState } from "react";
import { Platform, Pressable, View } from "react-native";
import { Pressable, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { DEFAULT_SERVER_SETTINGS } from "@t3tools/contracts";
import { supportsSharedSettingsSync } from "@t3tools/client-runtime/state/shared-settings";
import { AppText as Text } from "../../components/AppText";
import { cn } from "../../lib/cn";
import { mobilePreferencesAtom, updateMobilePreferencesAtom } from "../../state/preferences";
import { serverEnvironment } from "../../state/server";
import { useAtomCommand } from "../../state/use-atom-command";
@@ -182,21 +181,9 @@ function AutoSettleSettingsRows() {
}
/>
{afterDays !== null ? (
<View
className={cn(
"flex-row items-center gap-4 px-4",
Platform.OS === "android" ? "min-h-14 py-3" : "py-4",
)}
>
<View style={{ width: Platform.OS === "android" ? 24 : 22 }} />
<Text
className={cn(
"flex-1 text-foreground",
Platform.OS === "android" ? "text-base" : "text-lg",
)}
>
Inactive days
</Text>
<View className="flex-row items-center gap-4 px-4 py-4 android:min-h-14 android:py-3">
<View className="w-[22px] android:w-6" />
<Text className="flex-1 text-foreground text-lg android:text-base">Inactive days</Text>
<AutoSettleDaysField
value={afterDays}
disabled={disabled}
@@ -402,7 +402,7 @@ export function NewTaskBranchPickerRouteScreen() {
const branchContent =
flow.filteredBranches.length === 0 ? (
<ScrollView
className={Platform.OS === "android" ? "flex-1 bg-sheet-solid" : "flex-1 bg-sheet"}
className="flex-1 bg-sheet android:bg-sheet-solid"
contentInsetAdjustmentBehavior="automatic"
contentContainerStyle={{ flexGrow: 1, paddingHorizontal: 16, paddingTop: 16 }}
scrollEnabled={false}
@@ -443,7 +443,7 @@ export function NewTaskBranchPickerRouteScreen() {
alwaysBounceVertical={false}
automaticallyAdjustsScrollIndicatorInsets
automaticallyAdjustKeyboardInsets={Platform.OS === "ios"}
className={Platform.OS === "android" ? "flex-1 bg-sheet-solid" : "flex-1 bg-sheet"}
className="flex-1 bg-sheet android:bg-sheet-solid"
contentInsetAdjustmentBehavior="automatic"
contentContainerStyle={branchListContentStyle}
data={flow.filteredBranches}
@@ -947,18 +947,7 @@ function ThreadRouteContent(
<>
<GitActionProgressOverlay progress={gitActionProgress} onDismiss={dismissGitActionResult} />
<View
className={Platform.OS === "android" ? "flex-1 bg-thread-canvas" : "flex-1 bg-screen"}
style={
Platform.OS === "android"
? {
borderTopLeftRadius: 28,
borderTopRightRadius: 28,
overflow: "hidden",
}
: undefined
}
>
<View className="flex-1 bg-screen android:overflow-hidden android:rounded-t-[28px] android:bg-thread-canvas">
<ThreadDetailScreen
selectedThread={selectedThreadWithDraftSettings ?? selectedThread}
contentPresentation={contentPresentation}
@@ -158,9 +158,8 @@ function ProviderHeader(props: {
accessibilityLabel={`${props.label}, ${props.modelCount} models`}
accessibilityRole="button"
accessibilityState={{ expanded: !props.collapsed }}
className="mx-4 mt-1 min-h-11 flex-row items-center gap-2 rounded-xl px-1 pt-2 active:opacity-60"
className="mx-4 mt-1 min-h-11 flex-row items-center gap-2 rounded-xl px-1 pt-2 active:opacity-60 android:min-h-12"
onPress={props.onToggle}
style={Platform.OS === "android" ? { minHeight: 48 } : undefined}
>
{content}
</Pressable>
@@ -185,9 +184,8 @@ function DisclosureRow(props: {
<Pressable
accessibilityRole="button"
onPress={props.onPress}
style={Platform.OS === "android" ? { minHeight: 56 } : undefined}
className={cn(
"min-h-11 flex-row items-center gap-2 bg-card px-4 py-2 active:bg-subtle",
"min-h-11 flex-row items-center gap-2 bg-card px-4 py-2 active:bg-subtle android:min-h-14",
!props.isLast && "border-b border-border-subtle",
)}
>
@@ -267,20 +267,20 @@ export function UsageRouteScreen() {
<>
{/* Period and metric together: neither applies to Limits, and
both change every number below, so they share one bar. */}
<View className={cn("gap-3", Platform.OS !== "android" && "flex-row items-center")}>
<View className="gap-3 ios:flex-row ios:items-center">
<SegmentedControl
options={WINDOW_OPTIONS}
selected={windowDays}
onSelect={selectWindow}
size="compact"
className={Platform.OS === "android" ? "w-full" : "flex-1"}
className="w-full ios:flex-1"
/>
<SegmentedControl
options={METRIC_OPTIONS}
selected={metric}
onSelect={setMetric}
size="compact"
className={Platform.OS === "android" ? "w-full" : "w-36"}
className="w-full ios:w-36"
/>
</View>
{merged.duplicateSources.length > 0 ? (