import { Pressable, Text, TextInput, View } from 'react-native' import { MessageSquare, Plus, X } from 'lucide-react-native' import { MobileSyntaxSegments } from '../components/MobileSyntaxSegments' import { colors } from '../theme/mobile-theme' import { useMobileColorScheme } from '../theme/use-mobile-color-scheme' import { styles } from './mobile-session-styles' import type { DiffComment } from '../../../src/shared/diff-comment-types' import type { RenderableDiffLine } from './mobile-session-route-types' import { useMobileTranslation } from '../i18n/use-mobile-translation' export function MobileDiffCommentLineRow({ line, title, index, comments, activeCommentLine, commentDraft, commentsBusy, onStartComment, onCancelComment, onDraftChange, onSubmitComment, onDeleteComment }: { line: RenderableDiffLine title: string index: number comments: DiffComment[] activeCommentLine: number | null commentDraft: string commentsBusy: boolean onStartComment: (lineNumber: number) => void onCancelComment: () => void onDraftChange: (value: string) => void onSubmitComment: (lineNumber: number) => void onDeleteComment: (commentId: string) => void }) { useMobileColorScheme() const t = useMobileTranslation() const commentLine = line.newLineNumber const isCommenting = commentLine !== undefined && activeCommentLine === commentLine const canComment = commentLine !== undefined // Why: review notes anchor to the modified side, so show that line number in the single mobile gutter. const gutterLineNumber = line.newLineNumber ?? line.oldLineNumber ?? '' return ( {gutterLineNumber} {line.kind === 'add' ? '+ ' : line.kind === 'delete' ? '- ' : ' '} {canComment ? ( [ styles.diffCommentAddButton, pressed && styles.diffCommentAddButtonPressed, commentsBusy && styles.diffCommentButtonDisabled ]} disabled={commentsBusy} onPress={() => { if (commentLine !== undefined) { onStartComment(commentLine) } }} accessibilityLabel={t( 'session.diffCommentLineRow.addNote', 'Add note on line {{line}}', { line: commentLine } )} > ) : null} {comments.length > 0 ? ( {comments.map((comment) => ( {t('session.diffCommentLineRow.line', 'Line {{line}}', { line: comment.lineNumber })} onDeleteComment(comment.id)} accessibilityLabel={t( 'session.diffCommentLineRow.deleteNote', 'Delete note on line {{line}}', { line: comment.lineNumber } )} > {comment.body} ))} ) : null} {isCommenting ? ( {t('common.cancel', 'Cancel')} { if (commentLine !== undefined) { onSubmitComment(commentLine) } }} > {t('session.diffCommentLineRow.saveNote', 'Save note')} ) : null} ) }