import { ActionSheetModal, type ActionSheetAction } from '../components/ActionSheetModal' import { ConfirmModal } from '../components/ConfirmModal' import { PickerModal } from '../components/PickerModal' import { MobilePrComposeSheet, openMobilePrUrl } from '../components/MobilePrComposeSheet' import { MobileBranchDiffPreviewDrawer } from './MobileBranchDiffPreviewDrawer' import type { MobileSourceControlState } from './use-mobile-source-control-state' type Props = { state: MobileSourceControlState worktreeId: string actionSheetActions: ActionSheetAction[] } export function MobileSourceControlModals({ state, worktreeId, actionSheetActions }: Props) { const { client, branchDiffPreview, setBranchDiffPreview, showActionSheet, setShowActionSheet, discardTarget, setDiscardTarget, showPrSheet, setShowPrSheet, prPrefill, showBranchPicker, setShowBranchPicker, localBranches, createdPrUrl, setCreatedPrUrl, status, branchLabel, loadStatus, checkoutBranch, runGitAction } = state return ( <> setBranchDiffPreview(null)} /> setShowActionSheet(false)} /> { if (discardTarget) { void runGitAction(`discard:${discardTarget.path}`, 'git.discard', { filePath: discardTarget.path }) } // Modal visibility is derived from discardTarget — clear it so it dismisses. setDiscardTarget(null) }} onCancel={() => setDiscardTarget(null)} /> setShowPrSheet(false)} onCreated={(url) => { setShowPrSheet(false) setCreatedPrUrl(url) void loadStatus({ preserveReadyOnFailure: true, force: true }) }} /> ({ value: b, label: b, subtitle: b === localBranches?.current ? 'current' : undefined }))} selected={localBranches?.current ?? ''} onSelect={(branch) => { if (branch !== localBranches?.current) { void checkoutBranch(branch) } else { setShowBranchPicker(false) } }} onClose={() => setShowBranchPicker(false)} /> { if (createdPrUrl) { openMobilePrUrl(createdPrUrl) } setCreatedPrUrl(null) }} onCancel={() => setCreatedPrUrl(null)} /> ) }