Files
archived-orca/mobile/src/source-control/MobileSourceControlFileList.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

90 lines
2.8 KiB
TypeScript

import { SectionList, Text, View } from 'react-native'
import {
BranchCompareHeader,
BranchFileRow,
makeRenderFileRow
} from './MobileSourceControlFileRows'
import type {
MobileBranchEntryView,
MobileGitStatusEntryView
} from './mobile-source-control-screen-state'
import type { MobileSourceControlState } from './use-mobile-source-control-state'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
import { styles } from './mobile-source-control-styles'
import { hubStyles } from './mobile-source-control-hub-styles'
type FileEntry = MobileGitStatusEntryView | MobileBranchEntryView
function isWorkingTreeEntry(entry: FileEntry): entry is MobileGitStatusEntryView {
return typeof entry.stageActionId === 'string'
}
type FileSection = { key: string; title: string; data: readonly FileEntry[] }
export type FileListState = Pick<
MobileSourceControlState,
| 'sections'
| 'shouldShowBranchCompareSection'
| 'branchCompareSummaryText'
| 'branchEntries'
| 'branchCompareState'
| 'branchCompareResult'
| 'busyAction'
| 'openingPath'
| 'openingBranchPath'
| 'openFile'
| 'openBranchDiff'
| 'runGitAction'
| 'setDiscardTarget'
>
export function MobileSourceControlFileList({ state }: { state: FileListState }) {
const colorScheme = useMobileColorScheme()
const t = useMobileTranslation()
const sections: FileSection[] = state.sections.map((section) => ({
...section,
key: section.id
}))
if (state.shouldShowBranchCompareSection) {
sections.push({
key: 'committed',
title: t('sourceControl.fileList.committedSection', 'Committed on Branch'),
data:
state.branchCompareState.kind === 'ready' &&
state.branchCompareResult?.summary.status === 'ready'
? state.branchEntries
: []
})
}
const renderFileRow = makeRenderFileRow(state, t)
return (
<SectionList<FileEntry, FileSection>
style={hubStyles.tabBody}
sections={sections}
extraData={colorScheme}
renderItem={({ item }) =>
isWorkingTreeEntry(item) ? (
renderFileRow({ item })
) : (
<BranchFileRow entry={item} state={state} />
)
}
keyExtractor={(item) =>
`${isWorkingTreeEntry(item) ? item.area : 'committed'}:${item.path}:${item.oldPath ?? ''}`
}
renderSectionHeader={({ section }) =>
section.key === 'committed' ? (
<BranchCompareHeader state={state} />
) : (
<View style={styles.sectionHeader}>
<Text style={styles.sectionTitle}>{section.title}</Text>
<Text style={styles.sectionCount}>{section.data.length}</Text>
</View>
)
}
stickySectionHeadersEnabled={false}
contentContainerStyle={styles.listContent}
/>
)
}