Files
orca/mobile/src/source-control/MobileBranchDiffPreviewDrawer.tsx
T
OrcaWinandOrcaWin a99bc36593 feat(mobile): localize tasks, new workspaces and source control (#35646)
* feat(mobile): localize tasks, new workspaces and source control

Moves the last ~670 strings (task lists and boards, issue and PR sources, the
new-workspace flow, and source control) to the translation API, with all ten
translations. What remains in the coverage baseline is reviewed non-copy: key
names, schema errors and log lines.

- Source control section titles recompute on a language change

* fix(mobile): align catalog terminology across screens

A whole-catalog pass per language reconciled terms that differed between batches
(host/desktop, dictation, transcripts, address form) with the glossaries and the
desktop catalogs. The page bundle verifier now reports catalog bytes separately.

* fix(mobile): keep fetched history and source error slugs language-independent

History rows are derived from the fetched page at render so relative times follow a
language switch; quality-gate follow-ups for the tasks and source control migration.

* fix(mobile): name Android notification channels in the UI language

* chore(mobile): drop catalog entries for removed source-control copy

* fix(mobile): re-localize the composer source hook on current main

---------

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
2026-10-28 21:11:04 -07:00

96 lines
3.7 KiB
TypeScript

import { ActivityIndicator, Pressable, Text, View } from 'react-native'
import { X } from 'lucide-react-native'
import { colors } from '../theme/mobile-theme'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
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) {
useMobileColorScheme()
const t = useMobileTranslation()
if (!branchDiffPreview) {
return null
}
const entry = branchDiffPreview.entry
return (
<BottomDrawer
visible={branchDiffPreview !== null}
onClose={onClose}
dragContentToDismiss={false}
zIndex={1100}
>
<View style={styles.diffDrawerHeader}>
<View style={styles.diffDrawerTitleBlock}>
<Text style={styles.diffDrawerTitle} numberOfLines={1}>
{entry.path}
</Text>
<Text style={styles.diffDrawerMeta} numberOfLines={1}>
{branchDiffPreview.kind === 'ready'
? `${branchDiffPreview.summary.baseRef}..HEAD`
: t('sourceControl.branchDiffPreviewDrawer.committedOnBranch', 'Committed on branch')}
</Text>
</View>
<Pressable
style={({ pressed }) => [styles.diffCloseButton, pressed && styles.iconButtonPressed]}
onPress={onClose}
hitSlop={8}
accessibilityLabel={t(
'sourceControl.branchDiffPreviewDrawer.closePreview',
'Close committed diff preview'
)}
>
<X size={18} color={colors.textSecondary} strokeWidth={2.1} />
</Pressable>
</View>
{branchDiffPreview.kind === 'loading' ? (
<View style={styles.diffState}>
<ActivityIndicator size="small" color={colors.textSecondary} />
</View>
) : branchDiffPreview.kind === 'error' ? (
<View style={styles.diffState}>
<Text style={styles.stateTitle}>
{t('sourceControl.branchDiffPreviewDrawer.loadFailed', 'Unable to Load Diff')}
</Text>
<Text style={styles.stateText}>{branchDiffPreview.message}</Text>
</View>
) : (
<View style={styles.diffLines}>
{branchDiffPreview.truncated ? (
<Text style={styles.diffTruncatedText}>
{t(
'sourceControl.branchDiffPreviewDrawer.truncated',
'Diff truncated for mobile preview.'
)}
</Text>
) : null}
{branchDiffPreview.lines.map((line, index) => (
<View
key={`${index}:${line.kind}:${line.oldLineNumber ?? ''}:${line.newLineNumber ?? ''}`}
style={[
styles.diffLine,
line.kind === 'add' && styles.diffLineAdd,
line.kind === 'delete' && styles.diffLineDelete
]}
>
<Text style={styles.diffLineNumber}>{mobileDiffLineNumber(line)}</Text>
<Text style={styles.diffLinePrefix}>{mobileDiffLinePrefix(line.kind)}</Text>
<Text style={styles.diffLineText}>
{line.text ? <MobileSyntaxSegments segments={line.segments} /> : ' '}
</Text>
</View>
))}
</View>
)}
</BottomDrawer>
)
}