import { ActivityIndicator, Pressable, Text, View } from 'react-native' import { X } from 'lucide-react-native' import { colors } from '../theme/mobile-theme' import { BottomDrawer } from '../components/BottomDrawer' import { MobileSyntaxSegments } from '../components/MobileSyntaxSegments' import { mobileDiffLineNumber, mobileDiffLinePrefix } from './mobile-diff-format' import type { MobileBranchDiffPreviewState } from './mobile-source-control-screen-state' import { styles } from './mobile-source-control-styles' type Props = { branchDiffPreview: MobileBranchDiffPreviewState | null onClose: () => void } export function MobileBranchDiffPreviewDrawer({ branchDiffPreview, onClose }: Props) { if (!branchDiffPreview) { return null } const entry = branchDiffPreview.entry return ( {entry.path} {branchDiffPreview.kind === 'ready' ? `${branchDiffPreview.summary.baseRef}..HEAD` : 'Committed on branch'} [styles.diffCloseButton, pressed && styles.iconButtonPressed]} onPress={onClose} hitSlop={8} accessibilityLabel="Close committed diff preview" > {branchDiffPreview.kind === 'loading' ? ( ) : branchDiffPreview.kind === 'error' ? ( Unable to Load Diff {branchDiffPreview.message} ) : ( {branchDiffPreview.truncated ? ( Diff truncated for mobile preview. ) : null} {branchDiffPreview.lines.map((line, index) => ( {mobileDiffLineNumber(line)} {mobileDiffLinePrefix(line.kind)} {line.text ? : ' '} ))} )} ) }