import { Pressable, Text, View } from 'react-native' import { ArrowDown, ArrowUp } from 'lucide-react-native' import type { DiffComment } from '../../../src/shared/diff-comment-types' import { colors } from '../theme/mobile-theme' import type { MobileDiffReviewQueueItem } from '../session/mobile-diff-review-queue' import { MOBILE_GIT_STATUS_LABELS } from '../source-control/mobile-git-status' import { mobileReviewCountLabel, mobileReviewScopeLabel, type ReviewDiffState } from '../session/mobile-diff-review-screen-model' import { mobileDiffReviewStyles as styles } from './mobile-diff-review-screen-styles' type Props = { currentIndex: number diffState: ReviewDiffState fileNotes: DiffComment[] filteredCount: number item: MobileDiffReviewQueueItem staleCommentIds: ReadonlySet onEditNote: (comment: DiffComment) => void onJumpHunk: (direction: 'next' | 'previous') => void } function statusColor(status: MobileDiffReviewQueueItem['status']): string { switch (status) { case 'added': case 'copied': return colors.statusGreen case 'deleted': return colors.statusRed case 'renamed': return colors.accentBlue case 'untracked': return colors.statusAmber case 'modified': default: return colors.textSecondary } } export function MobileDiffReviewFileSummary({ currentIndex, diffState, fileNotes, filteredCount, item, staleCommentIds, onEditNote, onJumpHunk }: Props) { const hunkDisabled = diffState.kind !== 'ready' || diffState.hunks.length === 0 const badgeColor = statusColor(item.status) return ( {MOBILE_GIT_STATUS_LABELS[item.status]} {item.filePath} {mobileReviewScopeLabel(item)} {item.oldPath ? ` from ${item.oldPath}` : ''} {currentIndex + 1}/{filteredCount} {item.isReviewed ? Reviewed : null} {item.changedSinceReview ? Changed : null} {item.noteCount > 0 ? ( {mobileReviewCountLabel(item.noteCount, 'note', 'notes')} ) : null} {item.staleNoteCount > 0 ? ( {item.staleNoteCount} stale ) : null} {fileNotes.length > 0 ? ( {fileNotes.map((note) => ( [styles.fileNote, pressed && styles.fileNotePressed]} onPress={() => onEditNote(note)} accessibilityRole="button" accessibilityLabel="Edit file note" > {note.body} {staleCommentIds.has(note.id) ? Stale : null} ))} ) : null} [styles.hunkButton, pressed && styles.hunkButtonPressed]} disabled={hunkDisabled} onPress={() => onJumpHunk('previous')} accessibilityRole="button" accessibilityLabel="Previous hunk" > Hunk [styles.hunkButton, pressed && styles.hunkButtonPressed]} disabled={hunkDisabled} onPress={() => onJumpHunk('next')} accessibilityRole="button" accessibilityLabel="Next hunk" > Hunk ) }