Skip to content

Commit f1cddec

Browse files
refactor(mobile): use shared pull request action buttons
1 parent 9259ca4 commit f1cddec

6 files changed

Lines changed: 34 additions & 67 deletions

File tree

‎apps/mobile/src/features/pull-requests/PullRequestFiles.tsx‎

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { AppActivityIndicator } from "../../components/ui/AppActivityIndicator";
21
import { PullRequestSectionHeading } from "./PullRequestSectionHeading";
32
import { AnimatedLegendList } from "@legendapp/list/reanimated";
43
import Animated from "react-native-reanimated";
@@ -256,19 +255,13 @@ export function usePullRequestFilesContent(props: {
256255
footer: (
257256
<>
258257
{result.nextCursor ? (
259-
<Pressable
258+
<Button
259+
label={result.error ? "Retry loading files" : "Load more files"}
260+
tone="secondary"
260261
onPress={result.error ? result.refresh : result.loadMore}
261-
accessibilityRole="button"
262-
className="min-h-11 items-center justify-center rounded-xl bg-grouped-card px-4 py-3"
263-
>
264-
{result.isPending ? (
265-
<AppActivityIndicator />
266-
) : (
267-
<Text className="text-sm font-t3-medium">
268-
{result.error ? "Retry loading files" : "Load more files"}
269-
</Text>
270-
)}
271-
</Pressable>
262+
loading={result.isPending}
263+
fullWidth
264+
/>
272265
) : null}
273266
{viewed.error ? (
274267
<Text className="py-2 text-xs text-danger-foreground">{viewed.error}</Text>

‎apps/mobile/src/features/pull-requests/PullRequestMergeControls.tsx‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,7 @@ export function PullRequestMergeControls(props: {
280280
</Text>
281281
) : null}
282282
{stack.error && stack.supportsStackActions ? (
283-
<Pressable
284-
accessibilityRole="button"
285-
onPress={stack.refresh}
286-
className="min-h-11 justify-center px-1"
287-
>
288-
<Text className="text-sm text-primary-text">Retry stack lookup</Text>
289-
</Pressable>
283+
<Button label="Retry stack lookup" tone="text" onPress={stack.refresh} />
290284
) : null}
291285
</View>
292286
);

‎apps/mobile/src/features/pull-requests/PullRequestRouteScreen.tsx‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,13 +1213,9 @@ export function PullRequestFileRouteScreen({
12131213
</View>
12141214
) : null}
12151215
{result.error && result.nextCursor ? (
1216-
<Pressable
1217-
accessibilityRole="button"
1218-
onPress={result.refresh}
1219-
className="min-h-11 items-center justify-center py-2"
1220-
>
1221-
<Text className="text-sm font-t3-medium">Retry loading remaining files</Text>
1222-
</Pressable>
1216+
<View className="self-center">
1217+
<Button label="Retry loading remaining files" tone="text" onPress={result.refresh} />
1218+
</View>
12231219
) : null}
12241220
{parsed.kind === "files" && parsed.notice ? (
12251221
<Text className="px-4 py-2 text-2xs text-foreground-muted">{parsed.notice}</Text>

‎apps/mobile/src/features/pull-requests/PullRequestsScreen.tsx‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Button } from "../../components/ui/Button";
12
import {
23
applyPullRequestDraftFilterChange,
34
parsePullRequestQuery,
@@ -10,7 +11,6 @@ import { useAtomValue } from "@effect/atom-react";
1011
import {
1112
Keyboard,
1213
Platform,
13-
Pressable,
1414
RefreshControl,
1515
ScrollView,
1616
View,
@@ -327,15 +327,14 @@ export function PullRequestsScreen(
327327
/>
328328
</View>
329329
) : result.loadMoreError ? (
330-
<Pressable
331-
accessibilityRole="button"
332-
accessibilityLabel="Retry loading more pull requests"
333-
onPress={() => void result.loadMore(true)}
334-
className="items-center gap-2 px-8 py-4"
335-
>
330+
<View className="items-center gap-2 px-8 py-4">
336331
<Text className="text-xs text-foreground-muted">{result.loadMoreError}</Text>
337-
<Text className="text-sm font-t3-medium text-link">Try again</Text>
338-
</Pressable>
332+
<Button
333+
label="Try again"
334+
accessibilityLabel="Retry loading more pull requests"
335+
onPress={() => void result.loadMore(true)}
336+
/>
337+
</View>
339338
) : undefined
340339
}
341340
ListEmptyComponent={

‎apps/mobile/src/features/pull-requests/guide/GuideNotice.tsx‎

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Pressable, View } from "react-native";
1+
import { Button } from "../../../components/ui/Button";
2+
import { View } from "react-native";
23
import Animated, { FadeIn, ReduceMotion } from "react-native-reanimated";
34
import { AppText as Text } from "../../../components/ui/AppText";
45
import { SymbolView } from "../../../components/ui/AppSymbol";
@@ -40,28 +41,16 @@ export function GuideNotice({ state }: { readonly state: ReturnType<typeof useRe
4041
</View>
4142
<View className="min-h-12 flex-row items-center justify-between gap-3">
4243
{state.canWrite || busy || notice.kind === "unavailable" ? (
43-
<Pressable
44-
accessibilityRole="button"
45-
accessibilityState={{ disabled: busy, busy }}
46-
disabled={busy}
47-
style={{ width: 152 }}
48-
className={
49-
compact
50-
? "min-h-12 items-center justify-center rounded-full bg-secondary px-4 active:opacity-70"
51-
: "min-h-12 items-center justify-center rounded-full bg-foreground px-4 active:opacity-70"
52-
}
53-
onPress={() => (notice.kind === "unavailable" ? state.refresh() : void state.write())}
54-
>
55-
<Text
56-
className={
57-
compact
58-
? "text-center font-t3-medium text-secondary-foreground"
59-
: "text-center font-t3-medium text-screen"
60-
}
61-
>
62-
{notice.action}
63-
</Text>
64-
</Pressable>
44+
<View className="w-40">
45+
<Button
46+
label={notice.action}
47+
tone={compact ? "secondary" : "contrast"}
48+
disabled={busy}
49+
onPress={() => (notice.kind === "unavailable" ? state.refresh() : void state.write())}
50+
fullWidth
51+
loading={busy}
52+
/>
53+
</View>
6554
) : (
6655
<Text className="text-xs text-foreground-muted">
6756
{notice.kind === "failed"

‎apps/mobile/src/features/pull-requests/guide/GuideOutline.tsx‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Button } from "../../../components/ui/Button";
12
import type { PullRequestReviewGuide } from "@t3tools/contracts";
23
import { stopFilePaths } from "@t3tools/client-runtime/review-guide-tour";
34
import { Pressable, View } from "react-native";
@@ -100,14 +101,9 @@ export function GuideOutline({
100101
);
101102
})}
102103
{guide.stops.length ? (
103-
<Pressable
104-
accessibilityRole="button"
105-
onPress={() => onOpen(0)}
106-
className="min-h-11 flex-row items-center justify-end gap-2 active:opacity-60"
107-
>
108-
<Text className="text-sm font-t3-medium">Start tour</Text>
109-
<SymbolView name="arrow.right" size={17} tintColorClassName="accent-foreground" />
110-
</Pressable>
104+
<View className="self-end">
105+
<Button label="Start tour" tone="text" onPress={() => onOpen(0)} icon="arrow.right" />
106+
</View>
111107
) : null}
112108
</View>
113109
);

0 commit comments

Comments
 (0)