Files
orca/mobile/src/source-control/MobileSourceControlSegments.tsx
T
Jinjing eb678cd77f Consolidate mobile source control into a single tabbed hub
Unify the changes list, pull request details, and commit history into
a single multi-segment panel. This improves navigation and state sharing
across different lenses of a worktree's source control.

- Add a segmented control to switch between Changes, PR, and History
- Introduce a persistent branch status card with an integrated PR chip
- Redirect standalone PR and history routes to the new unified hub
- Extract reusable UI and logic for the history list and PR summary
2026-07-09 18:04:28 -07:00

46 lines
1.5 KiB
TypeScript

import { Pressable, Text, View } from 'react-native'
import {
SOURCE_CONTROL_HUB_TABS,
SOURCE_CONTROL_HUB_TAB_LABELS,
type SourceControlHubTab
} from './mobile-source-control-hub-tab'
import { hubStyles } from './mobile-source-control-hub-styles'
type Props = {
active: SourceControlHubTab
onSelect: (tab: SourceControlHubTab) => void
}
// The hub's top-level lens switcher. Switching is local state (no route push) so
// scroll position and the shared branch card persist across Changes/PR/History.
export function MobileSourceControlSegments({ active, onSelect }: Props) {
return (
<View style={hubStyles.segments} accessibilityRole="tablist">
{SOURCE_CONTROL_HUB_TABS.map((tab) => {
const isActive = tab === active
return (
<Pressable
key={tab}
style={({ pressed }) => [
hubStyles.segment,
isActive && hubStyles.segmentActive,
pressed && !isActive && hubStyles.segmentPressed
]}
onPress={() => onSelect(tab)}
accessibilityRole="tab"
accessibilityState={{ selected: isActive }}
accessibilityLabel={SOURCE_CONTROL_HUB_TAB_LABELS[tab]}
>
<Text
style={[hubStyles.segmentText, isActive && hubStyles.segmentTextActive]}
numberOfLines={1}
>
{SOURCE_CONTROL_HUB_TAB_LABELS[tab]}
</Text>
</Pressable>
)
})}
</View>
)
}