Skip to content
TypeScript

fix(mobile): standardize shared button states and adoption (#18530)

Julius Marminge2bcc5cc94d50
diff --git a/apps/mobile/src/components/MaterialButton.android.tsx b/apps/mobile/src/components/Button.android.tsx
similarity index 64%
rename from apps/mobile/src/components/MaterialButton.android.tsx
rename to apps/mobile/src/components/Button.android.tsx
index 0171ccbb3d8..1d891903421 100644
--- a/apps/mobile/src/components/MaterialButton.android.tsx
+++ b/apps/mobile/src/components/Button.android.tsx
@@ -1,10 +1,12 @@
+import { SymbolView } from "./AppSymbol";
import {
Box,
- Button,
+ Button as ComposeButton,
LoadingIndicator,
FilledTonalButton,
Host,
Row,
+ RNHostView,
Text,
TextButton,
} from "@expo/ui/jetpack-compose";
@@ -13,37 +15,42 @@ import { View } from "react-native";
import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole";
-import type { MaterialButtonProps } from "./MaterialButton";
+import type { ButtonProps } from "./Button";
import { useAndroidControlSizing } from "./useAndroidControlSizing";
-export function MaterialButton(props: MaterialButtonProps) {
+export function Button(props: ButtonProps) {
const { themeAppearance, themeVariables: colors } = useAppearancePreferences();
const typography = useScaledTextRole("footnote");
const { scale, mediumIconSize } = useAndroidControlSizing();
const tone = props.tone ?? "secondary";
const Component =
- tone === "text" ? TextButton : tone === "secondary" ? FilledTonalButton : Button;
+ tone === "text" ? TextButton : tone === "secondary" ? FilledTonalButton : ComposeButton;
const containerColor =
- tone === "primary"
- ? colors["--color-primary"]
- : tone === "danger"
- ? colors["--color-danger"]
- : tone === "text"
- ? "#00000000"
- : colors["--color-secondary"];
+ tone === "contrast"
+ ? colors["--color-foreground"]
+ : tone === "primary"
+ ? colors["--color-primary"]
+ : tone === "danger"
+ ? colors["--color-danger"]
+ : tone === "text"
+ ? "#00000000"
+ : colors["--color-secondary"];
const contentColor =
- tone === "primary"
- ? colors["--color-primary-foreground"]
- : tone === "danger"
- ? colors["--color-danger-foreground"]
- : tone === "text"
- ? colors["--color-primary-text"]
- : colors["--color-secondary-foreground"];
+ tone === "contrast"
+ ? colors["--color-screen"]
+ : tone === "primary"
+ ? colors["--color-primary-foreground"]
+ : tone === "danger"
+ ? colors["--color-danger-foreground"]
+ : tone === "text"
+ ? colors["--color-primary-text"]
+ : colors["--color-secondary-foreground"];
return (
<View
accessible
accessibilityRole="button"
accessibilityLabel={props.label}
+ accessibilityHint={props.accessibilityHint}
accessibilityState={{
disabled: Boolean(props.disabled || props.loading),
busy: Boolean(props.loading),
@@ -84,6 +91,21 @@ export function MaterialButton(props: MaterialButtonProps) {
/>
<Box modifiers={[size(8 * scale, 1)]} />
</>
+ ) : props.icon ? (
+ <>
+ <RNHostView matchContents modifiers={[size(mediumIconSize, mediumIconSize)]}>
+ <View style={{ width: mediumIconSize, height: mediumIconSize }}>
+ <SymbolView
+ name={props.icon}
+ size={mediumIconSize}
+ tintColor={
+ props.disabled ? colors["--color-foreground-muted"] : contentColor
+ }
+ />
+ </View>
+ </RNHostView>
+ <Box modifiers={[size(8 * scale, 1)]} />
+ </>
) : null}
<Text style={{ ...typography, fontWeight: "500" }}>{props.label}</Text>
</Row>
diff --git a/apps/mobile/src/components/MaterialButton.tsx b/apps/mobile/src/components/Button.tsx
similarity index 56%
rename from apps/mobile/src/components/MaterialButton.tsx
rename to apps/mobile/src/components/Button.tsx
index eddd7244cbe..1c63cddd37f 100644
--- a/apps/mobile/src/components/MaterialButton.tsx
+++ b/apps/mobile/src/components/Button.tsx
@@ -1,11 +1,15 @@
+import { SymbolView, type AppSymbolName } from "./AppSymbol";
import { Pressable } from "react-native";
+import { AppActivityIndicator } from "./AppActivityIndicator";
import { AppText } from "./AppText";
import { cn } from "../lib/cn";
-export interface MaterialButtonProps {
+export interface ButtonProps {
readonly label: string;
+ readonly icon?: AppSymbolName;
readonly onPress: () => void;
readonly disabled?: boolean;
+ readonly accessibilityHint?: string;
readonly loading?: boolean;
readonly tone?: "primary" | "secondary" | "danger" | "text" | "contrast";
readonly fullWidth?: boolean;
@@ -19,24 +23,37 @@ const TONE_CLASS_NAMES = {
text: ["bg-transparent", "text-primary-text"],
} as const;
-export function MaterialButton(props: MaterialButtonProps) {
+export function Button(props: ButtonProps) {
const [containerClassName, labelClassName] = TONE_CLASS_NAMES[props.tone ?? "secondary"];
const disabled = Boolean(props.disabled || props.loading);
return (
<Pressable
accessibilityRole="button"
- accessibilityState={{ disabled }}
+ accessibilityLabel={props.label}
+ accessibilityHint={props.accessibilityHint}
+ accessibilityState={{ disabled, busy: Boolean(props.loading) }}
disabled={disabled}
onPress={props.onPress}
className={cn(
- "min-h-12 justify-center rounded-full px-6 active:opacity-70",
+ "min-h-12 flex-row items-center justify-center gap-2 rounded-full px-6 active:opacity-70",
props.fullWidth ? "w-full" : "self-start",
disabled ? "bg-subtle-strong" : containerClassName,
)}
>
+ {props.loading ? (
+ <AppActivityIndicator colorClassName="accent-foreground-muted" />
+ ) : props.icon ? (
+ <SymbolView
+ name={props.icon}
+ size={18}
+ tintColorClassName={
+ disabled ? "accent-foreground-muted" : labelClassName.replace("text-", "accent-")
+ }
+ />
+ ) : null}
<AppText
className={cn(
- "text-center font-t3-medium",
+ "min-w-0 shrink text-center font-t3-medium",
disabled ? "text-foreground-muted" : labelClassName,
)}
>
diff --git a/apps/mobile/src/components/ControlPill.tsx b/apps/mobile/src/components/ControlPill.tsx
index 95a8feb10a2..3e31b4a9967 100644
--- a/apps/mobile/src/components/ControlPill.tsx
+++ b/apps/mobile/src/components/ControlPill.tsx
@@ -4,7 +4,7 @@ import { cn } from "../lib/cn";
import { SymbolView } from "./AppSymbol";
import { AppText as Text } from "./AppText";
import { MaterialIconButton } from "./MaterialIconButton";
-import { MaterialButton } from "./MaterialButton";
+import { Button } from "./Button";
import { useAndroidControlSizing } from "./useAndroidControlSizing";
export { ControlPillMenu } from "./ControlPillMenu";
@@ -91,7 +91,7 @@ export function ControlPill(props: {
(!props.accessibilityLabel || props.accessibilityLabel === props.label)
) {
return (
- <MaterialButton
+ <Button
label={props.label}
onPress={props.onPress}
disabled={props.disabled}
diff --git a/apps/mobile/src/components/EmptyState.tsx b/apps/mobile/src/components/EmptyState.tsx
index 5fb4ce08f2f..24aa0242b28 100644
--- a/apps/mobile/src/components/EmptyState.tsx
+++ b/apps/mobile/src/components/EmptyState.tsx
@@ -1,7 +1,8 @@
-import { Pressable, View } from "react-native";
+import { View } from "react-native";
import type { ReactNode } from "react";
import { AppText as Text } from "./AppText";
+import { Button } from "./Button";
export function EmptyState(props: {
readonly title: string;
@@ -21,14 +22,9 @@ export function EmptyState(props: {
{props.action ? (
<View className="mt-5">{props.action}</View>
) : props.actionLabel && props.onAction ? (
- <Pressable
- className="mt-5 rounded-full bg-primary px-5 py-3 active:opacity-70"
- onPress={props.onAction}
- >
- <Text className="text-sm font-t3-bold text-primary-foreground">
- {props.actionLabel}
- </Text>
- </Pressable>
+ <View className="mt-5">
+ <Button tone="primary" label={props.actionLabel} onPress={props.onAction} />
+ </View>
) : null}
</View>
);
@@ -43,12 +39,9 @@ export function EmptyState(props: {
{props.action ? (
<View className="mt-4 self-start">{props.action}</View>
) : props.actionLabel && props.onAction ? (
- <Pressable
- className="mt-4 self-start rounded-full bg-primary px-4 py-2.5 active:opacity-70"
- onPress={props.onAction}
- >
- <Text className="text-sm font-t3-bold text-primary-foreground">{props.actionLabel}</Text>
- </Pressable>
+ <View className="mt-4 self-start">
+ <Button tone="primary" label={props.actionLabel} onPress={props.onAction} />
+ </View>
) : null}
</View>
);
diff --git a/apps/mobile/src/components/RenderErrorBoundary.tsx b/apps/mobile/src/components/RenderErrorBoundary.tsx
index 9b71916d01e..f06cd350b9f 100644
--- a/apps/mobile/src/components/RenderErrorBoundary.tsx
+++ b/apps/mobile/src/components/RenderErrorBoundary.tsx
@@ -2,7 +2,7 @@ import { Component, type ReactNode } from "react";
import { ScrollView, View } from "react-native";
import { AppText as Text } from "./AppText";
-import { MaterialButton } from "./MaterialButton";
+import { Button } from "./Button";
import { copyTextWithHaptic } from "../lib/copyTextWithHaptic";
interface RenderErrorBoundaryProps {
@@ -107,19 +107,14 @@ export function RenderFailureView(
{props.details.split("\n", 1)[0]?.slice(0, 300)}
</Text>
<View className="w-full max-w-xs gap-2">
- <MaterialButton label="Try again" onPress={props.retry} tone="primary" fullWidth />
- <MaterialButton
+ <Button label="Try again" onPress={props.retry} tone="primary" fullWidth />
+ <Button
label="Copy details"
onPress={() => copyTextWithHaptic(props.details, { target: "error details" })}
fullWidth
/>
{props.exit ? (
- <MaterialButton
- label={props.exit.label}
- onPress={props.exit.onPress}
- tone="text"
- fullWidth
- />
+ <Button label={props.exit.label} onPress={props.exit.onPress} tone="text" fullWidth />
) : null}
</View>
</ScrollView>
diff --git a/apps/mobile/src/features/connection/ConnectionEnvironmentRow.tsx b/apps/mobile/src/features/connection/ConnectionEnvironmentRow.tsx
index ad02b885be8..a8315c451b6 100644
--- a/apps/mobile/src/features/connection/ConnectionEnvironmentRow.tsx
+++ b/apps/mobile/src/features/connection/ConnectionEnvironmentRow.tsx
@@ -11,7 +11,7 @@ import Animated, { FadeIn, FadeOut, LinearTransition } from "react-native-reanim
import { AppText as Text } from "../../components/AppText";
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
-import { MaterialButton } from "../../components/MaterialButton";
+import { Button } from "../../components/Button";
import { MaterialIconButton } from "../../components/MaterialIconButton";
import { ThemedSwitch } from "../../components/ThemedSwitch";
import { cn } from "../../lib/cn";
@@ -185,7 +185,7 @@ export function ConnectionEnvironmentRow(props: {
<View className="flex-row items-center justify-end gap-2">
{props.environment.isRelayManaged ? null : (
<View className="flex-1">
- <MaterialButton
+ <Button
label="Save"
tone="primary"
fullWidth
diff --git a/apps/mobile/src/features/projects/AddProjectScreen.test.ts b/apps/mobile/src/features/projects/AddProjectScreen.test.ts
index cc3bd1b2adc..8c91b93d332 100644
--- a/apps/mobile/src/features/projects/AddProjectScreen.test.ts
+++ b/apps/mobile/src/features/projects/AddProjectScreen.test.ts
@@ -25,7 +25,7 @@ vi.mock("react", async (importOriginal) => ({
useEffect: () => {},
}));
vi.mock("../../components/MaterialListRow", () => ({ MaterialListRow: "MaterialListRow" }));
-vi.mock("../../components/MaterialButton", () => ({ MaterialButton: "MaterialButton" }));
+vi.mock("../../components/Button", () => ({ Button: "Button" }));
vi.mock("../../components/ScreenScrollView", () => ({ ScreenScrollView: "ScrollView" }));
vi.mock("../settings/components/SettingsScreen", () => ({ SettingsScreen: "SettingsScreen" }));
vi.mock("../../components/ThemedSwitch", () => ({ ThemedSwitch: "Switch" }));
diff --git a/apps/mobile/src/features/projects/AddProjectScreen.tsx b/apps/mobile/src/features/projects/AddProjectScreen.tsx
index 39fc4e23e0c..5ec2010f617 100644
--- a/apps/mobile/src/features/projects/AddProjectScreen.tsx
+++ b/apps/mobile/src/features/projects/AddProjectScreen.tsx
@@ -2,7 +2,7 @@ import { AppActivityIndicator } from "../../components/AppActivityIndicator";
import { MaterialListRow } from "../../components/MaterialListRow";
import { SettingsScreen } from "../settings/components/SettingsScreen";
import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
-import { MaterialButton } from "../../components/MaterialButton";
+import { Button } from "../../components/Button";
import {
addProjectRemoteSourceLabel,
addProjectRemoteSourcePathHint,
@@ -263,7 +263,7 @@ function PrimaryActionButton(props: {
readonly loading?: boolean;
readonly onPress: () => void;
}) {
- if (Platform.OS === "android") return <MaterialButton {...props} tone="primary" fullWidth />;
+ if (Platform.OS === "android") return <Button {...props} tone="primary" fullWidth />;
return (
<Pressable
disabled={props.disabled}
diff --git a/apps/mobile/src/features/pull-requests/PullRequestControls.tsx b/apps/mobile/src/features/pull-requests/PullRequestControls.tsx
index 804be98dfc4..70336cacd58 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestControls.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestControls.tsx
@@ -7,7 +7,7 @@ import { Platform, Pressable, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { AppText as Text } from "../../components/AppText";
import { SymbolView, type AppSymbolName } from "../../components/AppSymbol";
-import { MaterialButton } from "../../components/MaterialButton";
+import { Button } from "../../components/Button";
import { MaterialIconButton } from "../../components/MaterialIconButton";
import { MaterialFloatingToolbar } from "./MaterialFloatingToolbar";
import { ControlPillMenu } from "../../components/ControlPillMenu";
@@ -137,7 +137,7 @@ export function PullRequestActionToolbar(props: {
const showPrimary = pendingReview || canOpenThread;
if (Platform.OS === "android") {
const primary = (
- <MaterialButton
+ <Button
label={primaryLabel}
tone="primary"
disabled={primaryDisabled}
diff --git a/apps/mobile/src/features/pull-requests/PullRequestDiscussionScreen.tsx b/apps/mobile/src/features/pull-requests/PullRequestDiscussionScreen.tsx
index 45bd8de8d08..25ff1f09d52 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestDiscussionScreen.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestDiscussionScreen.tsx
@@ -9,7 +9,7 @@ import { NativeScrollViewMarker as ScrollViewMarker } from "../../native/NativeS
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
-import { MaterialButton } from "../../components/MaterialButton";
+import { Button } from "../../components/Button";
import { GlassSurface } from "../../components/GlassSurface";
import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
import { relativeTime } from "../../lib/time";
@@ -174,7 +174,7 @@ function Discussion({ params }: { params: PullRequestParams & { readonly discuss
{thread.isResolved ? "Resolved" : "Unresolved"}
{thread.isOutdated ? " · Outdated" : ""}
</Text>
- <MaterialButton
+ <Button
label="View file diff"
onPress={() =>
navigation.navigate("PullRequestFile", { ...params, path: thread.path })
@@ -199,7 +199,7 @@ function Discussion({ params }: { params: PullRequestParams & { readonly discuss
</View>
))}
{nextCursor ? (
- <MaterialButton
+ <Button
label={busy ? "Loading…" : "Load more replies"}
disabled={busy}
onPress={() => void more()}
@@ -232,7 +232,7 @@ function Discussion({ params }: { params: PullRequestParams & { readonly discuss
className="max-h-36 min-h-12 min-w-0 flex-1 rounded-[24px] border-0 bg-transparent px-4 py-3 text-base text-foreground"
/>
<View>
- <MaterialButton
+ <Button
label={busy ? "Posting…" : "Reply"}
tone="contrast"
disabled={busy || !body.trim()}
diff --git a/apps/mobile/src/features/pull-requests/PullRequestFiles.tsx b/apps/mobile/src/features/pull-requests/PullRequestFiles.tsx
index 0e4b8d7b69b..1724bd0d8df 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestFiles.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestFiles.tsx
@@ -8,7 +8,7 @@ import { ActivityIndicator, Pressable, View } from "react-native";
import { AppText as Text } from "../../components/AppText";
import { EmptyState } from "../../components/EmptyState";
import { ControlPillMenu } from "../../components/ControlPillMenu";
-import { MaterialButton } from "../../components/MaterialButton";
+import { Button } from "../../components/Button";
import { MaterialIconButton } from "../../components/MaterialIconButton";
import { SymbolView } from "../../components/AppSymbol";
import { PierreEntryIcon } from "../../components/PierreEntryIcon";
@@ -242,13 +242,7 @@ export function usePullRequestFilesContent(props: {
result.nextCursor ? "No non-test files loaded yet" : "Only test files changed"
}
detail="Test files are hidden from this review."
- action={
- <MaterialButton
- label="Show test files"
- tone="contrast"
- onPress={filter.showAll}
- />
- }
+ action={<Button label="Show test files" tone="contrast" onPress={filter.showAll} />}
variant="plain"
/>
) : null}
diff --git a/apps/mobile/src/features/pull-requests/PullRequestInlineCommentScreen.tsx b/apps/mobile/src/features/pull-requests/PullRequestInlineCommentScreen.tsx
index 5a987134361..649a0978e87 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestInlineCommentScreen.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestInlineCommentScreen.tsx
@@ -3,7 +3,7 @@ import { useCallback, useRef, useState } from "react";
import { Alert, View } from "react-native";
import type { PullRequestReviewPosition } from "@t3tools/contracts";
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
-import { MaterialButton } from "../../components/MaterialButton";
+import { Button } from "../../components/Button";
import { uuidv4 } from "../../lib/uuid";
import { composerPullRequests } from "../../state/pull-requests";
import { useEnvironmentQuery } from "../../state/query";
@@ -77,7 +77,7 @@ export function PullRequestInlineCommentScreen({ route }: StaticScreenProps<Inli
title={saved ? "Edit review comment" : "Review comment"}
subtitle={`#${params.number} · ${reviewPositionLabel(params.position)}`}
footer={
- <MaterialButton
+ <Button
fullWidth
tone="contrast"
label={busy ? "Saving…" : "Save draft"}
@@ -125,7 +125,7 @@ export function PullRequestInlineCommentScreen({ route }: StaticScreenProps<Inli
<Text className="text-sm text-danger-foreground">{store.error ?? detail.error}</Text>
) : null}
{saved ? (
- <MaterialButton
+ <Button
label="Delete draft"
onPress={() =>
Alert.alert("Delete this draft?", "Your other review comments will be kept.", [
diff --git a/apps/mobile/src/features/pull-requests/PullRequestMergeControls.tsx b/apps/mobile/src/features/pull-requests/PullRequestMergeControls.tsx
index 84247a98219..b21ed26a72d 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestMergeControls.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestMergeControls.tsx
@@ -7,7 +7,7 @@ import { ActivityIndicator, Alert, Platform, Pressable, View } from "react-nativ
import { AppText as Text } from "../../components/AppText";
import { SymbolView } from "../../components/AppSymbol";
import { ControlPillMenu } from "../../components/ControlPillMenu";
-import { MaterialButton } from "../../components/MaterialButton";
+import { Button } from "../../components/Button";
import { MaterialIconButton } from "../../components/MaterialIconButton";
import { mobilePreferencesAtom, updateMobilePreferencesAtom } from "../../state/preferences";
import { composerPullRequests } from "../../state/pull-requests";
@@ -174,7 +174,7 @@ export function PullRequestMergeControls(props: {
>
{Platform.OS === "android" ? (
<View className="min-w-0 flex-1">
- <MaterialButton
+ <Button
label={busy ? "Working…" : !permissions.connected ? "Reconnect to merge" : label}
tone="primary"
fullWidth
diff --git a/apps/mobile/src/features/pull-requests/PullRequestReviewSheet.tsx b/apps/mobile/src/features/pull-requests/PullRequestReviewSheet.tsx
index 539775aa44d..eb01433e524 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestReviewSheet.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestReviewSheet.tsx
@@ -10,7 +10,7 @@ import { clearSubmittedReview } from "./pullRequestReviewDrafts";
import { usePullRequestReviewDraft } from "./usePullRequestReviewDraft";
import { reviewPositionLabel } from "./pullRequestDiffComments";
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
-import { MaterialButton } from "../../components/MaterialButton";
+import { Button } from "../../components/Button";
import { SegmentedControl } from "../../components/SegmentedControl";
import { composerPullRequests } from "../../state/pull-requests";
import { useEnvironmentQuery } from "../../state/query";
@@ -134,7 +134,7 @@ export function PullRequestReviewSheet({
subtitle={`#${params.number}${reviewing && result.data?.headSha ? ` · reviewing ${result.data.headSha.slice(0, 7)}` : ` · ${params.repository}`}`}
busy={submission.busy}
footer={
- <MaterialButton
+ <Button
label={
submission.busy
? "Submitting…"
diff --git a/apps/mobile/src/features/pull-requests/PullRequestReviewersScreen.tsx b/apps/mobile/src/features/pull-requests/PullRequestReviewersScreen.tsx
index 597cf63b910..06a99791ae8 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestReviewersScreen.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestReviewersScreen.tsx
@@ -18,7 +18,7 @@ import { ScrollViewMarker } from "react-native-screens";
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
import { EmptyState } from "../../components/EmptyState";
-import { MaterialButton } from "../../components/MaterialButton";
+import { Button } from "../../components/Button";
import { SymbolView } from "../../components/AppSymbol";
import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
import { useNativeLayoutMetrics } from "../../native/native-layout-metrics";
@@ -259,7 +259,7 @@ export function PullRequestReviewersScreen({ route }: StaticScreenProps<PullRequ
detail={result.error ?? "Search people and teams with access to this repository."}
variant="plain"
/>
- {result.error ? <MaterialButton label="Retry" onPress={result.refresh} /> : null}
+ {result.error ? <Button label="Retry" onPress={result.refresh} /> : null}
</View>
)
}
@@ -302,13 +302,13 @@ export function PullRequestReviewersScreen({ route }: StaticScreenProps<PullRequ
autoCorrect={false}
className="min-h-12 rounded-xl bg-grouped-card px-3 text-base"
/>
- <MaterialButton
+ <Button
label="Request review"
fullWidth
disabled={!allowed || !query.trim() || pending !== null}
onPress={() => void update({ id: query.trim(), kind: "user", isRequested: false })}
/>
- <MaterialButton
+ <Button
label="Remove review request"
fullWidth
tone="text"
diff --git a/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx b/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
index f68a19bbf28..5afd705aae8 100644
--- a/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
+++ b/apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx
@@ -26,7 +26,7 @@ import {
import * as Clipboard from "expo-clipboard";
import { ControlPillMenu } from "../../components/ControlPillMenu";
import { MaterialIconButton } from "../../components/MaterialIconButton";
-import { MaterialButton } from "../../components/MaterialButton";
+import { Button } from "../../components/Button";
import { usePullRequestReviewDraft } from "./usePullRequestReviewDraft";
import { usePullRequestFilesViewed } from "./usePullRequestFilesViewed";
import { usePullRequestPermissions } from "./usePullRequestPermissions";
@@ -1088,7 +1088,7 @@ export function PullRequestFileRouteScreen({
<Text className="min-w-0 flex-1 text-xs text-foreground-muted">
The branch changed. Reload before adding line comments.
</Text>
- <MaterialButton
+ <Button
label="Reload changes"
onPress={() => {
result.refresh();
@@ -1196,9 +1196,7 @@ export function PullRequestFileRouteScreen({
<EmptyState
title="Only test files changed"
detail="Test files are hidden from this review."
- action={
- <MaterialButton label="Show test files" tone="contrast" onPress={filter.showAll} />
- }
+ action={<Button label="Show test files" tone="contrast" onPress={filter.showAll} />}
variant="plain"
/>
</View>
diff --git a/apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx
index e906b33020a..674529ba024 100644
--- a/apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx
+++ b/apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx
@@ -39,6 +39,7 @@ import type { NativeStackNavigationProp } from "@react-navigation/native-stack";
import { Alert, AppState, Platform, Pressable, TextInput as RNTextInput, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
+import { Button } from "../../components/Button";
import { AppText as Text } from "../../components/AppText";
import { SymbolView } from "../../components/AppSymbol";
import {
@@ -695,338 +696,338 @@ function TaskForm({
};
return (
- <View
- className="gap-5"
- pointerEvents={saving ? "none" : "auto"}
- accessibilityElementsHidden={saving}
- importantForAccessibility={saving ? "no-hide-descendants" : "auto"}
- >
- {taskMissing ? (
- <Text className="px-1 text-base text-danger-foreground">This task no longer exists.</Text>
- ) : null}
-
- {environmentUnavailable ? (
- <Text className="px-1 text-base text-danger-foreground">
- This environment is disconnected. Reconnect before saving.
- </Text>
- ) : null}
- <SettingsSection>
- <SelectRow
- label="Runs on"
- value={environmentLabel}
- valueIcon={
- <EnvironmentMachineSymbol
- kind={resolveEnvironmentMachineKind(config)}
- size={18}
- tintColorClassName="accent-foreground-muted"
- />
- }
- actions={
- draft.task || saving || dictationPending
- ? []
- : availableTargets.map((target) => ({
- id: target.environmentId,
- title: target.label,
- image:
- ENVIRONMENT_MACHINE_SYMBOLS[resolveEnvironmentMachineKind(target.serverConfig)],
- state: target.environmentId === environmentId ? "on" : undefined,
- }))
- }
- onSelect={(id) => {
- const target = availableTargets.find((entry) => entry.environmentId === id);
- if (target) onChangeEnvironment(target);
- }}
- />
- </SettingsSection>
- <SettingsSection title="Task">
- <FormField
- label="Name"
- disabled={saving}
- value={draft.title}
- placeholder="Check for issues"
- onChange={(title) => setDraft({ ...draft, title })}
- />
- {promptField}
- </SettingsSection>
-
- <SettingsSection title="Context">
- <SelectRow
- label="Project"
- value={
- projects.find((project) => project.id === draft.projectId)?.title ??
- (projects.length ? "Choose project" : "No projects available")
- }
- actions={projects.map((project) => ({
- id: project.id,
- title: project.title,
- state: project.id === draft.projectId ? "on" : undefined,
- }))}
- onSelect={(id) => {
- const project = projects.find((item) => item.id === id);
- if (!project) return;
- const keepsExplicitModel =
- draft.modelSelectionIsExplicit &&
- (draft.modelSelection === null ||
- !config?.settings ||
- resolveProjectProviderInstanceEnabled(
- config.settings,
- project.id,
- draft.modelSelection.instanceId,
- ));
- setDraft({
- ...draft,
- projectId: project.id,
- modelSelection: keepsExplicitModel
- ? draft.modelSelection
- : scheduledTaskDefaultModel(config, project),
- modelSelectionIsExplicit: keepsExplicitModel,
- });
- }}
- />
- <PickerRow
- label="Model"
- borderTop
- value={
- modelOptions.find(
- (option) =>
- option.selection.instanceId === draft.modelSelection?.instanceId &&
- option.selection.model === draft.modelSelection?.model,
- )?.label ??
- draft.modelSelection?.model ??
- (modelOptions.length ? "Choose model" : "No models available")
- }
- onPress={() => navigation.navigate("SettingsScheduledTaskModel")}
- disabled={saving || dictationPending || environmentUnavailable}
- />
- </SettingsSection>
+ <View className="gap-5">
+ <View
+ className="gap-5"
+ pointerEvents={saving ? "none" : "auto"}
+ accessibilityElementsHidden={saving}
+ importantForAccessibility={saving ? "no-hide-descendants" : "auto"}
+ >
+ {taskMissing ? (
+ <Text className="px-1 text-base text-danger-foreground">This task no longer exists.</Text>
+ ) : null}
- <SettingsSection title="Workspace">
- <SelectRow
- label="Run in"
- value={
- draft.workspace === "worktree"
- ? "New worktree"
- : draft.workspace === "root"
- ? "Project checkout"
- : "Specific checkout"
- }
- actions={[
- {
- id: "worktree",
- title: "New worktree",
- state: draft.workspace === "worktree" ? "on" : undefined,
- },
- {
- id: "root",
- title: "Project checkout",
- state: draft.workspace === "root" ? "on" : undefined,
- },
- {
- id: "existing_worktree",
- title: "Specific checkout",
- state: draft.workspace === "existing_worktree" ? "on" : undefined,
- },
- ]}
- onSelect={(id) => {
- if (id === "worktree" || id === "root" || id === "existing_worktree")
- setDraft({ ...draft, workspace: id });
- }}
- />
- {draft.workspace === "worktree" ? (
- <PickerRow
- label="Base branch"
- value={resolveNewTaskBranchLabel({
- branchName: draft.baseRef,
- startFromOrigin: draft.startFromOrigin,
- workspaceMode: "worktree",
- })}
- borderTop
- disabled={!draft.projectId || saving || dictationPending || environmentUnavailable}
- onPress={() => navigation.navigate("SettingsScheduledTaskBranch")}
- />
+ {environmentUnavailable ? (
+ <Text className="px-1 text-base text-danger-foreground">
+ This environment is disconnected. Reconnect before saving.
+ </Text>
) : null}
- {draft.workspace === "existing_worktree" ? (
+ <SettingsSection>
+ <SelectRow
+ label="Runs on"
+ value={environmentLabel}
+ valueIcon={
+ <EnvironmentMachineSymbol
+ kind={resolveEnvironmentMachineKind(config)}
+ size={18}
+ tintColorClassName="accent-foreground-muted"
+ />
+ }
+ actions={
+ draft.task || saving || dictationPending
+ ? []
+ : availableTargets.map((target) => ({
+ id: target.environmentId,
+ title: target.label,
+ image:
+ ENVIRONMENT_MACHINE_SYMBOLS[
+ resolveEnvironmentMachineKind(target.serverConfig)
+ ],
+ state: target.environmentId === environmentId ? "on" : undefined,
+ }))
+ }
+ onSelect={(id) => {
+ const target = availableTargets.find((entry) => entry.environmentId === id);
+ if (target) onChangeEnvironment(target);
+ }}
+ />
+ </SettingsSection>
+ <SettingsSection title="Task">
<FormField
- label="Checkout path"
+ label="Name"
disabled={saving}
- value={draft.checkoutPath}
- borderTop
- onChange={(checkoutPath) => setDraft({ ...draft, checkoutPath })}
+ value={draft.title}
+ placeholder="Check for issues"
+ onChange={(title) => setDraft({ ...draft, title })}
/>
- ) : null}
- </SettingsSection>
+ {promptField}
+ </SettingsSection>
- <SettingsSection title="Schedule">
- <View className="px-4 py-3">
- <SegmentedControl
- options={[
- { value: "fixed_time", label: "At a time" },
- { value: "interval", label: "Interval" },
- { value: "webhook", label: "On webhook" },
- ]}
- selected={draft.schedule.mode}
- onSelect={(mode) => {
- setTimePickerOpen(false);
+ <SettingsSection title="Context">
+ <SelectRow
+ label="Project"
+ value={
+ projects.find((project) => project.id === draft.projectId)?.title ??
+ (projects.length ? "Choose project" : "No projects available")
+ }
+ actions={projects.map((project) => ({
+ id: project.id,
+ title: project.title,
+ state: project.id === draft.projectId ? "on" : undefined,
+ }))}
+ onSelect={(id) => {
+ const project = projects.find((item) => item.id === id);
+ if (!project) return;
+ const keepsExplicitModel =
+ draft.modelSelectionIsExplicit &&
+ (draft.modelSelection === null ||
+ !config?.settings ||
+ resolveProjectProviderInstanceEnabled(
+ config.settings,
+ project.id,
+ draft.modelSelection.instanceId,
+ ));
setDraft({
...draft,
- prompt:
- mode === "webhook" && !draft.prompt.trim()
- ? DEFAULT_WEBHOOK_PROMPT
- : draft.prompt,
- schedule: { ...draft.schedule, mode },
+ projectId: project.id,
+ modelSelection: keepsExplicitModel
+ ? draft.modelSelection
+ : scheduledTaskDefaultModel(config, project),
+ modelSelectionIsExplicit: keepsExplicitModel,
});
}}
/>
- </View>
- {draft.schedule.mode === "fixed_time" ? (
- <>
- <Pressable
- accessibilityRole="button"
- accessibilityLabel={`Time, ${formatTime(draft.schedule.timeOfDay)}`}
- onPress={() => setTimePickerOpen((open) => !open)}
- className="min-h-14 flex-row items-center gap-3 border-t border-border-subtle px-4 py-3 active:opacity-70"
- >
- <Text className="text-lg text-foreground">Time</Text>
- <Text className="min-w-0 flex-1 text-right text-base text-foreground-muted">
- {formatTime(draft.schedule.timeOfDay)}
- </Text>
- <SymbolView
- name="chevron.right"
- size={14}
- tintColorClassName="accent-chevron"
- type="monochrome"
- />
- </Pressable>
- {timePickerOpen ? (
- <DateTimePicker
- value={timePickerValue(draft.schedule.timeOfDay)}
- mode="time"
- display={Platform.OS === "ios" ? "spinner" : "default"}
- onDismiss={() => setTimePickerOpen(false)}
- onValueChange={(_, selected) => {
- const timeOfDay = `${String(selected.getHours()).padStart(2, "0")}:${String(selected.getMinutes()).padStart(2, "0")}`;
- setDraft({ ...draft, schedule: { ...draft.schedule, timeOfDay } });
- }}
- />
- ) : null}
- <SelectRow
- label="Repeat"
- value={repeatLabel(draft.schedule.weekdays)}
+ <PickerRow
+ label="Model"
+ borderTop
+ value={
+ modelOptions.find(
+ (option) =>
+ option.selection.instanceId === draft.modelSelection?.instanceId &&
+ option.selection.model === draft.modelSelection?.model,
+ )?.label ??
+ draft.modelSelection?.model ??
+ (modelOptions.length ? "Choose model" : "No models available")
+ }
+ onPress={() => navigation.navigate("SettingsScheduledTaskModel")}
+ disabled={saving || dictationPending || environmentUnavailable}
+ />
+ </SettingsSection>
+
+ <SettingsSection title="Workspace">
+ <SelectRow
+ label="Run in"
+ value={
+ draft.workspace === "worktree"
+ ? "New worktree"
+ : draft.workspace === "root"
+ ? "Project checkout"
+ : "Specific checkout"
+ }
+ actions={[
+ {
+ id: "worktree",
+ title: "New worktree",
+ state: draft.workspace === "worktree" ? "on" : undefined,
+ },
+ {
+ id: "root",
+ title: "Project checkout",
+ state: draft.workspace === "root" ? "on" : undefined,
+ },
+ {
+ id: "existing_worktree",
+ title: "Specific checkout",
+ state: draft.workspace === "existing_worktree" ? "on" : undefined,
+ },
+ ]}
+ onSelect={(id) => {
+ if (id === "worktree" || id === "root" || id === "existing_worktree")
+ setDraft({ ...draft, workspace: id });
+ }}
+ />
+ {draft.workspace === "worktree" ? (
+ <PickerRow
+ label="Base branch"
+ value={resolveNewTaskBranchLabel({
+ branchName: draft.baseRef,
+ startFromOrigin: draft.startFromOrigin,
+ workspaceMode: "worktree",
+ })}
borderTop
- actions={[
- {
- id: "every_day",
- title: "Every day",
- state: draft.schedule.weekdays.length === 7 ? "on" : undefined,
- },
- {
- id: "weekdays",
- title: "Weekdays",
- state: repeatLabel(draft.schedule.weekdays) === "Weekdays" ? "on" : undefined,
- },
- ...DAYS.map((day) => ({
- id: String(day.index),
- title: day.label,
- attributes: { keepsMenuPresented: true },
- state: draft.schedule.weekdays.includes(day.index) ? ("on" as const) : undefined,
- })),
- ]}
- onSelect={(id) => {
- const weekdays =
- id === "every_day"
- ? DAYS.map((day) => day.index)
- : id === "weekdays"
- ? [1, 2, 3, 4, 5]
- : (() => {
- const day = DAYS.find((item) => String(item.index) === id);
- if (!day) return draft.schedule.weekdays;
- return draft.schedule.weekdays.includes(day.index)
- ? draft.schedule.weekdays.filter((index) => index !== day.index)
- : [...draft.schedule.weekdays, day.index];
- })();
- setDraft({ ...draft, schedule: { ...draft.schedule, weekdays } });
- }}
- />
- </>
- ) : draft.schedule.mode === "webhook" ? (
- <>
- <WebhookScheduleDetails
- environmentId={environmentId}
- // The live row, so a rotated URL shows up without reopening the form.
- // Once the list has loaded, a missing task is gone; don't keep showing its URL.
- task={
- tasks.data
- ? (tasks.data.tasks.find((task) => task.id === draft.task?.id) ?? null)
- : draft.task
- }
- signatureConfigured={draft.schedule.signature !== null}
- disabled={!canOperate || saving || environmentUnavailable}
+ disabled={!draft.projectId || saving || dictationPending || environmentUnavailable}
+ onPress={() => navigation.navigate("SettingsScheduledTaskBranch")}
/>
+ ) : null}
+ {draft.workspace === "existing_worktree" ? (
<FormField
- label="Skip requests older than (minutes)"
- value={draft.schedule.maxDeliveryAgeMinutes}
- placeholder="Run every request"
- keyboardType="number-pad"
+ label="Checkout path"
disabled={saving}
+ value={draft.checkoutPath}
borderTop
- onChange={(maxDeliveryAgeMinutes) =>
- setDraft({ ...draft, schedule: { ...draft.schedule, maxDeliveryAgeMinutes } })
- }
+ onChange={(checkoutPath) => setDraft({ ...draft, checkoutPath })}
/>
- </>
- ) : (
- <>
- <FormField
- label="Minutes between runs"
- value={draft.schedule.intervalMinutes}
- keyboardType="decimal-pad"
- disabled={saving}
- borderTop
- onChange={(intervalMinutes) =>
- setDraft({ ...draft, schedule: { ...draft.schedule, intervalMinutes } })
- }
+ ) : null}
+ </SettingsSection>
+
+ <SettingsSection title="Schedule">
+ <View className="px-4 py-3">
+ <SegmentedControl
+ options={[
+ { value: "fixed_time", label: "At a time" },
+ { value: "interval", label: "Interval" },
+ { value: "webhook", label: "On webhook" },
+ ]}
+ selected={draft.schedule.mode}
+ onSelect={(mode) => {
+ setTimePickerOpen(false);
+ setDraft({
+ ...draft,
+ prompt:
+ mode === "webhook" && !draft.prompt.trim()
+ ? DEFAULT_WEBHOOK_PROMPT
+ : draft.prompt,
+ schedule: { ...draft.schedule, mode },
+ });
+ }}
/>
- {Number(draft.schedule.intervalMinutes) < 1 ? (
- <Text className="px-4 pb-3 text-sm text-danger-foreground">
- Intervals must be at least 1 minute. Update this interval before saving.
- </Text>
- ) : draft.task?.schedule.type === "interval" && draft.task.schedule.everyMs < 60_000 ? (
- <Text className="px-4 pb-3 text-sm text-foreground-muted">
- This task previously ran more than once per minute. Saving requires an interval of
- at least 1 minute.
- </Text>
- ) : null}
- </>
- )}
- <View className="min-h-14 flex-row items-center gap-3 border-t border-border-subtle px-4 py-3">
- <Text className="min-w-0 flex-1 text-lg text-foreground">Enabled</Text>
- <ThemedSwitch
- accessibilityLabel="Task enabled"
- value={draft.enabled}
- onValueChange={(enabled) => setDraft({ ...draft, enabled })}
- />
- </View>
- </SettingsSection>
- {draft.schedule.mode === "fixed_time" ? (
- <Text className="px-2 text-sm text-foreground-muted">
- Time uses the environment's time zone, which may differ from your phone's.
- </Text>
- ) : null}
- <Pressable
- accessibilityRole="button"
- accessibilityState={{
- disabled: saving || dictationPending || taskMissing || environmentUnavailable,
- }}
- disabled={
- !canOperate || saving || dictationPending || taskMissing || environmentUnavailable
- }
+ </View>
+ {draft.schedule.mode === "fixed_time" ? (
+ <>
+ <Pressable
+ accessibilityRole="button"
+ accessibilityLabel={`Time, ${formatTime(draft.schedule.timeOfDay)}`}
+ onPress={() => setTimePickerOpen((open) => !open)}
+ className="min-h-14 flex-row items-center gap-3 border-t border-border-subtle px-4 py-3 active:opacity-70"
+ >
+ <Text className="text-lg text-foreground">Time</Text>
+ <Text className="min-w-0 flex-1 text-right text-base text-foreground-muted">
+ {formatTime(draft.schedule.timeOfDay)}
+ </Text>
+ <SymbolView
+ name="chevron.right"
+ size={14}
+ tintColorClassName="accent-chevron"
+ type="monochrome"
+ />
+ </Pressable>
+ {timePickerOpen ? (
+ <DateTimePicker
+ value={timePickerValue(draft.schedule.timeOfDay)}
+ mode="time"
+ display={Platform.OS === "ios" ? "spinner" : "default"}
+ onDismiss={() => setTimePickerOpen(false)}
+ onValueChange={(_, selected) => {
+ const timeOfDay = `${String(selected.getHours()).padStart(2, "0")}:${String(selected.getMinutes()).padStart(2, "0")}`;
+ setDraft({ ...draft, schedule: { ...draft.schedule, timeOfDay } });
+ }}
+ />
+ ) : null}
+ <SelectRow
+ label="Repeat"
+ value={repeatLabel(draft.schedule.weekdays)}
+ borderTop
+ actions={[
+ {
+ id: "every_day",
+ title: "Every day",
+ state: draft.schedule.weekdays.length === 7 ? "on" : undefined,
+ },
+ {
+ id: "weekdays",
+ title: "Weekdays",
+ state: repeatLabel(draft.schedule.weekdays) === "Weekdays" ? "on" : undefined,
+ },
+ ...DAYS.map((day) => ({
+ id: String(day.index),
+ title: day.label,
+ attributes: { keepsMenuPresented: true },
+ state: draft.schedule.weekdays.includes(day.index)
+ ? ("on" as const)
+ : undefined,
+ })),
+ ]}
+ onSelect={(id) => {
+ const weekdays =
+ id === "every_day"
+ ? DAYS.map((day) => day.index)
+ : id === "weekdays"
+ ? [1, 2, 3, 4, 5]
+ : (() => {
+ const day = DAYS.find((item) => String(item.index) === id);
+ if (!day) return draft.schedule.weekdays;
+ return draft.schedule.weekdays.includes(day.index)
+ ? draft.schedule.weekdays.filter((index) => index !== day.index)
+ : [...draft.schedule.weekdays, day.index];
+ })();
+ setDraft({ ...draft, schedule: { ...draft.schedule, weekdays } });
+ }}
+ />
+ </>
+ ) : draft.schedule.mode === "webhook" ? (
+ <>
+ <WebhookScheduleDetails
+ environmentId={environmentId}
+ // The live row, so a rotated URL shows up without reopening the form.
+ // Once the list has loaded, a missing task is gone; don't keep showing its URL.
+ task={
+ tasks.data
+ ? (tasks.data.tasks.find((task) => task.id === draft.task?.id) ?? null)
+ : draft.task
+ }
+ signatureConfigured={draft.schedule.signature !== null}
+ disabled={!canOperate || saving || environmentUnavailable}
+ />
+ <FormField
+ label="Skip requests older than (minutes)"
+ value={draft.schedule.maxDeliveryAgeMinutes}
+ placeholder="Run every request"
+ keyboardType="number-pad"
+ disabled={saving}
+ borderTop
+ onChange={(maxDeliveryAgeMinutes) =>
+ setDraft({ ...draft, schedule: { ...draft.schedule, maxDeliveryAgeMinutes } })
+ }
+ />
+ </>
+ ) : (
+ <>
+ <FormField
+ label="Minutes between runs"
+ value={draft.schedule.intervalMinutes}
+ keyboardType="decimal-pad"
+ disabled={saving}
+ borderTop
+ onChange={(intervalMinutes) =>
+ setDraft({ ...draft, schedule: { ...draft.schedule, intervalMinutes } })
+ }
+ />
+ {Number(draft.schedule.intervalMinutes) < 1 ? (
+ <Text className="px-4 pb-3 text-sm text-danger-foreground">
+ Intervals must be at least 1 minute. Update this interval before saving.
+ </Text>
+ ) : draft.task?.schedule.type === "interval" &&
+ draft.task.schedule.everyMs < 60_000 ? (
+ <Text className="px-4 pb-3 text-sm text-foreground-muted">
+ This task previously ran more than once per minute. Saving requires an interval of
+ at least 1 minute.
+ </Text>
+ ) : null}
+ </>
+ )}
+ <View className="min-h-14 flex-row items-center gap-3 border-t border-border-subtle px-4 py-3">
+ <Text className="min-w-0 flex-1 text-lg text-foreground">Enabled</Text>
+ <ThemedSwitch
+ accessibilityLabel="Task enabled"
+ value={draft.enabled}
+ onValueChange={(enabled) => setDraft({ ...draft, enabled })}
+ />
+ </View>
+ </SettingsSection>
+ {draft.schedule.mode === "fixed_time" ? (
+ <Text className="px-2 text-sm text-foreground-muted">
+ Time uses the environment's time zone, which may differ from your phone's.
+ </Text>
+ ) : null}
+ </View>
+ <Button
+ tone="primary"
+ fullWidth
+ loading={saving}
+ disabled={!canOperate || dictationPending || taskMissing || environmentUnavailable}
onPress={() => void save()}
- className="min-h-12 items-center justify-center rounded-[14px] bg-primary px-4 disabled:opacity-50"
- >
- <Text className="text-base font-t3-medium text-primary-foreground">
- {saving ? "Saving…" : draft.task ? "Save changes" : "Create task"}
- </Text>
- </Pressable>
+ label={saving ? "Saving…" : draft.task ? "Save changes" : "Create task"}
+ />
</View>
);
}
diff --git a/apps/mobile/src/features/terminal/TerminalContextSheet.tsx b/apps/mobile/src/features/terminal/TerminalContextSheet.tsx
index 18aa6d57ee1..9798bf231dc 100644
--- a/apps/mobile/src/features/terminal/TerminalContextSheet.tsx
+++ b/apps/mobile/src/features/terminal/TerminalContextSheet.tsx
@@ -11,7 +11,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
import { REVIEW_MONO_FONT_FAMILY } from "../review/reviewDiffRendering";
import { AppText as Text } from "../../components/AppText";
import { AppSheet } from "../../components/AppSheet";
-import { MaterialButton } from "../../components/MaterialButton";
+import { Button } from "../../components/Button";
import { uuidv4 } from "../../lib/uuid";
import { insertComposerDraftContext } from "../../state/use-composer-drafts";
@@ -112,7 +112,7 @@ export function TerminalContextSheet(props: {
Select fewer lines to fit the context limit.
</Text>
) : null}
- <MaterialButton
+ <Button
label="Attach selected output"
tone="primary"
fullWidth
diff --git a/apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx b/apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx
index 70579053bd9..61c3a9f5d31 100644
--- a/apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx
+++ b/apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx
@@ -35,7 +35,7 @@ import { EmptyState } from "../../components/EmptyState";
import { GlassSurface } from "../../components/GlassSurface";
import { LoadingScreen } from "../../components/LoadingScreen";
import { MaterialScreenContent } from "../../components/MaterialScreenContent";
-import { MaterialButton } from "../../components/MaterialButton";
+import { Button } from "../../components/Button";
import { MaterialIconButton } from "../../components/MaterialIconButton";
import { environmentCatalog } from "../../connection/catalog";
import { useEnvironmentPresentation } from "../../state/presentation";
@@ -1296,7 +1296,7 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
{Platform.OS === "android" && !keyboardState.isVisible ? (
<View className="min-h-14 flex-row items-center gap-2 bg-card-alt px-2">
{selectedThread && hasNativeTerminalSurface() ? (
- <MaterialButton
+ <Button
label="Attach output"
tone="text"
onPress={() => setCaptureRequest((value) => value + 1)}
diff --git a/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx b/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
index 53f14674183..a29341088d7 100644
--- a/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
+++ b/apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
@@ -20,7 +20,7 @@ import { Alert, Platform, Pressable, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { cn } from "../../lib/cn";
import { MaterialScreenContent } from "../../components/MaterialScreenContent";
-import { MaterialButton } from "../../components/MaterialButton";
+import { Button } from "../../components/Button";
import { ScreenScrollView as ScrollView } from "../../components/ScreenScrollView";
import { AppText as Text } from "../../components/AppText";
import { ProjectFavicon } from "../../components/ProjectFavicon";
@@ -388,7 +388,7 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRoutePara
</Text>
{Platform.OS === "android" ? (
<>
- <MaterialButton
+ <Button
label={catalogState.hasReadyEnvironment ? "Add new project" : "Add environment"}
tone="primary"
onPress={() =>
@@ -398,7 +398,7 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRoutePara
}
/>
{canStartScratch ? (
- <MaterialButton
+ <Button
label="Start without a project"
tone="secondary"
onPress={() => void startScratch()}
diff --git a/apps/mobile/src/features/threads/ThreadQueueControl.tsx b/apps/mobile/src/features/threads/ThreadQueueControl.tsx
index 441b1bfe3c6..40af3d35efe 100644
--- a/apps/mobile/src/features/threads/ThreadQueueControl.tsx
+++ b/apps/mobile/src/features/threads/ThreadQueueControl.tsx
@@ -14,7 +14,7 @@ import { Screen, ScreenStack, ScreenStackHeaderConfig } from "react-native-scree
import { useSafeAreaInsets } from "react-native-safe-area-context";
import Reanimated, { ReduceMotion, useAnimatedStyle, withTiming } from "react-native-reanimated";
-import { MaterialButton } from "../../components/MaterialButton";
+import { Button } from "../../components/Button";
import { AndroidSheetHeader } from "../../components/AndroidScreenHeader";
import { AppText as Text } from "../../components/AppText";
import { SymbolView } from "../../components/AppSymbol";
@@ -198,7 +198,7 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
{workflow?.isHeld && queuedRuns.length > 0 ? (
<View className="gap-2 py-3">
<Text className="text-sm text-foreground-muted">Queue held after restart</Text>
- <MaterialButton
+ <Button
label="Resume queue"
disabled={resuming || busyRunId !== null}
onPress={async () => {
diff --git a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
index 34d47e7e580..62efe91b97d 100644
--- a/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
+++ b/apps/mobile/src/features/threads/ThreadSettingsSheet.tsx
@@ -52,7 +52,7 @@ import { SymbolView } from "../../components/AppSymbol";
import { AppText as Text } from "../../components/AppText";
import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
import { AndroidAnchoredMenu } from "../../components/AndroidAnchoredMenu";
-import { MaterialButton } from "../../components/MaterialButton";
+import { Button } from "../../components/Button";
import { MaterialIconButton } from "../../components/MaterialIconButton";
import { ProviderIcon } from "../../components/ProviderIcon";
import { ThemedSwitch } from "../../components/ThemedSwitch";
@@ -1364,7 +1364,7 @@ function ThreadSettingsModelsScreen() {
)}
</AndroidAnchoredMenu>
{session.pendingModel ? (
- <MaterialButton label="Save" tone="text" onPress={commitAndClose} />
+ <Button label="Save" tone="text" onPress={commitAndClose} />
) : null}
</View>
}
diff --git a/apps/mobile/src/features/threads/git/gitSheetComponents.tsx b/apps/mobile/src/features/threads/git/gitSheetComponents.tsx
index c358466e22d..f5b693f8200 100644
--- a/apps/mobile/src/features/threads/git/gitSheetComponents.tsx
+++ b/apps/mobile/src/features/threads/git/gitSheetComponents.tsx
@@ -2,7 +2,7 @@ import { SymbolView } from "../../../components/AppSymbol";
import type { ComponentProps } from "react";
import { Platform, Pressable, View } from "react-native";
import { AppText as Text } from "../../../components/AppText";
-import { MaterialButton } from "../../../components/MaterialButton";
+import { Button } from "../../../components/Button";
import { cn } from "../../../lib/cn";
/* ─── Shared sheet components ──────────────────────────────────────── */
@@ -17,8 +17,9 @@ export function SheetActionButton(props: {
if (Platform.OS === "android")
return (
<View className="flex-1">
- <MaterialButton
+ <Button
label={props.label}
+ icon={props.icon}
tone={props.tone}
disabled={props.disabled}
onPress={props.onPress}