Skip to content

Commit 9259ca4

Browse files
refactor(mobile): share thread recovery and sheet actions
1 parent b4c0be1 commit 9259ca4

15 files changed

Lines changed: 111 additions & 156 deletions

‎apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Button } from "../../components/ui/Button";
12
import type {
23
EnvironmentProject,
34
EnvironmentThreadShell,
@@ -14,7 +15,7 @@ import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
1415
import { AppBar } from "../../components/ui/AppBar";
1516
import { SymbolView } from "../../components/ui/AppSymbol";
1617
import { useCallback, useMemo, useRef, type ComponentProps } from "react";
17-
import { Platform, Pressable, RefreshControl, useWindowDimensions, View } from "react-native";
18+
import { Platform, RefreshControl, useWindowDimensions, View } from "react-native";
1819
import { GestureDetector, useNativeGesture } from "react-native-gesture-handler";
1920
import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";
2021

@@ -279,9 +280,9 @@ function ArchiveError(props: { readonly message: string; readonly onRetry: () =>
279280
Could not load every archive
280281
</Text>
281282
<Text className="mt-1 text-sm text-foreground-muted">{props.message}</Text>
282-
<Pressable className="mt-3 self-start active:opacity-60" onPress={props.onRetry}>
283-
<Text className="text-sm font-t3-bold text-danger-foreground">Try again</Text>
284-
</Pressable>
283+
<View className="mt-3">
284+
<Button label="Try again" tone="secondary" onPress={props.onRetry} />
285+
</View>
285286
</View>
286287
);
287288
}

‎apps/mobile/src/features/threads/ComposerFeedback.tsx‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Button } from "../../components/ui/Button";
12
import {
23
codexFeedbackNotice,
34
type CodexFeedbackSubmission,
@@ -47,15 +48,13 @@ export function ComposerFeedback({
4748
</Text>
4849
) : null}
4950
{submission.status === "sent" ? (
50-
<Pressable
51-
accessibilityRole="button"
51+
<Button
52+
label="Copy ID"
53+
tone="text"
5254
onPress={() =>
5355
copyTextWithHaptic(submission.feedbackId, { target: "Codex feedback thread ID" })
5456
}
55-
className="self-start py-1 active:opacity-60"
56-
>
57-
<Text className="text-sm text-foreground">Copy ID</Text>
58-
</Pressable>
57+
/>
5958
) : null}
6059
</View>
6160
</View>

‎apps/mobile/src/features/threads/ComposerQueuedEdit.tsx‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Button } from "../../components/ui/Button";
12
import type { ChatAttachment, EnvironmentId } from "@t3tools/contracts";
23
import { Image } from "expo-image";
34
import { Pressable, ScrollView, View } from "react-native";
@@ -17,16 +18,13 @@ export function ComposerQueuedEditBanner(props: {
1718
<Text className="min-w-0 flex-1 text-xs text-foreground-muted" numberOfLines={1}>
1819
Editing queued message
1920
</Text>
20-
<Pressable
21-
accessibilityRole="button"
21+
<Button
22+
label="Cancel"
23+
tone="text"
2224
accessibilityLabel="Cancel editing queued message"
2325
disabled={props.saving}
2426
onPress={props.onCancel}
25-
hitSlop={8}
26-
className="min-h-8 justify-center px-1 active:opacity-70 disabled:opacity-40"
27-
>
28-
<Text className="font-t3-medium text-xs text-primary">Cancel</Text>
29-
</Pressable>
27+
/>
3028
</View>
3129
);
3230
}

‎apps/mobile/src/features/threads/CustomSnoozeSheet.shared.tsx‎

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Button } from "../../components/ui/Button";
12
import { DateTimePicker } from "@expo/ui/community/datetime-picker";
23
import {
34
localSnoozeDate,
@@ -143,16 +144,10 @@ export function CustomSnoozeSheet(props: {
143144
</AppText>
144145
)}
145146
<View className="flex-row justify-end gap-3">
146-
<Pressable
147-
accessibilityRole="button"
148-
className="min-h-12 justify-center px-3"
149-
onPress={props.onClose}
150-
>
151-
<AppText>Cancel</AppText>
152-
</Pressable>
153-
<Pressable
154-
accessibilityRole="button"
155-
className="min-h-12 justify-center rounded-xl bg-subtle px-3"
147+
<Button label="Cancel" tone="text" onPress={props.onClose} />
148+
<Button
149+
label="Snooze"
150+
tone="secondary"
156151
onPress={() => {
157152
const input: CustomSnoozeInput =
158153
mode === "date"
@@ -170,9 +165,7 @@ export function CustomSnoozeSheet(props: {
170165
props.onSnooze(snoozedUntil);
171166
props.onClose();
172167
}}
173-
>
174-
<AppText className="text-foreground">Snooze</AppText>
175-
</Pressable>
168+
/>
176169
</View>
177170
</ScrollView>
178171
</KeyboardAvoidingView>

‎apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Button } from "../../components/ui/Button";
12
import { Toolbar } from "../../components/ui/Toolbar";
23
import * as Dialog from "../../components/ui/Dialog";
34
import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
@@ -470,13 +471,9 @@ export function BranchPickerScreen(props: {
470471
: "No branches available"}
471472
</Text>
472473
{!props.loading && props.error ? (
473-
<Pressable
474-
accessibilityRole="button"
475-
className="rounded-full bg-card px-4 py-2 active:opacity-70"
476-
onPress={props.onRefresh}
477-
>
478-
<Text className="text-sm font-t3-medium text-foreground">Try again</Text>
479-
</Pressable>
474+
<View className="self-center">
475+
<Button label="Try again" tone="secondary" onPress={props.onRefresh} />
476+
</View>
480477
) : null}
481478
</View>
482479
</ScrollView>

‎apps/mobile/src/features/threads/NewTaskDraftScreen.tsx‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Button } from "../../components/ui/Button";
12
import { Toolbar } from "../../components/ui/Toolbar";
23
import * as Dialog from "../../components/ui/Dialog";
34
import { useAtomValue } from "@effect/atom-react";
@@ -1612,14 +1613,12 @@ export function NewTaskDraftScreen(props: {
16121613
) : null}
16131614

16141615
{modelUnavailable ? (
1615-
<Pressable
1616-
accessibilityRole="button"
1617-
className="px-3 py-2"
1616+
<Button
1617+
label="Model unavailable. Open model settings."
1618+
tone="text"
16181619
disabled={isComposerInteractionLocked}
16191620
onPress={settingsSheetPresentation.open}
1620-
>
1621-
<Text className="text-xs text-foreground">Model unavailable. Open model settings.</Text>
1622-
</Pressable>
1621+
/>
16231622
) : null}
16241623

16251624
<ComposerSurface

‎apps/mobile/src/features/threads/PendingUserInputCard.tsx‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -312,16 +312,12 @@ export function PendingUserInputCard(props: PendingUserInputCardProps) {
312312
onPress={() => void props.onSubmit()}
313313
/>
314314
{props.pendingUserInput.dismissible ? (
315-
<Pressable
316-
accessibilityRole="button"
317-
className="items-center justify-center rounded-2xl px-4 py-2.5 active:opacity-70"
315+
<Button
316+
label="Dismiss without answering"
317+
tone="text"
318318
disabled={isResponding}
319319
onPress={() => void props.onDismiss()}
320-
>
321-
<Text className="font-t3-bold text-sm text-foreground-muted">
322-
Dismiss without answering
323-
</Text>
324-
</Pressable>
320+
/>
325321
) : null}
326322
{!props.canOperateThread ? (
327323
<Text className="font-sans text-xs text-foreground-tertiary">

‎apps/mobile/src/features/threads/ProjectCloneBanner.tsx‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import { Button } from "../../components/ui/Button";
12
import {
23
projectCloneDisplayName,
34
projectCloneProgressSummary,
45
type ProjectCloneSnapshot,
56
} from "@t3tools/contracts";
6-
import { Pressable, View } from "react-native";
7+
import { View } from "react-native";
78

89
import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
910
import { cn } from "../../lib/cn";
@@ -65,13 +66,11 @@ export function ProjectCloneBanner(props: {
6566

6667
function BannerAction(props: { readonly label: string; readonly onPress: () => void }) {
6768
return (
68-
<Pressable
69-
accessibilityRole="button"
69+
<Button
70+
label={props.label}
71+
tone="secondary"
7072
accessibilityLabel={props.label}
71-
className="rounded-full border border-border bg-card px-3 py-1.5"
7273
onPress={props.onPress}
73-
>
74-
<Text className="font-t3-medium text-xs">{props.label}</Text>
75-
</Pressable>
74+
/>
7675
);
7776
}

‎apps/mobile/src/features/threads/SecretRequestCard.tsx‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from "@t3tools/client-runtime/state/runtime";
1313
import type { EnvironmentId, OrchestrationV2ProjectedTurnItem } from "@t3tools/contracts";
1414
import { useRef, useState } from "react";
15-
import { Pressable, View, type ColorValue } from "react-native";
15+
import { View, type ColorValue } from "react-native";
1616

1717
import { SymbolView, type AppSymbolName } from "../../components/ui/AppSymbol";
1818
import { AppText as Text, AppTextInput as TextInput } from "../../components/ui/AppText";
@@ -147,16 +147,12 @@ function PendingSecretRequestForm(props: {
147147
{SECRET_REQUEST_PRIVACY_NOTE}
148148
</Text>
149149
</View>
150-
<Pressable
151-
accessibilityRole="button"
152-
accessibilityState={{ disabled: submitting }}
150+
<Button
151+
label="Decline"
152+
tone="text"
153153
disabled={submitting}
154-
hitSlop={8}
155-
className="px-1 py-1 active:opacity-60 disabled:opacity-50"
156154
onPress={() => void send({ type: "decline" })}
157-
>
158-
<Text className="font-sans text-xs text-foreground-muted">Decline</Text>
159-
</Pressable>
155+
/>
160156
</View>
161157
</View>
162158
);

‎apps/mobile/src/features/threads/ThreadComposer.tsx‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Button } from "../../components/ui/Button";
12
import * as Dialog from "../../components/ui/Dialog";
23
import type { ComposerTextPaste } from "../../native/T3ComposerEditor.types";
34
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
@@ -27,7 +28,7 @@ import {
2728
import { StackActions, useFocusEffect, useNavigation } from "@react-navigation/native";
2829
import type { ReactNode } from "react";
2930
import { useEffect, useLayoutEffect, useRef, useState, type RefObject } from "react";
30-
import { Keyboard, Platform, Pressable, View, type ViewStyle } from "react-native";
31+
import { Keyboard, Platform, View, type ViewStyle } from "react-native";
3132
import { composerImageGallery } from "../../lib/composerImageGallery";
3233
import { filePreviewGallery } from "../../lib/filePreviewGallery";
3334
import { FilePreviewModal, type FilePreviewSource } from "../../components/FilePreviewModal";
@@ -720,9 +721,11 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
720721
</Text>
721722
) : null}
722723
{modelUnavailable ? (
723-
<Pressable accessibilityRole="button" className="px-3 py-2" onPress={openSettings}>
724-
<Text className="text-xs text-foreground">Model unavailable. Open model settings.</Text>
725-
</Pressable>
724+
<Button
725+
label="Model unavailable. Open model settings."
726+
tone="text"
727+
onPress={openSettings}
728+
/>
726729
) : null}
727730

728731
<ComposerSurface

0 commit comments

Comments
 (0)