mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
* feat(mobile): one next-step bar under both Source Control tabs Changes and Pull request are the only segments. A bar at the foot of both shows the branch's one next action: the commit box, push or pull, create the review, resolve or fix with the workspace's agent, merge when ready, merge, or why it can't. Commits opens as a pushed screen. * fix(mobile): keep Merge reachable and show bar failures on both tabs * test(mobile): expect the two Source Control segments in the page render test
68 lines
2.2 KiB
TypeScript
68 lines
2.2 KiB
TypeScript
import { useCallback, useEffect, useMemo, useRef } from 'react'
|
|
import { useMobileTranslation } from '../i18n/use-mobile-translation'
|
|
import { MobileCommitsScreen } from './MobileCommitsScreen'
|
|
import {
|
|
buildMobileBranchRemoteAction,
|
|
type MobileSourceControlReviewInputs
|
|
} from './mobile-source-control-primary-action'
|
|
import type { MobileSourceControlState } from './use-mobile-source-control-state'
|
|
|
|
type Props = {
|
|
state: MobileSourceControlState
|
|
hostId: string
|
|
worktreeId: string
|
|
embedded: boolean
|
|
review: MobileSourceControlReviewInputs
|
|
statusHead: string | null
|
|
onBack: () => void
|
|
}
|
|
|
|
/** The Commits screen pushed over the hub, with the branch's Push from the shared decision. */
|
|
export function MobileSourceControlHubCommitsPage({
|
|
state,
|
|
hostId,
|
|
worktreeId,
|
|
embedded,
|
|
review,
|
|
statusHead,
|
|
onBack
|
|
}: Props) {
|
|
const t = useMobileTranslation()
|
|
const { primaryActionArgs, status } = state
|
|
const branchRemoteAction = useMemo(
|
|
() => buildMobileBranchRemoteAction({ ...primaryActionArgs, review }),
|
|
[primaryActionArgs, review, t]
|
|
)
|
|
// Pass primitives and a stable runner so commit-message keystrokes do not rerender the Commits list.
|
|
const branchRemoteActionRef = useRef(branchRemoteAction)
|
|
useEffect(() => {
|
|
branchRemoteActionRef.current = branchRemoteAction
|
|
}, [branchRemoteAction])
|
|
const runBranchRemoteAction = useCallback(
|
|
() => branchRemoteActionRef.current?.run() ?? Promise.resolve(),
|
|
[]
|
|
)
|
|
const upstream = status?.upstreamStatus
|
|
return (
|
|
<MobileCommitsScreen
|
|
client={state.client}
|
|
connState={state.connState}
|
|
worktreeId={worktreeId}
|
|
hostId={hostId}
|
|
openDiffForFile={state.openDiffForFile}
|
|
embedded={embedded}
|
|
bottomInset={state.insets.bottom}
|
|
refreshKey={`${statusHead ?? ''}:${upstream?.ahead ?? ''}:${upstream?.behind ?? ''}`}
|
|
branchName={state.branchLabel}
|
|
busyAction={state.busyAction}
|
|
actionError={state.actionError}
|
|
pushLabel={branchRemoteAction?.label}
|
|
pushDisabled={branchRemoteAction?.disabled}
|
|
pushBusy={branchRemoteAction?.loading}
|
|
onPush={runBranchRemoteAction}
|
|
onUpdateBranch={state.runActionSheetRebase}
|
|
onBack={onBack}
|
|
/>
|
|
)
|
|
}
|