Skip to content
TypeScript

refactor(mobile): simplify commit sheet and share thread actions (#21943)

Julius Marminge7247851d35ac
diff --git a/apps/mobile/src/Stack.tsx b/apps/mobile/src/Stack.tsx
index 5763f8f2d2f..6d7ebcb9ffe 100644
--- a/apps/mobile/src/Stack.tsx
+++ b/apps/mobile/src/Stack.tsx
@@ -889,7 +889,7 @@ const RootStackConfig = createWorkspaceStackNavigator({
linking: `${THREAD_LINKING_PREFIX}/git/commit`,
options: {
...FORM_SHEET_PRESENTATION_OPTIONS,
- sheetAllowedDetents: [0.55, 0.92],
+ sheetAllowedDetents: [0.8, 0.92],
sheetGrabberVisible: true,
},
}),
diff --git a/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx b/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx
index 1cfff44892e..c3e29ec39af 100644
--- a/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx
+++ b/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx
@@ -1,3 +1,4 @@
+import { Button } from "../../components/ui/Button";
import type {
EnvironmentProject,
EnvironmentThreadShell,
@@ -14,7 +15,7 @@ import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
import { AppBar } from "../../components/ui/AppBar";
import { SymbolView } from "../../components/ui/AppSymbol";
import { useCallback, useMemo, useRef, type ComponentProps } from "react";
-import { Platform, Pressable, RefreshControl, useWindowDimensions, View } from "react-native";
+import { Platform, RefreshControl, useWindowDimensions, View } from "react-native";
import { GestureDetector, useNativeGesture } from "react-native-gesture-handler";
import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";
@@ -279,9 +280,9 @@ function ArchiveError(props: { readonly message: string; readonly onRetry: () =>
Could not load every archive
</Text>
<Text className="mt-1 text-sm text-foreground-muted">{props.message}</Text>
- <Pressable className="mt-3 self-start active:opacity-60" onPress={props.onRetry}>
- <Text className="text-sm font-t3-bold text-danger-foreground">Try again</Text>
- </Pressable>
+ <View className="mt-3">
+ <Button label="Try again" tone="secondary" onPress={props.onRetry} />
+ </View>
</View>
);
}
diff --git a/apps/mobile/src/features/threads/ComposerFeedback.tsx b/apps/mobile/src/features/threads/ComposerFeedback.tsx
index f965ae5c227..de4b16a06bc 100644
--- a/apps/mobile/src/features/threads/ComposerFeedback.tsx
+++ b/apps/mobile/src/features/threads/ComposerFeedback.tsx
@@ -1,3 +1,4 @@
+import { Button } from "../../components/ui/Button";
import {
codexFeedbackNotice,
type CodexFeedbackSubmission,
@@ -47,15 +48,13 @@ export function ComposerFeedback({
</Text>
) : null}
{submission.status === "sent" ? (
- <Pressable
- accessibilityRole="button"
+ <Button
+ label="Copy ID"
+ tone="text"
onPress={() =>
copyTextWithHaptic(submission.feedbackId, { target: "Codex feedback thread ID" })
}
- className="self-start py-1 active:opacity-60"
- >
- <Text className="text-sm text-foreground">Copy ID</Text>
- </Pressable>
+ />
) : null}
</View>
</View>
diff --git a/apps/mobile/src/features/threads/ComposerQueuedEdit.tsx b/apps/mobile/src/features/threads/ComposerQueuedEdit.tsx
index 6ebf85b8789..3263a3af356 100644
--- a/apps/mobile/src/features/threads/ComposerQueuedEdit.tsx
+++ b/apps/mobile/src/features/threads/ComposerQueuedEdit.tsx
@@ -1,3 +1,4 @@
+import { Button } from "../../components/ui/Button";
import type { ChatAttachment, EnvironmentId } from "@t3tools/contracts";
import { Image } from "expo-image";
import { Pressable, ScrollView, View } from "react-native";
@@ -17,16 +18,13 @@ export function ComposerQueuedEditBanner(props: {
<Text className="min-w-0 flex-1 text-xs text-foreground-muted" numberOfLines={1}>
Editing queued message
</Text>
- <Pressable
- accessibilityRole="button"
+ <Button
+ label="Cancel"
+ tone="text"
accessibilityLabel="Cancel editing queued message"
disabled={props.saving}
onPress={props.onCancel}
- hitSlop={8}
- className="min-h-8 justify-center px-1 active:opacity-70 disabled:opacity-40"
- >
- <Text className="font-t3-medium text-xs text-primary">Cancel</Text>
- </Pressable>
+ />
</View>
);
}
diff --git a/apps/mobile/src/features/threads/CustomSnoozeSheet.shared.tsx b/apps/mobile/src/features/threads/CustomSnoozeSheet.shared.tsx
index 18891107d82..84407ea4eb2 100644
--- a/apps/mobile/src/features/threads/CustomSnoozeSheet.shared.tsx
+++ b/apps/mobile/src/features/threads/CustomSnoozeSheet.shared.tsx
@@ -1,3 +1,4 @@
+import { Button } from "../../components/ui/Button";
import { DateTimePicker } from "@expo/ui/community/datetime-picker";
import {
localSnoozeDate,
@@ -143,16 +144,10 @@ export function CustomSnoozeSheet(props: {
</AppText>
)}
<View className="flex-row justify-end gap-3">
- <Pressable
- accessibilityRole="button"
- className="min-h-12 justify-center px-3"
- onPress={props.onClose}
- >
- <AppText>Cancel</AppText>
- </Pressable>
- <Pressable
- accessibilityRole="button"
- className="min-h-12 justify-center rounded-xl bg-subtle px-3"
+ <Button label="Cancel" tone="text" onPress={props.onClose} />
+ <Button
+ label="Snooze"
+ tone="secondary"
onPress={() => {
const input: CustomSnoozeInput =
mode === "date"
@@ -170,9 +165,7 @@ export function CustomSnoozeSheet(props: {
props.onSnooze(snoozedUntil);
props.onClose();
}}
- >
- <AppText className="text-foreground">Snooze</AppText>
- </Pressable>
+ />
</View>
</ScrollView>
</KeyboardAvoidingView>
diff --git a/apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx b/apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx
index 54b9e17da4a..8ed3d96e5ba 100644
--- a/apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx
+++ b/apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx
@@ -1,3 +1,4 @@
+import { Button } from "../../components/ui/Button";
import { Toolbar } from "../../components/ui/Toolbar";
import * as Dialog from "../../components/ui/Dialog";
import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
@@ -470,13 +471,9 @@ export function BranchPickerScreen(props: {
: "No branches available"}
</Text>
{!props.loading && props.error ? (
- <Pressable
- accessibilityRole="button"
- className="rounded-full bg-card px-4 py-2 active:opacity-70"
- onPress={props.onRefresh}
- >
- <Text className="text-sm font-t3-medium text-foreground">Try again</Text>
- </Pressable>
+ <View className="self-center">
+ <Button label="Try again" tone="secondary" onPress={props.onRefresh} />
+ </View>
) : null}
</View>
</ScrollView>
diff --git a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
index c0b76f4a7a7..4a7c366caf0 100644
--- a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
+++ b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
@@ -1,3 +1,4 @@
+import { Button } from "../../components/ui/Button";
import { Toolbar } from "../../components/ui/Toolbar";
import * as Dialog from "../../components/ui/Dialog";
import { useAtomValue } from "@effect/atom-react";
@@ -1612,14 +1613,12 @@ export function NewTaskDraftScreen(props: {
) : null}
{modelUnavailable ? (
- <Pressable
- accessibilityRole="button"
- className="px-3 py-2"
+ <Button
+ label="Model unavailable. Open model settings."
+ tone="text"
disabled={isComposerInteractionLocked}
onPress={settingsSheetPresentation.open}
- >
- <Text className="text-xs text-foreground">Model unavailable. Open model settings.</Text>
- </Pressable>
+ />
) : null}
<ComposerSurface
diff --git a/apps/mobile/src/features/threads/PendingUserInputCard.tsx b/apps/mobile/src/features/threads/PendingUserInputCard.tsx
index c20ad4cc1af..6be28f295d6 100644
--- a/apps/mobile/src/features/threads/PendingUserInputCard.tsx
+++ b/apps/mobile/src/features/threads/PendingUserInputCard.tsx
@@ -312,16 +312,12 @@ export function PendingUserInputCard(props: PendingUserInputCardProps) {
onPress={() => void props.onSubmit()}
/>
{props.pendingUserInput.dismissible ? (
- <Pressable
- accessibilityRole="button"
- className="items-center justify-center rounded-2xl px-4 py-2.5 active:opacity-70"
+ <Button
+ label="Dismiss without answering"
+ tone="text"
disabled={isResponding}
onPress={() => void props.onDismiss()}
- >
- <Text className="font-t3-bold text-sm text-foreground-muted">
- Dismiss without answering
- </Text>
- </Pressable>
+ />
) : null}
{!props.canOperateThread ? (
<Text className="font-sans text-xs text-foreground-tertiary">
diff --git a/apps/mobile/src/features/threads/ProjectCloneBanner.tsx b/apps/mobile/src/features/threads/ProjectCloneBanner.tsx
index 7ca89a4e856..96706644800 100644
--- a/apps/mobile/src/features/threads/ProjectCloneBanner.tsx
+++ b/apps/mobile/src/features/threads/ProjectCloneBanner.tsx
@@ -1,9 +1,10 @@
+import { Button } from "../../components/ui/Button";
import {
projectCloneDisplayName,
projectCloneProgressSummary,
type ProjectCloneSnapshot,
} from "@t3tools/contracts";
-import { Pressable, View } from "react-native";
+import { View } from "react-native";
import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
import { cn } from "../../lib/cn";
@@ -65,13 +66,11 @@ export function ProjectCloneBanner(props: {
function BannerAction(props: { readonly label: string; readonly onPress: () => void }) {
return (
- <Pressable
- accessibilityRole="button"
+ <Button
+ label={props.label}
+ tone="secondary"
accessibilityLabel={props.label}
- className="rounded-full border border-border bg-card px-3 py-1.5"
onPress={props.onPress}
- >
- <Text className="font-t3-medium text-xs">{props.label}</Text>
- </Pressable>
+ />
);
}
diff --git a/apps/mobile/src/features/threads/SecretRequestCard.tsx b/apps/mobile/src/features/threads/SecretRequestCard.tsx
index 3d705b297ce..02d773c13f1 100644
--- a/apps/mobile/src/features/threads/SecretRequestCard.tsx
+++ b/apps/mobile/src/features/threads/SecretRequestCard.tsx
@@ -12,7 +12,7 @@ import {
} from "@t3tools/client-runtime/state/runtime";
import type { EnvironmentId, OrchestrationV2ProjectedTurnItem } from "@t3tools/contracts";
import { useRef, useState } from "react";
-import { Pressable, View, type ColorValue } from "react-native";
+import { View, type ColorValue } from "react-native";
import { SymbolView, type AppSymbolName } from "../../components/ui/AppSymbol";
import { AppText as Text, AppTextInput as TextInput } from "../../components/ui/AppText";
@@ -147,16 +147,12 @@ function PendingSecretRequestForm(props: {
{SECRET_REQUEST_PRIVACY_NOTE}
</Text>
</View>
- <Pressable
- accessibilityRole="button"
- accessibilityState={{ disabled: submitting }}
+ <Button
+ label="Decline"
+ tone="text"
disabled={submitting}
- hitSlop={8}
- className="px-1 py-1 active:opacity-60 disabled:opacity-50"
onPress={() => void send({ type: "decline" })}
- >
- <Text className="font-sans text-xs text-foreground-muted">Decline</Text>
- </Pressable>
+ />
</View>
</View>
);
diff --git a/apps/mobile/src/features/threads/ThreadComposer.tsx b/apps/mobile/src/features/threads/ThreadComposer.tsx
index ee34ce242c0..041855e4bba 100644
--- a/apps/mobile/src/features/threads/ThreadComposer.tsx
+++ b/apps/mobile/src/features/threads/ThreadComposer.tsx
@@ -1,3 +1,4 @@
+import { Button } from "../../components/ui/Button";
import * as Dialog from "../../components/ui/Dialog";
import type { ComposerTextPaste } from "../../native/T3ComposerEditor.types";
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
@@ -27,7 +28,7 @@ import {
import { StackActions, useFocusEffect, useNavigation } from "@react-navigation/native";
import type { ReactNode } from "react";
import { useEffect, useLayoutEffect, useRef, useState, type RefObject } from "react";
-import { Keyboard, Platform, Pressable, View, type ViewStyle } from "react-native";
+import { Keyboard, Platform, View, type ViewStyle } from "react-native";
import { composerImageGallery } from "../../lib/composerImageGallery";
import { filePreviewGallery } from "../../lib/filePreviewGallery";
import { FilePreviewModal, type FilePreviewSource } from "../../components/FilePreviewModal";
@@ -720,9 +721,11 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
</Text>
) : null}
{modelUnavailable ? (
- <Pressable accessibilityRole="button" className="px-3 py-2" onPress={openSettings}>
- <Text className="text-xs text-foreground">Model unavailable. Open model settings.</Text>
- </Pressable>
+ <Button
+ label="Model unavailable. Open model settings."
+ tone="text"
+ onPress={openSettings}
+ />
) : null}
<ComposerSurface
diff --git a/apps/mobile/src/features/threads/ThreadFeed.tsx b/apps/mobile/src/features/threads/ThreadFeed.tsx
index cc36b4b2b6a..4f8ad6f586a 100644
--- a/apps/mobile/src/features/threads/ThreadFeed.tsx
+++ b/apps/mobile/src/features/threads/ThreadFeed.tsx
@@ -1,3 +1,4 @@
+import { Button } from "../../components/ui/Button";
import * as Dialog from "../../components/ui/Dialog";
import { useOpenPullRequest } from "../../native/useOpenPullRequest";
import { ThreadMarkdownVideo, ThreadMediaVisibleContext } from "./ThreadMarkdownVideo";
@@ -784,14 +785,12 @@ function ArtifactTemplateCard(props: {
</Text>
</View>
{props.onUse ? (
- <Pressable
- accessibilityRole="button"
+ <Button
+ label="Use template"
+ tone="secondary"
accessibilityLabel={`Use ${props.template.displayName} template`}
- className="min-h-9 justify-center rounded-lg border border-border bg-subtle px-3 active:opacity-65"
onPress={() => props.onUse?.(props.template)}
- >
- <Text className="font-t3-bold text-xs text-foreground">Use template</Text>
- </Pressable>
+ />
) : null}
</View>
);
@@ -2586,29 +2585,23 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
function ThreadFeedLoadEarlierControl(props: ThreadFeedHistoryControls) {
const theme = useUniwindTheme();
const mutedColor = theme["--color-icon-subtle"];
- const accentColor = theme["--color-primary"];
if (!props.hasMoreHistory && props.error === null) {
return null;
}
return (
<View className="mb-3 items-center gap-1.5 px-2">
{props.hasMoreHistory ? (
- <Pressable
- accessibilityRole="button"
- accessibilityLabel="Load earlier activity"
- disabled={props.loading}
- onPress={props.onLoadEarlier}
- className="min-h-9 flex-row items-center justify-center gap-2 rounded-full border border-border/60 bg-card/80 px-4 py-2 disabled:opacity-50"
- >
- {props.loading ? (
- <AppActivityIndicator size="small" color={accentColor} />
- ) : (
- <SymbolView name="chevron.up" size={12} tintColor={accentColor} type="monochrome" />
- )}
- <Text className="text-sm font-medium text-foreground">
- {props.loading ? "Loading earlier activity…" : "Load earlier activity"}
- </Text>
- </Pressable>
+ <View className="self-center">
+ <Button
+ label={props.loading ? "Loading earlier activity…" : "Load earlier activity"}
+ tone="secondary"
+ accessibilityLabel="Load earlier activity"
+ disabled={props.loading}
+ onPress={props.onLoadEarlier}
+ icon="chevron.up"
+ loading={props.loading}
+ />
+ </View>
) : null}
{props.error !== null ? (
<Text className="text-center text-xs" style={{ color: mutedColor }}>
diff --git a/apps/mobile/src/features/threads/UsageLimitRecoveryCard.tsx b/apps/mobile/src/features/threads/UsageLimitRecoveryCard.tsx
index 61bdd3597d1..56cf839dfe3 100644
--- a/apps/mobile/src/features/threads/UsageLimitRecoveryCard.tsx
+++ b/apps/mobile/src/features/threads/UsageLimitRecoveryCard.tsx
@@ -1,10 +1,11 @@
+import { Button } from "../../components/ui/Button";
import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
import { AsyncResult } from "effect/reactivity";
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
import type { EnvironmentId } from "@t3tools/contracts";
import * as DateTime from "effect/DateTime";
import { useEffect, useState } from "react";
-import { Pressable, View } from "react-native";
+import { View } from "react-native";
import { AppText as Text } from "../../components/ui/AppText";
import { threadEnvironment } from "../../state/threads";
import { useAtomCommand } from "../../state/use-atom-command";
@@ -93,26 +94,18 @@ export function UsageLimitRecoveryCard({
</Text>
{canSchedule ? (
<View className="flex-row flex-wrap gap-2">
- <Pressable
- accessibilityRole="button"
+ <Button
+ label={scheduled ? "Cancel auto-resume" : "Resume at reset"}
+ tone="secondary"
disabled={pending}
onPress={() => void toggle("resume")}
- className="self-start rounded-lg bg-subtle px-3 py-2 active:opacity-70"
- >
- <Text className="text-sm text-foreground">
- {scheduled ? "Cancel auto-resume" : "Resume at reset"}
- </Text>
- </Pressable>
- <Pressable
- accessibilityRole="button"
+ />
+ <Button
+ label={snoozed ? "Wake now" : "Snooze until reset"}
+ tone="secondary"
disabled={pending || (!snoozed && resetPassed)}
onPress={() => void toggle("snooze")}
- className="self-start rounded-lg bg-subtle px-3 py-2 active:opacity-70"
- >
- <Text className="text-sm text-foreground">
- {snoozed ? "Wake now" : "Snooze until reset"}
- </Text>
- </Pressable>
+ />
</View>
) : null}
{error ? (
diff --git a/apps/mobile/src/features/threads/git/GitCommitSheet.tsx b/apps/mobile/src/features/threads/git/GitCommitSheet.tsx
index d0cf3c345f0..5dd363c9b79 100644
--- a/apps/mobile/src/features/threads/git/GitCommitSheet.tsx
+++ b/apps/mobile/src/features/threads/git/GitCommitSheet.tsx
@@ -1,12 +1,12 @@
+import { Button } from "../../../components/ui/Button";
import { useNavigation, type StaticScreenProps } from "@react-navigation/native";
import { useState } from "react";
import { Platform, Pressable, ScrollView, useWindowDimensions, View } from "react-native";
import { formatDiffCount } from "@t3tools/client-runtime/diff-count";
import { useSafeAreaInsets } from "react-native-safe-area-context";
-import { AndroidSheetHeader } from "../../../components/ui/AndroidScreenHeader";
+import { IconButton } from "../../../components/ui/IconButton";
import { SymbolView } from "../../../components/ui/AppSymbol";
-import { ScreenContent } from "../../../components/ui/ScreenContent";
import { NativeStackScreenOptions } from "../../../native/StackHeader";
import { AppText as Text, AppTextInput as TextInput } from "../../../components/ui/AppText";
import { cn } from "../../../lib/cn";
@@ -16,7 +16,6 @@ import { useSelectedThreadGitActions } from "../../../state/use-selected-thread-
import { useSelectedThreadGitState } from "../../../state/use-selected-thread-git-state";
import { useSelectedThreadWorktree } from "../../../state/use-selected-thread-worktree";
import { vcsEnvironment } from "../../../state/vcs";
-import { SheetActionButton } from "./gitSheetComponents";
type GitCommitSheetProps = StaticScreenProps<{
readonly environmentId: string;
@@ -48,14 +47,12 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
const [dialogCommitMessage, setDialogCommitMessage] = useState("");
const [excludedFiles, setExcludedFiles] = useState<ReadonlySet<string>>(new Set());
- const [isEditingFiles, setIsEditingFiles] = useState(false);
const selectedFiles = allFiles.filter((file) => !excludedFiles.has(file.path));
const allSelected = excludedFiles.size === 0;
const noneSelected = selectedFiles.length === 0;
const selectedInsertions = selectedFiles.reduce((sum, file) => sum + file.insertions, 0);
const selectedDeletions = selectedFiles.reduce((sum, file) => sum + file.deletions, 0);
- const selectedFilePreview = selectedFiles.slice(0, 3);
const runCommitAction = async (featureBranch: boolean) => {
if (!canWriteSourceControl || (featureBranch && !canChangeThreadBranch)) return;
@@ -77,221 +74,171 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
>
{Platform.OS === "android" ? (
<NativeStackScreenOptions
- options={{
- sheetCornerRadius: 28,
- sheetAllowedDetents: "fitToContents",
- }}
+ options={{ sheetCornerRadius: 28, sheetAllowedDetents: "fitToContents" }}
/>
) : null}
- {Platform.OS === "android" ? (
- <AndroidSheetHeader
- title="Commit changes"
- onBack={() => navigation.goBack()}
- hideBottomBorder
+ <View className="flex-row items-center justify-between gap-3 px-5 pt-3 pb-2">
+ <View className="flex-1 gap-1">
+ <Text className="text-xl font-t3-bold text-foreground">Commit changes</Text>
+ <View className="flex-row items-center gap-1.5">
+ <SymbolView
+ name="arrow.branch"
+ size={14}
+ tintColorClassName="accent-foreground-muted"
+ />
+ <Text
+ numberOfLines={1}
+ ellipsizeMode="middle"
+ className="flex-1 text-sm text-foreground-muted"
+ >
+ {gitStatus.data?.refName ?? "(detached HEAD)"}
+ </Text>
+ </View>
+ </View>
+ <IconButton
+ icon="xmark"
+ accessibilityLabel="Close commit sheet"
+ onPress={() => navigation.goBack()}
/>
- ) : null}
- <ScreenContent fitToContents>
- <ScrollView
- nestedScrollEnabled
- className="android:shrink android:grow-0 ios: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"
- 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">
- <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">
- {gitStatus.data?.refName ?? "(detached HEAD)"}
+ </View>
+ <ScrollView
+ nestedScrollEnabled
+ className="android:shrink android:grow-0 ios:flex-1"
+ keyboardShouldPersistTaps="handled"
+ keyboardDismissMode="on-drag"
+ automaticallyAdjustKeyboardInsets
+ contentContainerClassName="px-5 pt-4 pb-6 gap-5"
+ contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 18) + 18 }}
+ >
+ {isDefaultRef ? (
+ <Text className="text-sm text-warning-foreground">
+ You’re on the default branch. You can create a new branch when committing.
+ </Text>
+ ) : null}
+ <View className="gap-2">
+ <Text className="text-sm font-t3-medium text-foreground">Commit message</Text>
+ <TextInput
+ multiline
+ accessibilityLabel="Commit message"
+ value={dialogCommitMessage}
+ onChangeText={setDialogCommitMessage}
+ placeholder="Describe your changes…"
+ textAlignVertical="top"
+ className="min-h-24 rounded-xl bg-subtle px-4 py-3 text-base"
+ />
+ <Text className="text-xs text-foreground-muted">
+ Leave empty to generate a message automatically.
+ </Text>
+ </View>
+ <View>
+ <View className="flex-row items-center justify-between gap-2 pb-2">
+ <View className="flex-1 gap-1">
+ <Text className="text-base font-t3-bold text-foreground">Changed files</Text>
+ <Text className="text-xs text-foreground-muted">
+ {selectedFiles.length} of {allFiles.length} selected · +
+ {formatDiffCount(selectedInsertions)} −{formatDiffCount(selectedDeletions)}
</Text>
</View>
- {isDefaultRef ? (
- <Text className="text-xs leading-normal text-warning-foreground">
- Warning: this is the default branch.
- </Text>
+ {allFiles.length > 0 ? (
+ <Button
+ label={allSelected ? "Deselect all" : "Select all"}
+ tone="text"
+ onPress={() =>
+ setExcludedFiles(
+ allSelected ? new Set(allFiles.map((file) => file.path)) : new Set(),
+ )
+ }
+ />
) : null}
</View>
-
- <View className="gap-3 bg-card p-4 android:rounded-[20px] ios:rounded-[22px] ios:border ios: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">
- Files
- </Text>
- <Text className="text-foreground-muted text-xs leading-normal">
- {selectedFiles.length} selected · +{formatDiffCount(selectedInsertions)} / -
- {formatDiffCount(selectedDeletions)}
- </Text>
- </View>
- <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"
- 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">
- Reset
- </Text>
- </Pressable>
- ) : null}
+ {allFiles.length === 0 ? (
+ <Text className="py-4 text-sm text-foreground-muted">No changed files to commit.</Text>
+ ) : (
+ allFiles.map((file) => {
+ const included = !excludedFiles.has(file.path);
+ const slash = file.path.lastIndexOf("/");
+ const name = file.path.slice(slash + 1);
+ const directory = slash >= 0 ? file.path.slice(0, slash) : null;
+ return (
<Pressable
- className="rounded-full px-3 android:min-h-12 android:justify-center android:active:bg-subtle ios:bg-subtle ios:py-2"
- onPress={() => setIsEditingFiles((current) => !current)}
+ key={file.path}
+ className="min-h-16 flex-row items-center gap-3 border-t border-border-subtle py-3"
+ accessibilityRole="checkbox"
+ accessibilityLabel={file.path}
+ accessibilityState={{ checked: included }}
+ onPress={() =>
+ setExcludedFiles((current) => {
+ const next = new Set(current);
+ if (next.has(file.path)) next.delete(file.path);
+ else next.add(file.path);
+ return next;
+ })
+ }
>
- <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">
- {isEditingFiles ? "Done" : "Edit"}
- </Text>
- </Pressable>
- </View>
- </View>
-
- {allFiles.length === 0 ? (
- <Text className="text-foreground-secondary text-sm leading-normal">
- No changed files are available to commit.
- </Text>
- ) : !isEditingFiles ? (
- <View className="gap-2">
- {selectedFilePreview.map((file) => (
- <View key={file.path} className="flex-row items-center justify-between gap-3">
- <Text className="text-foreground flex-1 text-sm font-medium" numberOfLines={1}>
- {file.path}
+ <View
+ className={cn(
+ "size-5 items-center justify-center rounded-full",
+ included ? "bg-primary" : "border border-input-border",
+ )}
+ >
+ {included ? (
+ <SymbolView
+ name="checkmark"
+ size={13}
+ tintColorClassName="accent-primary-foreground"
+ />
+ ) : null}
+ </View>
+ <View className="flex-1 gap-1">
+ <Text
+ numberOfLines={1}
+ ellipsizeMode="middle"
+ className="text-sm font-t3-medium text-foreground"
+ >
+ {name}
</Text>
- <Text className="text-xs font-t3-bold text-adaptive-emerald-700-300">
+ {directory ? (
+ <Text
+ numberOfLines={1}
+ ellipsizeMode="middle"
+ className="text-xs text-foreground-muted"
+ >
+ {directory}
+ </Text>
+ ) : null}
+ </View>
+ <View className="flex-row gap-2">
+ <Text className="text-xs text-adaptive-emerald-700-300">
+{formatDiffCount(file.insertions)}
</Text>
- <Text className="text-xs font-t3-bold text-adaptive-rose-700-300">
- -{formatDiffCount(file.deletions)}
+ <Text className="text-xs text-adaptive-rose-700-300">
+ −{formatDiffCount(file.deletions)}
</Text>
</View>
- ))}
- {selectedFiles.length > selectedFilePreview.length ? (
- <Text className="text-foreground-muted text-xs leading-snug">
- +{selectedFiles.length - selectedFilePreview.length} more files
- </Text>
- ) : null}
- </View>
- ) : (
- <View className="gap-2">
- {allFiles.map((file) => {
- const included = !excludedFiles.has(file.path);
- return (
- <Pressable
- key={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",
- )}
- accessibilityRole="checkbox"
- accessibilityLabel={file.path}
- accessibilityState={{ checked: included }}
- onPress={() => {
- setExcludedFiles((current) => {
- const next = new Set(current);
- if (next.has(file.path)) {
- next.delete(file.path);
- } else {
- next.add(file.path);
- }
- return next;
- });
- }}
- >
- {Platform.OS !== "android" ? (
- <View
- className={`absolute inset-0 rounded-[18px] ${included ? "bg-card" : "bg-subtle"}`}
- />
- ) : null}
- <View className="flex-row items-start justify-between gap-3">
- {Platform.OS === "android" ? (
- <View
- className={cn(
- "mt-0.5 size-5 items-center justify-center rounded-sm",
- included ? "bg-primary" : "border border-input-border",
- )}
- >
- {included ? (
- <SymbolView
- name="checkmark"
- size={16}
- tintColorClassName="accent-primary-foreground"
- type="monochrome"
- />
- ) : null}
- </View>
- ) : null}
- <View className="flex-1 gap-1">
- <Text
- selectable
- className={`text-sm font-t3-bold ${included ? "text-foreground" : "text-foreground-muted"}`}
- >
- {file.path}
- </Text>
- {!included ? (
- <Text className="text-foreground-muted text-2xs leading-normal">
- Excluded from this commit
- </Text>
- ) : null}
- </View>
- <View className="items-end gap-1">
- <Text className="text-xs font-t3-bold text-adaptive-emerald-700-300">
- +{formatDiffCount(file.insertions)}
- </Text>
- <Text className="text-xs font-t3-bold text-adaptive-rose-700-300">
- -{formatDiffCount(file.deletions)}
- </Text>
- </View>
- </View>
- </Pressable>
- );
- })}
- </View>
- )}
- </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">
- Commit message
- </Text>
- <TextInput
- multiline
- accessibilityLabel="Commit message"
- value={dialogCommitMessage}
- 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]"
- />
- </View>
-
- <View className="android:gap-2 ios:flex-row ios:gap-3">
- <View className="ios:flex-1">
- <SheetActionButton
- icon="arrow.branch"
- label="Commit on new branch"
- disabled={!canChangeThreadBranch || noneSelected || busy}
- onPress={() => void runCommitAction(true)}
- />
- </View>
- <View className="ios:flex-1">
- <SheetActionButton
- icon="checkmark.circle"
- label="Commit"
- tone="primary"
- disabled={!canWriteSourceControl || noneSelected || busy}
- onPress={() => void runCommitAction(false)}
- />
- </View>
- </View>
- </ScrollView>
- </ScreenContent>
+ </Pressable>
+ );
+ })
+ )}
+ </View>
+ <View className="gap-2">
+ <Button
+ label="Commit changes"
+ icon="checkmark"
+ tone="primary"
+ fullWidth
+ disabled={!canWriteSourceControl || noneSelected || busy}
+ onPress={() => void runCommitAction(false)}
+ />
+ <Button
+ label="Commit on a new branch"
+ icon="arrow.branch"
+ tone="text"
+ fullWidth
+ disabled={!canWriteSourceControl || !canChangeThreadBranch || noneSelected || busy}
+ onPress={() => void runCommitAction(true)}
+ />
+ </View>
+ </ScrollView>
</View>
);
}
diff --git a/apps/mobile/src/features/threads/thread-work-log.tsx b/apps/mobile/src/features/threads/thread-work-log.tsx
index 93a59a53a3a..1b3c0b2efe2 100644
--- a/apps/mobile/src/features/threads/thread-work-log.tsx
+++ b/apps/mobile/src/features/threads/thread-work-log.tsx
@@ -1,3 +1,4 @@
+import { Button } from "../../components/ui/Button";
import { SubagentStatusDot } from "./SubagentStatusDot";
import { ThreadSubagentGroup } from "./thread-subagent-group";
import {
@@ -796,24 +797,23 @@ function WorkspacePreparationRetryButton(props: {
const [busy, setBusy] = useState(false);
if (!retryable) return null;
return (
- <Pressable
- accessibilityRole="button"
- accessibilityLabel="Retry workspace preparation"
- disabled={busy}
- onPress={() => {
- setBusy(true);
- void Haptics.selectionAsync();
- void retry({
- environmentId: props.environmentId,
- input: { threadId: props.threadId, runId: props.runId },
- }).finally(() => setBusy(false));
- }}
- className="ml-7 mt-2 min-h-11 flex-row items-center gap-1.5 self-start rounded-full border border-border px-4"
- style={{ opacity: busy ? 0.5 : 1 }}
- >
- <SymbolView name="arrow.clockwise" size={13} tintColorClassName="accent-icon" />
- <Text className="font-t3-medium text-sm text-foreground">Retry</Text>
- </Pressable>
+ <View className="ml-7 mt-2">
+ <Button
+ label="Retry"
+ tone="secondary"
+ accessibilityLabel="Retry workspace preparation"
+ disabled={busy}
+ onPress={() => {
+ setBusy(true);
+ void Haptics.selectionAsync();
+ void retry({
+ environmentId: props.environmentId,
+ input: { threadId: props.threadId, runId: props.runId },
+ }).finally(() => setBusy(false));
+ }}
+ icon="arrow.clockwise"
+ />
+ </View>
);
}
diff --git a/apps/mobile/src/features/threads/worktree-setup-card.tsx b/apps/mobile/src/features/threads/worktree-setup-card.tsx
index 345e421ef04..45a5bb9404d 100644
--- a/apps/mobile/src/features/threads/worktree-setup-card.tsx
+++ b/apps/mobile/src/features/threads/worktree-setup-card.tsx
@@ -1,3 +1,4 @@
+import { Button } from "../../components/ui/Button";
import {
worktreeSetupStageLabel,
type WorktreeSetupSnapshot,
@@ -229,28 +230,24 @@ function SetupDetailsSheet({
) : null}
{canCancel ? (
<View className="mt-3 flex-row items-center justify-end gap-4 border-t border-border pt-1">
- <Pressable
- accessibilityRole="button"
+ <Button
+ label="Cancel setup"
+ tone="danger"
accessibilityLabel="Cancel worktree setup"
onPress={() => {
onClose();
onCancel();
}}
- className="min-h-11 justify-center px-2"
- >
- <Text className="text-sm text-danger-foreground">Cancel setup</Text>
- </Pressable>
+ />
{onWorkLocally ? (
- <Pressable
- accessibilityRole="button"
+ <Button
+ label="Work locally"
+ tone="secondary"
onPress={() => {
onClose();
onWorkLocally();
}}
- className="min-h-11 justify-center px-2"
- >
- <Text className="text-sm text-foreground">Work locally</Text>
- </Pressable>
+ />
) : null}
</View>
) : null}