Skip to content

Commit e1f33e0

Browse files
authored
refactor(mobile): Git and Agents sheet headers take theme colours from classes (pingdotgg#20409)
1 parent 9c16146 commit e1f33e0

3 files changed

Lines changed: 22 additions & 28 deletions

File tree

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ import { Atom } from "effect/reactivity";
1313
import * as Haptics from "expo-haptics";
1414
import { useEffect, useState } from "react";
1515
import { Platform, Pressable, ScrollView, View } from "react-native";
16-
import { Screen, ScreenStack, ScreenStackHeaderConfig } from "react-native-screens";
16+
import { ScreenStack } from "react-native-screens";
1717
import { useSafeAreaInsets } from "react-native-safe-area-context";
1818

1919
import { AndroidSheetHeader } from "../../components/ui/AndroidScreenHeader";
2020
import { AppText as Text } from "../../components/ui/AppText";
21-
import { useUniwindTheme } from "../../lib/useUniwindTheme";
2221
import { environmentThreadDetails } from "../../state/threads";
2322
import { NativeStackScreenOptions, nativeHeaderScrollEdgeEffects } from "../../native/StackHeader";
23+
import { NativeHeader, NativeScreen } from "../../native/ThemedScreenStack";
2424
import { SubagentRow } from "./SubagentRow";
2525
import { ScreenContent } from "../../components/ui/ScreenContent";
2626
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
@@ -46,7 +46,6 @@ export function ThreadAgentsSheet({ route }: StaticScreenProps<AgentsTarget>) {
4646
const target = route.params;
4747
const navigation = useNavigation();
4848
const insets = useSafeAreaInsets();
49-
const theme = useUniwindTheme();
5049
const turn = useThreadTurnSubagents(target);
5150
const subagents = turn?.subagents ?? [];
5251
const hasLiveAgent = (turn?.liveCount ?? 0) > 0;
@@ -97,27 +96,27 @@ export function ThreadAgentsSheet({ route }: StaticScreenProps<AgentsTarget>) {
9796
return (
9897
<View collapsable={false} className="flex-1 bg-sheet">
9998
<ScreenStack style={{ flex: 1 }}>
100-
<Screen
99+
<NativeScreen
101100
activityState={2}
102101
enabled
103102
isNativeStack
104103
screenId="thread-agents-sheet-native"
105104
scrollEdgeEffects={HEADER_SCROLL_EDGE_EFFECTS}
106-
style={{ backgroundColor: theme["--color-sheet"], flex: 1 }}
105+
className="flex-1 bg-sheet"
107106
>
108107
{content}
109-
<ScreenStackHeaderConfig
108+
<NativeHeader
110109
backgroundColor="rgba(0,0,0,0)"
111-
color={theme["--color-foreground"]}
110+
tintColorClassName="accent-foreground"
112111
hideBackButton
113112
hideShadow={false}
114113
title="Agents"
115-
titleColor={theme["--color-foreground"]}
114+
titleColorClassName="accent-foreground"
116115
titleFontSize={18}
117116
titleFontWeight="800"
118117
translucent
119118
/>
120-
</Screen>
119+
</NativeScreen>
121120
</ScreenStack>
122121
</View>
123122
);

‎apps/mobile/src/features/threads/git/GitOverviewSheet.tsx‎

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ import { SymbolView } from "../../../components/ui/AppSymbol";
1717
import { useCallback, useEffect, useMemo, useState } from "react";
1818
import { Platform, Pressable, RefreshControl, ScrollView, View } from "react-native";
1919

20-
import { Screen, ScreenStack, ScreenStackHeaderConfig } from "react-native-screens";
20+
import { ScreenStack } from "react-native-screens";
2121
import { useSafeAreaInsets } from "react-native-safe-area-context";
2222
import { NativeSheetContent } from "../../../native/NativeSheetContent";
23-
import { useUniwindTheme } from "../../../lib/useUniwindTheme";
23+
import { NativeHeader, NativeScreen } from "../../../native/ThemedScreenStack";
2424
import {
2525
AndroidHeaderIconButton,
2626
AndroidSheetHeader,
@@ -93,9 +93,6 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
9393
const gitState = useSelectedThreadGitState();
9494
const gitActions = useSelectedThreadGitActions();
9595
const { canWriteSourceControl, canChangeThreadBranch } = gitActions;
96-
const theme = useUniwindTheme();
97-
const foregroundColor = theme["--color-foreground"];
98-
const sheetColor = theme["--color-sheet"];
9996

10097
const gitStatus = useEnvironmentQuery(
10198
selectedThread !== null && selectedThreadCwd !== null
@@ -393,28 +390,28 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
393390
return (
394391
<View collapsable={false} className="flex-1 border-l border-border bg-sheet">
395392
<ScreenStack style={{ flex: 1 }}>
396-
<Screen
393+
<NativeScreen
397394
activityState={2}
398395
enabled
399396
isNativeStack
400397
screenId="thread-git-inspector-native"
401398
scrollEdgeEffects={HEADER_SCROLL_EDGE_EFFECTS}
402-
style={{ backgroundColor: sheetColor, flex: 1 }}
399+
className="flex-1 bg-sheet"
403400
>
404401
<NativeSheetContent>{content}</NativeSheetContent>
405-
<ScreenStackHeaderConfig
402+
<NativeHeader
406403
backgroundColor="rgba(0,0,0,0)"
407-
color={foregroundColor}
404+
tintColorClassName="accent-foreground"
408405
hideBackButton
409406
hideShadow={false}
410407
navigationItemStyle="editor"
411408
title={currentBranchLabel}
412-
titleColor={foregroundColor}
409+
titleColorClassName="accent-foreground"
413410
titleFontSize={17}
414411
titleFontWeight="700"
415412
translucent
416413
/>
417-
</Screen>
414+
</NativeScreen>
418415
</ScreenStack>
419416
</View>
420417
);
@@ -427,28 +424,28 @@ function GitOverviewSheetContent(props: GitOverviewSheetProps) {
427424
return (
428425
<View collapsable={false} className="flex-1 bg-sheet">
429426
<ScreenStack style={{ flex: 1 }}>
430-
<Screen
427+
<NativeScreen
431428
activityState={2}
432429
enabled
433430
isNativeStack
434431
screenId="thread-git-sheet-native"
435432
scrollEdgeEffects={HEADER_SCROLL_EDGE_EFFECTS}
436-
style={{ backgroundColor: sheetColor, flex: 1 }}
433+
className="flex-1 bg-sheet"
437434
>
438435
<NativeSheetContent>{content}</NativeSheetContent>
439-
<ScreenStackHeaderConfig
436+
<NativeHeader
440437
backgroundColor="rgba(0,0,0,0)"
441-
color={foregroundColor}
438+
tintColorClassName="accent-foreground"
442439
hideBackButton
443440
hideShadow={false}
444441
navigationItemStyle="editor"
445442
title={currentBranchLabel}
446-
titleColor={foregroundColor}
443+
titleColorClassName="accent-foreground"
447444
titleFontSize={18}
448445
titleFontWeight="800"
449446
translucent
450447
/>
451-
</Screen>
448+
</NativeScreen>
452449
</ScreenStack>
453450
</View>
454451
);

‎vite.config.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,8 @@ export default defineConfig({
397397
"apps/mobile/src/features/settings/appearance/components/FontSizeSliderRow.tsx",
398398
"apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx",
399399
"apps/mobile/src/features/threads/ThreadQueueControl.tsx",
400-
"apps/mobile/src/features/threads/ThreadAgentsSheet.tsx",
401400
"apps/mobile/src/features/review/ReviewCommentCard.tsx",
402401
"apps/mobile/src/features/threads/ThreadSettingsSheet.tsx",
403-
"apps/mobile/src/features/threads/git/GitOverviewSheet.tsx",
404402
"apps/mobile/src/features/threads/thread-list-items.tsx",
405403
"apps/mobile/src/features/threads/thread-list-v2-items.tsx",
406404
"apps/mobile/src/lib/useMobileNavigationTheme.ts",

0 commit comments

Comments
 (0)