Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/mobile/src/components/ui/Button.android.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function Button(props: ButtonProps) {
<View
accessible
accessibilityRole="button"
accessibilityLabel={props.label}
accessibilityLabel={props.accessibilityLabel ?? props.label}
accessibilityHint={props.accessibilityHint}
accessibilityState={{
disabled: Boolean(props.disabled || props.loading),
Expand Down
3 changes: 2 additions & 1 deletion apps/mobile/src/components/ui/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { cn } from "../../lib/cn";

export interface ButtonProps {
readonly label: string;
readonly accessibilityLabel?: string;
readonly icon?: AppSymbolName;
readonly onPress: () => void;
readonly disabled?: boolean;
Expand All @@ -29,7 +30,7 @@ export function Button(props: ButtonProps) {
return (
<Pressable
accessibilityRole="button"
accessibilityLabel={props.label}
accessibilityLabel={props.accessibilityLabel ?? props.label}
accessibilityHint={props.accessibilityHint}
accessibilityState={{ disabled, busy: Boolean(props.loading) }}
disabled={disabled}
Expand Down
15 changes: 1 addition & 14 deletions apps/mobile/src/features/projects/AddProjectScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,20 +262,7 @@ function PrimaryActionButton(props: {
readonly loading?: boolean;
readonly onPress: () => void;
}) {
if (Platform.OS === "android") return <Button {...props} tone="primary" fullWidth />;
return (
<Pressable
disabled={props.disabled}
onPress={props.onPress}
className="h-12 items-center justify-center rounded-full bg-primary active:opacity-70 disabled:opacity-45"
>
{props.loading ? (
<AppActivityIndicator colorClassName={String("accent-primary-foreground")} />
) : (
<Text className="text-base font-t3-bold text-primary-foreground">{props.label}</Text>
)}
</Pressable>
);
return <Button {...props} tone="primary" fullWidth />;
}

function ProjectPathInput(props: {
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/src/features/threads/PendingApprovalCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RequestActionButton } from "./RequestActionButton";
import { Button } from "../../components/ui/Button";
import type {
ProviderApprovalDecision,
ProviderApprovalOption,
Expand Down Expand Up @@ -55,7 +55,7 @@ export function PendingApprovalCard(props: PendingApprovalCardProps) {
) : null}
<View className="flex-row flex-wrap gap-2.5">
{options.map((option) => (
<RequestActionButton
<Button
key={option.decision}
label={option.label}
tone={
Expand Down
6 changes: 3 additions & 3 deletions apps/mobile/src/features/threads/PendingUserInputCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RequestActionButton } from "./RequestActionButton";
import { Button } from "../../components/ui/Button";
import { QuestionAttachments } from "./QuestionAttachments";
import type { RuntimeRequestId } from "@t3tools/contracts";
import type { ThreadUserInputQuestion } from "@t3tools/client-runtime/state/thread-requests";
Expand Down Expand Up @@ -304,9 +304,9 @@ export function PendingUserInputCard(props: PendingUserInputCardProps) {
);
})}
</ScrollView>
<RequestActionButton
<Button
label="Submit answers"
size="large"
fullWidth
tone={props.answers ? "primary" : "secondary"}
disabled={!props.canOperateThread || responseDisabled || props.answers === null}
onPress={() => void props.onSubmit()}
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/src/features/threads/ProviderSubagentBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { View } from "react-native";

import { AppText as Text } from "../../components/ui/AppText";
import { ProviderIcon } from "../../components/ProviderIcon";
import { RequestActionButton } from "./RequestActionButton";
import { Button } from "../../components/ui/Button";
import { useVisibleSecondClock } from "./use-visible-second-clock";

export function ProviderSubagentBar(props: {
Expand Down Expand Up @@ -60,7 +60,7 @@ export function ProviderSubagentBar(props: {
</Text>
</View>
{props.onOpenParent ? (
<RequestActionButton label="Open parent" tone="secondary" onPress={props.onOpenParent} />
<Button label="Open parent" tone="secondary" onPress={props.onOpenParent} />
) : null}
</View>
);
Expand Down
44 changes: 0 additions & 44 deletions apps/mobile/src/features/threads/RequestActionButton.tsx

This file was deleted.

6 changes: 4 additions & 2 deletions apps/mobile/src/features/threads/SecretRequestCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { SymbolView, type AppSymbolName } from "../../components/ui/AppSymbol";
import { AppText as Text, AppTextInput as TextInput } from "../../components/ui/AppText";
import { serverEnvironment } from "../../state/server";
import { useAtomCommand } from "../../state/use-atom-command";
import { RequestActionButton } from "./RequestActionButton";
import { Button } from "../../components/ui/Button";

const LOCK_SYMBOL: AppSymbolName = { ios: "lock", android: "lock" };
const PRIVATE_SYMBOL: AppSymbolName = { ios: "checkmark.shield", android: "lock" };
Expand Down Expand Up @@ -128,8 +128,10 @@ function PendingSecretRequestForm(props: {
{error}
</Text>
) : null}
<RequestActionButton
<Button
label="Save securely"
tone="primary"
fullWidth
disabled={submitting || secret.trim().length === 0}
onPress={() => void send({ type: "save", secret })}
/>
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/src/features/threads/ThreadCreationFailedCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RequestActionButton } from "./RequestActionButton";
import { Button } from "../../components/ui/Button";
import { View } from "react-native";

import { AppText as Text } from "../../components/ui/AppText";
Expand All @@ -19,7 +19,7 @@ export function ThreadCreationFailedCard(props: {
Your prompt was kept in the project draft.
</Text>
<View className="flex-row">
<RequestActionButton label="Edit task" onPress={props.onEditTask} />
<Button label="Edit task" tone="primary" onPress={props.onEditTask} />
</View>
</View>
);
Expand Down
60 changes: 4 additions & 56 deletions apps/mobile/src/features/threads/git/gitSheetComponents.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { SymbolView } from "../../../components/ui/AppSymbol";
import type { ComponentProps } from "react";
import { Platform, Pressable, View } from "react-native";
import { AppText as Text } from "../../../components/ui/AppText";
import { View } from "react-native";
import { Button } from "../../../components/ui/Button";
import { cn } from "../../../lib/cn";

export function SheetActionButton(props: {
readonly icon: ComponentProps<typeof SymbolView>["name"];
Expand All @@ -12,60 +10,10 @@ export function SheetActionButton(props: {
readonly tone?: "primary" | "secondary" | "danger";
readonly onPress: () => void;
}) {
if (Platform.OS === "android")
return (
<View className="flex-1">
<Button
label={props.label}
icon={props.icon}
tone={props.tone}
disabled={props.disabled}
onPress={props.onPress}
fullWidth
/>
</View>
);
const tone = props.tone ?? "secondary";
const textColorClassName =
tone === "primary"
? "accent-primary-foreground"
: tone === "danger"
? "accent-danger-foreground"
: "accent-secondary-foreground";

return (
<Pressable
className={cn(
"min-h-[48px] flex-1 items-center justify-center rounded-[18px] px-3 py-3 disabled:opacity-[0.45]",
tone === "primary" ? "bg-primary" : tone === "danger" ? "bg-danger" : "bg-secondary",
tone !== "primary" &&
(tone === "danger" ? "border border-danger-border" : "border border-secondary-border"),
)}
accessibilityRole="button"
disabled={props.disabled}
onPress={props.onPress}
>
<View className="max-w-full flex-row items-center justify-center gap-1.5">
<SymbolView
name={props.icon}
size={16}
tintColorClassName={textColorClassName}
type="monochrome"
/>
<Text
className={cn(
"shrink text-center text-xs font-t3-bold tracking-[0.9px] uppercase",
tone === "primary"
? "text-primary-foreground"
: tone === "danger"
? "text-danger-foreground"
: "text-secondary-foreground",
)}
>
{props.label}
</Text>
</View>
</Pressable>
<View className="flex-1">
<Button {...props} fullWidth />
</View>
);
}

Expand Down
Loading