@devries-cameron20 / t3code Mirror · read-only / commits / 60d377380c
Fork 0

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 23, 00:30 UTC

refactor(mobile): unify sheet header actions (#21978)

Julius Marminge committed Oct 19, 2026 at 15:55 UTC 60d377380ce65f5375bb4f1392899e978bc7fe1a
14 files changed +346 -167
apps/mobile/src/components/ui/SheetHeader.android.tsx new
+54
@@ -0,0 +1,54 @@
1 +import { View } from "react-native";
2 +
3 +import { AndroidScreenHeader } from "./AndroidScreenHeader";
4 +import { Button } from "./Button";
5 +import { IconButton } from "./IconButton";
6 +import type { SheetCloseButtonProps, SheetHeaderProps } from "./SheetHeader.types";
7 +
8 +export function SheetCloseButton(props: SheetCloseButtonProps) {
9 + return (
10 + <IconButton
11 + icon="xmark"
12 + accessibilityLabel={props.accessibilityLabel ?? (props.onCancel ? "Cancel" : "Close")}
13 + disabled={props.disabled}
14 + tintColorClassName="accent-header-foreground"
15 + onPress={props.onCancel ?? props.onClose}
16 + />
17 + );
18 +}
19 +
20 +export function SheetHeader(props: SheetHeaderProps) {
21 + const confirmation = props.confirm;
22 + const trailing =
23 + props.trailing || confirmation ? (
24 + <View className="flex-row items-center gap-2">
25 + {props.trailing}
26 + {confirmation ? (
27 + <Button
28 + label={confirmation.label}
29 + tone="text"
30 + loading={confirmation.loading}
31 + disabled={confirmation.disabled}
32 + onPress={confirmation.onPress}
33 + />
34 + ) : null}
35 + </View>
36 + ) : undefined;
37 +
38 + return (
39 + <AndroidScreenHeader
40 + embedded={props.presentation === "inline"}
41 + title={props.title}
42 + subtitle={props.subtitle}
43 + leading={
44 + <SheetCloseButton
45 + {...(props.onCancel ? { onCancel: props.onCancel } : { onClose: props.onClose })}
46 + accessibilityLabel={props.accessibilityLabel}
47 + disabled={props.dismissDisabled}
48 + />
49 + }
50 + trailing={trailing}
51 + hideBottomBorder
52 + />
53 + );
54 +}
apps/mobile/src/components/ui/SheetHeader.tsx new
+164
@@ -0,0 +1,164 @@
1 +import { Pressable, View } from "react-native";
2 +
3 +import { NativeStackScreenOptions } from "../../native/StackHeader";
4 +import { AppActivityIndicator } from "./AppActivityIndicator";
5 +import { AppText } from "./AppText";
6 +import { SymbolView } from "./AppSymbol";
7 +import { IconButton } from "./IconButton";
8 +import { Toolbar } from "./Toolbar";
9 +import { useControlTheme } from "./useControlTheme";
10 +import type { SheetCloseButtonProps, SheetHeaderProps } from "./SheetHeader.types";
11 +
12 +export function SheetCloseButton(props: SheetCloseButtonProps) {
13 + return (
14 + <IconButton
15 + icon="xmark"
16 + accessibilityLabel={props.accessibilityLabel ?? (props.onCancel ? "Cancel" : "Close")}
17 + disabled={props.disabled}
18 + onPress={props.onCancel ?? props.onClose}
19 + />
20 + );
21 +}
22 +
23 +export function SheetHeader(props: SheetHeaderProps) {
24 + return props.presentation !== "inline" ? (
25 + <NativeSheetHeader {...props} />
26 + ) : (
27 + <InlineSheetHeader {...props} />
28 + );
29 +}
30 +
31 +function NativeSheetHeader(props: SheetHeaderProps) {
32 + const { colors } = useControlTheme();
33 + const onDismiss = props.onCancel ?? props.onClose;
34 + const dismissLabel = props.accessibilityLabel ?? (props.onCancel ? "Cancel" : "Close");
35 + const confirmation = props.confirm;
36 +
37 + // Toolbar children are parsed as native items, so keep the actual Button
38 + // elements here instead of hiding them behind another component.
39 + return (
40 + <>
41 + <NativeStackScreenOptions
42 + options={{
43 + title: props.title,
44 + headerBackVisible: false,
45 + unstable_headerSubtitle: props.subtitle,
46 + }}
47 + />
48 + <Toolbar placement="left">
49 + <Toolbar.Button
50 + icon="xmark"
51 + accessibilityLabel={dismissLabel}
52 + onPress={onDismiss}
53 + disabled={props.dismissDisabled}
54 + />
55 + </Toolbar>
56 + {confirmation || props.trailing ? (
57 + <Toolbar placement="right">
58 + {props.trailing ? (
59 + <Toolbar.Custom>
60 + <View>{props.trailing}</View>
61 + </Toolbar.Custom>
62 + ) : null}
63 + {confirmation?.loading ? (
64 + <Toolbar.Custom>
65 + <View
66 + className="size-11 items-center justify-center"
67 + accessible
68 + accessibilityLabel={confirmation.label}
69 + accessibilityState={{ busy: true }}
70 + >
71 + <AppActivityIndicator colorClassName="accent-prominent-action" />
72 + </View>
73 + </Toolbar.Custom>
74 + ) : confirmation ? (
75 + <Toolbar.Button
76 + icon="checkmark"
77 + variant="prominent"
78 + tintColor={colors["--color-prominent-action"]}
79 + accessibilityLabel={confirmation.label}
80 + disabled={confirmation.disabled}
81 + onPress={confirmation.onPress}
82 + />
83 + ) : null}
84 + </Toolbar>
85 + ) : null}
86 + </>
87 + );
88 +}
89 +
90 +function InlineConfirmation({
91 + confirmation,
92 +}: {
93 + readonly confirmation: NonNullable<SheetHeaderProps["confirm"]>;
94 +}) {
95 + const confirmDisabled = confirmation.disabled || confirmation.loading;
96 + return (
97 + <Pressable
98 + accessibilityRole="button"
99 + accessibilityLabel={confirmation.label}
100 + accessibilityState={{
101 + disabled: Boolean(confirmDisabled),
102 + busy: Boolean(confirmation.loading),
103 + }}
104 + disabled={confirmDisabled}
105 + onPress={confirmation.onPress}
106 + className={
107 + confirmDisabled
108 + ? "size-11 items-center justify-center rounded-full bg-subtle-strong"
109 + : "size-11 items-center justify-center rounded-full bg-prominent-action"
110 + }
111 + >
112 + {confirmation.loading ? (
113 + <AppActivityIndicator colorClassName="accent-icon-subtle" />
114 + ) : (
115 + <SymbolView
116 + name="checkmark"
117 + size={20}
118 + tintColorClassName={
119 + confirmDisabled ? "accent-icon-subtle" : "accent-prominent-action-foreground"
120 + }
121 + />
122 + )}
123 + </Pressable>
124 + );
125 +}
126 +
127 +function InlineSheetHeader(props: SheetHeaderProps) {
128 + const close = (
129 + <SheetCloseButton
130 + {...(props.onCancel ? { onCancel: props.onCancel } : { onClose: props.onClose })}
131 + accessibilityLabel={props.accessibilityLabel}
132 + disabled={props.dismissDisabled}
133 + />
134 + );
135 + const confirm = props.confirm ? <InlineConfirmation confirmation={props.confirm} /> : null;
136 + const trailing =
137 + props.trailing || confirm ? (
138 + <View className="flex-row items-center gap-2">
139 + {props.trailing}
140 + {confirm}
141 + </View>
142 + ) : undefined;
143 +
144 + return (
145 + <View className="flex-row items-center gap-3 px-4 pt-3 pb-3">
146 + {close}
147 + <View className="min-w-0 flex-1 gap-1">
148 + <AppText numberOfLines={1} className="text-base font-t3-bold text-foreground">
149 + {props.title}
150 + </AppText>
151 + {props.subtitle ? (
152 + <AppText
153 + numberOfLines={1}
154 + ellipsizeMode="middle"
155 + className="text-xs text-foreground-muted"
156 + >
157 + {props.subtitle}
158 + </AppText>
159 + ) : null}
160 + </View>
161 + {trailing}
162 + </View>
163 + );
164 +}
apps/mobile/src/components/ui/SheetHeader.types.ts new
+27
@@ -0,0 +1,27 @@
1 +import type { ReactNode } from "react";
2 +
3 +type SheetDismissAction =
4 + | { readonly onCancel: () => void; readonly onClose?: never }
5 + | { readonly onClose: () => void; readonly onCancel?: never };
6 +
7 +type SheetConfirmation = {
8 + readonly label: string;
9 + readonly onPress: () => void;
10 + readonly disabled?: boolean;
11 + readonly loading?: boolean;
12 +};
13 +
14 +export type SheetHeaderProps = SheetDismissAction & {
15 + readonly title: string;
16 + readonly subtitle?: string;
17 + readonly accessibilityLabel?: string;
18 + readonly dismissDisabled?: boolean;
19 + readonly confirm?: SheetConfirmation;
20 + readonly presentation?: "native" | "inline";
21 + readonly trailing?: ReactNode;
22 +};
23 +
24 +export type SheetCloseButtonProps = SheetDismissAction & {
25 + readonly accessibilityLabel?: string;
26 + readonly disabled?: boolean;
27 +};
apps/mobile/src/features/browser/BrowserPreviewRouteScreen.tsx
+6 -9
@@ -1,4 +1,4 @@
1 -import { Toolbar } from "../../components/ui/Toolbar";
1 +import { SheetHeader } from "../../components/ui/SheetHeader";
2 import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
3 import * as Dialog from "../../components/ui/Dialog";
4 import { useIsFocused, useNavigation, type StaticScreenProps } from "@react-navigation/native";
@@ -159,14 +159,11 @@ function BrowserPreviewScreen({
159 }
160 />
161 {Platform.OS === "ios" ? (
162 - <Toolbar placement="left">
163 - <Toolbar.Button
164 - icon="xmark"
165 - accessibilityLabel="Close browser"
166 - onPress={onClose}
167 - separateBackground
168 - />
169 - </Toolbar>
162 + <SheetHeader
163 + title={tab ? browserTabTitle(tab) : "Browser"}
164 + onClose={onClose}
165 + accessibilityLabel="Close browser"
166 + />
167 ) : null}
168 {tab ? (
169 <>
apps/mobile/src/features/cloud/ConnectOnboardingRouteScreen.tsx
+28 -21
@@ -1,5 +1,7 @@
1 +import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
2 +import { SheetHeader } from "../../components/ui/SheetHeader";
3 +import { IconButton } from "../../components/ui/IconButton";
4 import { Button } from "../../components/ui/Button";
2 -import { Toolbar } from "../../components/ui/Toolbar";
5 import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
6
7 import { useAuth } from "@clerk/expo";
@@ -9,7 +11,6 @@ import { Platform, RefreshControl, View } from "react-native";
11 import { useSafeAreaInsets } from "react-native-safe-area-context";
12
13 import { reportAtomCommandResult, settlePromise } from "@t3tools/client-runtime/state/runtime";
12 -import { AndroidSheetHeader } from "../../components/ui/AndroidScreenHeader";
14 import { AppText as Text } from "../../components/ui/AppText";
15 import { useRemoteConnections } from "../../state/use-remote-environment-registry";
16 import { CloudEnvironmentRows } from "../connection/CloudEnvironmentRows";
@@ -73,25 +74,31 @@ function ConfiguredConnectOnboardingRouteScreen() {
74
75 return (
76 <View collapsable={false} className="flex-1 bg-sheet">
76 - {Platform.OS === "android" ? (
77 - <AndroidSheetHeader
78 - title="Set up T3 Connect"
79 - actions={[
80 - {
81 - accessibilityLabel: "Refresh environments",
82 - disabled: isRefreshing,
83 - icon: "arrow.clockwise",
84 - loading: isRefreshing,
85 - onPress: handleRefresh,
86 - },
87 - { accessibilityLabel: "Close", icon: "xmark", onPress: handleClose },
88 - ]}
89 - />
90 - ) : (
91 - <Toolbar placement="right">
92 - <Toolbar.Button icon="xmark" onPress={handleClose} separateBackground />
93 - </Toolbar>
94 - )}
77 + <SheetHeader
78 + presentation={Platform.OS === "android" ? "inline" : "native"}
79 + title="Set up T3 Connect"
80 + onClose={handleClose}
81 + trailing={
82 + Platform.OS === "android" ? (
83 + isRefreshing ? (
84 + <View
85 + className="size-12 items-center justify-center"
86 + accessible
87 + accessibilityLabel="Refreshing environments"
88 + accessibilityState={{ busy: true }}
89 + >
90 + <AppActivityIndicator />
91 + </View>
92 + ) : (
93 + <IconButton
94 + accessibilityLabel="Refresh environments"
95 + icon="arrow.clockwise"
96 + onPress={handleRefresh}
97 + />
98 + )
99 + ) : undefined
100 + }
101 + />
102 <ScrollView
103 nestedScrollEnabled
104 alwaysBounceVertical
apps/mobile/src/features/devices/DevicePreviewRouteScreen.tsx
+2 -5
@@ -1,3 +1,4 @@
1 +import { SheetCloseButton } from "../../components/ui/SheetHeader";
2 import { Button } from "../../components/ui/Button";
3 import * as Dialog from "../../components/ui/Dialog";
4 import {
@@ -296,11 +297,7 @@ function DevicePreviewScreen({
297 ) : null}
298 <View className="px-3" style={{ paddingTop: Math.max(insets.top, 12) }}>
299 <GlassSurface className="flex-row items-center gap-1 p-1">
299 - <ControlPill
300 - accessibilityLabel="Close device preview"
301 - icon="xmark"
302 - onPress={onClose}
303 - />
300 + <SheetCloseButton accessibilityLabel="Close device preview" onClose={onClose} />
301 <AppText numberOfLines={1} className="flex-1 text-center font-t3-medium text-base">
302 {preview?.name ?? "Devices"}
303 </AppText>
apps/mobile/src/features/pull-requests/PullRequestReviewersScreen.tsx
+7 -14
@@ -1,5 +1,5 @@
1 +import { SheetHeader } from "../../components/ui/SheetHeader";
2 import { AsyncResult } from "effect/reactivity";
2 -import { Toolbar } from "../../components/ui/Toolbar";
3 import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
4 import { usePullRequestConnected } from "./usePullRequestConnected";
5 import { useAtomValue } from "@effect/atom-react";
@@ -18,7 +18,6 @@ import {
18 import { useSafeAreaInsets } from "react-native-safe-area-context";
19 import { ScrollViewMarker } from "react-native-screens";
20 import { AppText as Text, AppTextInput as TextInput } from "../../components/ui/AppText";
21 -import { AndroidScreenHeader } from "../../components/ui/AndroidScreenHeader";
21 import { EmptyState } from "../../components/ui/EmptyState";
22 import { Button } from "../../components/ui/Button";
23 import { SymbolView } from "../../components/ui/AppSymbol";
@@ -140,17 +139,14 @@ export function PullRequestReviewersScreen({ route }: StaticScreenProps<PullRequ
139 };
140 return (
141 <View className="flex-1 bg-sheet">
143 - <Toolbar placement="left">
144 - <Toolbar.Button
145 - icon="xmark"
146 - accessibilityLabel="Close request review"
147 - onPress={() => navigation.goBack()}
148 - />
149 - </Toolbar>
142 + <SheetHeader
143 + title="Request review"
144 + subtitle={`#${route.params.number} · ${route.params.repository}`}
145 + onClose={() => navigation.goBack()}
146 + accessibilityLabel="Close request review"
147 + />
148 <NativeStackScreenOptions
149 options={{
152 - title: "Request review",
153 - unstable_headerSubtitle: `#${route.params.number} · ${route.params.repository}`,
150 headerSearchBarOptions: listCandidates ? searchOptions : undefined,
151 unstable_headerToolbarItems: () =>
152 listCandidates && integratedSearch
@@ -165,9 +161,6 @@ export function PullRequestReviewersScreen({ route }: StaticScreenProps<PullRequ
161 : [],
162 }}
163 />
168 - {Platform.OS === "android" ? (
169 - <AndroidScreenHeader title="Request review" onBack={() => navigation.goBack()} />
170 - ) : null}
164 {listCandidates ? (
165 <FlatList
166 ref={listRef}
apps/mobile/src/features/pull-requests/PullRequestSheetContent.tsx
+8 -36
@@ -1,13 +1,10 @@
1 +import { SheetHeader } from "../../components/ui/SheetHeader";
2 import { useNavigation } from "@react-navigation/native";
3 import type { ReactNode } from "react";
4 import { Platform, ScrollView, useWindowDimensions, View } from "react-native";
5 import { KeyboardAvoidingView } from "react-native-keyboard-controller";
6 import { useSafeAreaInsets } from "react-native-safe-area-context";
6 -import { AppText as Text } from "../../components/ui/AppText";
7 -import { AndroidSheetHeader } from "../../components/ui/AndroidScreenHeader";
8 -import { IconButton } from "../../components/ui/IconButton";
7 import { ScreenContent } from "../../components/ui/ScreenContent";
10 -import { ControlPill } from "../../components/ui/ControlPill";
8 import { NativeStackScreenOptions } from "../../native/StackHeader";
9
10 export function PullRequestSheetContent(props: {
@@ -35,38 +32,13 @@ export function PullRequestSheetContent(props: {
32 ) : null;
33 const content = (
34 <>
38 - {android ? (
39 - <AndroidSheetHeader
40 - title={props.title}
41 - subtitle={props.subtitle}
42 - hideBottomBorder
43 - leading={
44 - <IconButton
45 - icon="arrow.left"
46 - accessibilityLabel="Close"
47 - disabled={props.busy}
48 - tintColorClassName="accent-header-foreground"
49 - onPress={() => navigation.goBack()}
50 - />
51 - }
52 - />
53 - ) : (
54 - <View className="flex-row items-center gap-2 px-4 pt-5 pb-5">
55 - <ControlPill
56 - icon="xmark"
57 - accessibilityLabel="Close"
58 - disabled={props.busy}
59 - onPress={() => navigation.goBack()}
60 - />
61 - <View className="min-w-0 flex-1 items-center gap-1">
62 - <Text className="text-center text-base font-t3-bold">{props.title}</Text>
63 - <Text numberOfLines={1} className="text-center text-xs text-foreground-muted">
64 - {props.subtitle}
65 - </Text>
66 - </View>
67 - <View className="w-11" />
68 - </View>
69 - )}
35 + <SheetHeader
36 + presentation="inline"
37 + title={props.title}
38 + subtitle={props.subtitle}
39 + onCancel={() => navigation.goBack()}
40 + dismissDisabled={props.busy}
41 + />
42 <ScreenContent fitToContents={fitToContents}>
43 {props.scrollable === false ? (
44 <View className="flex-1" pointerEvents={props.busy ? "none" : "auto"}>
apps/mobile/src/features/settings/components/SettingsLegalDocumentRouteScreen.tsx
+3 -3
@@ -1,3 +1,4 @@
1 +import { SheetCloseButton } from "../../../components/ui/SheetHeader";
2 import { type NavigationProp, type ParamListBase, useNavigation } from "@react-navigation/native";
3 import { useCallback, useLayoutEffect, useState } from "react";
4 import { Linking, Pressable, View } from "react-native";
@@ -15,10 +16,9 @@ export function SettingsLegalDocumentCloseHeaderButton() {
16 const navigation = useNavigation();
17
18 return (
18 - <IconButton
19 + <SheetCloseButton
20 accessibilityLabel="Close legal document"
20 - icon="xmark"
21 - onPress={() => navigation.goBack()}
21 + onClose={() => navigation.goBack()}
22 />
23 );
24 }
apps/mobile/src/features/threads/CustomSnoozeSheet.ios.tsx
+7 -17
@@ -1,4 +1,4 @@
1 -import { Toolbar } from "../../components/ui/Toolbar";
1 +import { SheetHeader } from "../../components/ui/SheetHeader";
2 import {
3 DatePicker,
4 Host,
@@ -249,22 +249,12 @@ function SnoozePopoverNavigation(props: {
249 <SnoozeStack.Screen name="CustomSnooze">
250 {() => (
251 <>
252 - <Toolbar placement="left">
253 - <Toolbar.Button
254 - accessibilityLabel="Cancel custom snooze"
255 - icon="xmark"
256 - onPress={props.onClose}
257 - />
258 - </Toolbar>
259 - <Toolbar placement="right">
260 - <Toolbar.Button
261 - accessibilityLabel="Snooze"
262 - icon="checkmark"
263 - variant="prominent"
264 - tintColor={colors["--color-prominent-action"]}
265 - onPress={props.onSubmit}
266 - />
267 - </Toolbar>
252 + <SheetHeader
253 + title="Custom snooze"
254 + onCancel={props.onClose}
255 + accessibilityLabel="Cancel custom snooze"
256 + confirm={{ label: "Snooze", onPress: props.onSubmit }}
257 + />
258 <ScrollView
259 contentInsetAdjustmentBehavior="automatic"
260 showsVerticalScrollIndicator={false}
apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
+12 -6
@@ -1,5 +1,6 @@
1 +import { AndroidScreenHeader } from "../../components/ui/AndroidScreenHeader";
2 +import { SheetHeader } from "../../components/ui/SheetHeader";
3 import { Button } from "../../components/ui/Button";
2 -import { Toolbar } from "../../components/ui/Toolbar";
4 import * as Dialog from "../../components/ui/Dialog";
5 import { useAtomValue } from "@effect/atom-react";
6 import * as Cause from "effect/Cause";
@@ -54,7 +55,6 @@ import {
55 ComposerInlineControl,
56 ComposerToolbarRow,
57 } from "../../components/ComposerToolbar";
57 -import { AndroidScreenHeader } from "../../components/ui/AndroidScreenHeader";
58 import { ScreenContent } from "../../components/ui/ScreenContent";
59 import { ComposerAttachmentButton } from "./ComposerAttachmentButton";
60 import { ComposerAttachmentStrip } from "../../components/ComposerAttachmentStrip";
@@ -1784,7 +1784,11 @@ export function NewTaskDraftScreen(props: {
1784 return (
1785 <View className="flex-1 bg-sheet" collapsable={false}>
1786 <NativeStackScreenOptions options={{ headerShown: false }} />
1787 - <AndroidScreenHeader title="New thread" hideBottomBorder onBack={closeNewTask} />
1787 + <SheetHeader
1788 + title="New thread"
1789 + onCancel={closeNewTask}
1790 + accessibilityLabel="Cancel new task"
1791 + />
1792 <ScreenContent>
1793 {heroViewport}
1794
@@ -1808,9 +1812,11 @@ export function NewTaskDraftScreen(props: {
1812 title: "New thread",
1813 }}
1814 />
1811 - <Toolbar placement="left">
1812 - <Toolbar.Button accessibilityLabel="Cancel new task" icon="xmark" onPress={closeNewTask} />
1813 - </Toolbar>
1815 + <SheetHeader
1816 + title="New thread"
1817 + onCancel={closeNewTask}
1818 + accessibilityLabel="Cancel new task"
1819 + />
1820
1821 {heroViewport}
1822 <KeyboardStickyView
apps/mobile/src/features/threads/ThreadArrangementSheet.tsx
+7 -9
@@ -1,3 +1,4 @@
1 +import { SheetHeader } from "../../components/ui/SheetHeader";
2 import { appAtomRegistry } from "../../state/atom-registry";
3 import { useAtomValue } from "@effect/atom-react";
4 import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
@@ -12,7 +13,6 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
13
14 import { AppText as Text } from "../../components/ui/AppText";
15 import { SymbolView } from "../../components/ui/AppSymbol";
15 -import { IconButton } from "../../components/ui/IconButton";
16 import { scopedThreadKey } from "../../lib/scopedEntities";
17 import { environmentServerConfigsAtom } from "../../state/server";
18 import { environmentThreadShells } from "../../state/threads";
@@ -377,14 +377,12 @@ export function ThreadArrangementSheet(props: { onClose: () => void }) {
377 className="flex-1 bg-screen"
378 style={{ paddingTop: insets.top, paddingBottom: insets.bottom }}
379 >
380 - <View className="flex-row items-center justify-between gap-3 px-5 py-3">
381 - <Text className="flex-1 text-xl font-t3-semibold">Arrange threads</Text>
382 - <IconButton
383 - accessibilityLabel="Close arrange threads"
384 - icon="xmark"
385 - onPress={props.onClose}
386 - />
387 - </View>
380 + <SheetHeader
381 + presentation="inline"
382 + title="Arrange threads"
383 + onClose={props.onClose}
384 + accessibilityLabel="Close arrange threads"
385 + />
386 <Text className="px-5 pb-3 text-sm text-foreground-muted">
387 Drag to reorder, pin, or settle. Changes save when you drop.
388 </Text>
apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
+13 -22
@@ -1,3 +1,4 @@
1 +import { SheetHeader } from "../../components/ui/SheetHeader";
2 import { Toolbar } from "../../components/ui/Toolbar";
3 import * as Dialog from "../../components/ui/Dialog";
4 import { createV5StackNavigator as createNativeStackNavigator } from "../../native/createV5StackNavigator";
@@ -45,7 +46,6 @@ import { SymbolView } from "../../components/ui/AppSymbol";
46 import { AppText as Text } from "../../components/ui/AppText";
47 import { AndroidScreenHeader } from "../../components/ui/AndroidScreenHeader";
48 import { AndroidAnchoredMenu } from "../../components/ui/AndroidAnchoredMenu";
48 -import { Button } from "../../components/ui/Button";
49 import { IconButton } from "../../components/ui/IconButton";
50 import { ProviderIcon } from "../../components/ProviderIcon";
51 import { ThemedSwitch } from "../../components/ui/ThemedSwitch";
@@ -1157,7 +1157,6 @@ function ThreadSettingsModelsScreen() {
1157 const presentation = useThreadSettingsPickerPresentation();
1158 const navigation = useNavigation<NativeStackNavigationProp<ThreadSettingsPickerStackParams>>();
1159 const usesNativeMailSearchToolbar = useNativeMailSearchToolbar();
1160 - const theme = useUniwindTheme();
1160 const hasCustomCatalogFilter = session.providerFilter !== null || session.showLegacy;
1161 const commitAndClose = useEffectEvent(() => {
1162 if (!session.commitPendingModel()) return;
@@ -1201,7 +1200,7 @@ function ThreadSettingsModelsScreen() {
1200 return (
1201 <>
1202 {Platform.OS === "android" ? (
1204 - <AndroidScreenHeader
1203 + <SheetHeader
1204 trailing={
1205 <View className="flex-row items-center">
1206 <AndroidAnchoredMenu
@@ -1244,14 +1243,11 @@ function ThreadSettingsModelsScreen() {
1243 />
1244 )}
1245 </AndroidAnchoredMenu>
1247 - {session.pendingModel ? (
1248 - <Button label="Save" tone="text" onPress={commitAndClose} />
1249 - ) : null}
1246 </View>
1247 }
1252 - onBack={presentation.onClose}
1248 + onCancel={presentation.onClose}
1249 title="Thread settings"
1254 - hideBottomBorder
1250 + confirm={session.pendingModel ? { label: "Save", onPress: commitAndClose } : undefined}
1251 />
1252 ) : null}
1253 <NativeStackScreenOptions
@@ -1303,22 +1299,17 @@ function ThreadSettingsModelsScreen() {
1299 }}
1300 />
1301 </ScreenContent>
1306 - <Toolbar placement="left">
1307 - <Toolbar.Button
1302 + {Platform.OS === "ios" ? (
1303 + <SheetHeader
1304 + title="Thread settings"
1305 + onCancel={presentation.onClose}
1306 accessibilityLabel="Cancel thread settings"
1309 - icon="xmark"
1310 - onPress={presentation.onClose}
1311 - />
1312 - </Toolbar>
1313 - <Toolbar placement="right">
1314 - <Toolbar.Button
1315 - accessibilityLabel={session.pendingModel ? "Save thread settings" : "Done"}
1316 - icon="checkmark"
1317 - variant="prominent"
1318 - tintColor={theme["--color-prominent-action"]}
1319 - onPress={commitAndClose}
1307 + confirm={{
1308 + label: session.pendingModel ? "Save thread settings" : "Done",
1309 + onPress: commitAndClose,
1310 + }}
1311 />
1321 - </Toolbar>
1312 + ) : null}
1313 {Platform.OS === "ios" && !usesNativeMailSearchToolbar ? (
1314 <Toolbar placement="bottom">
1315 <Toolbar.Menu
apps/mobile/src/features/threads/git/GitCommitSheet.tsx
+8 -25
@@ -1,3 +1,4 @@
1 +import { SheetHeader } from "../../../components/ui/SheetHeader";
2 import { Button } from "../../../components/ui/Button";
3 import { useNavigation, type StaticScreenProps } from "@react-navigation/native";
4 import { useState } from "react";
@@ -5,7 +6,6 @@ import { Platform, Pressable, ScrollView, useWindowDimensions, View } from "reac
6 import { formatDiffCount } from "@t3tools/client-runtime/diff-count";
7 import { useSafeAreaInsets } from "react-native-safe-area-context";
8
8 -import { IconButton } from "../../../components/ui/IconButton";
9 import { SymbolView } from "../../../components/ui/AppSymbol";
10 import { NativeStackScreenOptions } from "../../../native/StackHeader";
11 import { AppText as Text, AppTextInput as TextInput } from "../../../components/ui/AppText";
@@ -77,30 +77,13 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
77 options={{ sheetCornerRadius: 28, sheetAllowedDetents: "fitToContents" }}
78 />
79 ) : null}
80 - <View className="flex-row items-center justify-between gap-3 px-5 pt-3 pb-2">
81 - <View className="flex-1 gap-1">
82 - <Text className="text-xl font-t3-bold text-foreground">Commit changes</Text>
83 - <View className="flex-row items-center gap-1.5">
84 - <SymbolView
85 - name="arrow.branch"
86 - size={14}
87 - tintColorClassName="accent-foreground-muted"
88 - />
89 - <Text
90 - numberOfLines={1}
91 - ellipsizeMode="middle"
92 - className="flex-1 text-sm text-foreground-muted"
93 - >
94 - {gitStatus.data?.refName ?? "(detached HEAD)"}
95 - </Text>
96 - </View>
97 - </View>
98 - <IconButton
99 - icon="xmark"
100 - accessibilityLabel="Close commit sheet"
101 - onPress={() => navigation.goBack()}
102 - />
103 - </View>
80 + <SheetHeader
81 + presentation="inline"
82 + title="Commit changes"
83 + subtitle={gitStatus.data?.refName ?? "(detached HEAD)"}
84 + onCancel={() => navigation.goBack()}
85 + accessibilityLabel="Cancel commit"
86 + />
87 <ScrollView
88 nestedScrollEnabled
89 className="android:shrink android:grow-0 ios:flex-1"