import { ActionSheetModal, type ActionSheetAction } from '../components/ActionSheetModal' import { ConfirmModal } from '../components/ConfirmModal' import { PickerModal } from '../components/PickerModal' import { openMobilePrUrl } from '../components/MobilePrComposeSheet' import { MobileBranchDiffPreviewDrawer } from './MobileBranchDiffPreviewDrawer' import type { MobileSourceControlState } from './use-mobile-source-control-state' type Props = { state: MobileSourceControlState actionSheetActions: ActionSheetAction[] } export function MobileSourceControlModals({ state, actionSheetActions }: Props) { const { branchDiffPreview, setBranchDiffPreview, showActionSheet, setShowActionSheet, discardTarget, setDiscardTarget, showBranchPicker, setShowBranchPicker, localBranches, createdPrUrl, setCreatedPrUrl, createdPrWarning, setCreatedPrWarning, branchLabel, 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)} /> ({ 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) setCreatedPrWarning(null) }} onCancel={() => { setCreatedPrUrl(null) setCreatedPrWarning(null) }} /> ) }