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

102 lines
4.0 KiB
TypeScript

import { useState } from 'react'
import { ActivityIndicator, Pressable, Text, View } from 'react-native'
import { ChevronDown, ChevronRight, Sparkles } 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 { AgentLaunchNotice } from '../components/AgentLaunchNotice'
import type { MobileCommitFailureRecovery } from './mobile-commit-failure-recovery'
import type { MobileCommitFailureRecoveryAction } from './use-mobile-commit-failure-recovery'
import { styles } from './mobile-source-control-styles'
type Props = {
failure: MobileCommitFailureRecovery
action: MobileCommitFailureRecoveryAction
}
export function MobileCommitFailurePanel({ failure, action }: Props) {
useMobileColorScheme()
const t = useMobileTranslation()
const [expanded, setExpanded] = useState(false)
const Chevron = expanded ? ChevronDown : ChevronRight
const detailsText = failure.error.trim()
return (
<View style={styles.commitFailurePanel}>
<View style={styles.commitFailureHeader}>
<View style={styles.commitFailureTextBlock}>
<Text style={styles.commitFailureTitle}>
{t('sourceControl.commitFailurePanel.title', 'Commit failed')}
</Text>
<Text style={styles.commitFailureSummary} numberOfLines={2}>
{action.summary ?? t('sourceControl.commitFailurePanel.summary', 'Commit failed.')}
</Text>
</View>
<Pressable
style={({ pressed }) => [
styles.commitFailureFixButton,
(action.launching || action.availability !== 'available') &&
styles.commitFailureFixButtonDisabled,
pressed && styles.commitFailureFixButtonPressed
]}
onPress={() => void action.launch()}
disabled={action.launching || action.availability !== 'available'}
accessibilityRole="button"
accessibilityLabel={t(
'sourceControl.commitFailurePanel.fixWithAi',
'Fix commit failure with AI'
)}
>
{action.launching ? (
<ActivityIndicator color={colors.bgBase} />
) : (
<Sparkles size={14} color={colors.bgBase} strokeWidth={2.2} />
)}
<Text style={styles.commitFailureFixButtonText}>
{t('sourceControl.commitFailurePanel.fix', 'Fix')}
</Text>
</Pressable>
</View>
{action.hasDetails && detailsText ? (
<>
<Pressable
style={({ pressed }) => [
styles.commitFailureDetailsButton,
pressed && styles.commitFailureDetailsButtonPressed
]}
onPress={() => setExpanded((current) => !current)}
accessibilityRole="button"
accessibilityLabel={
expanded
? t(
'sourceControl.commitFailurePanel.hideFailureDetails',
'Hide commit failure details'
)
: t(
'sourceControl.commitFailurePanel.showFailureDetails',
'Show commit failure details'
)
}
>
<Chevron size={14} color={colors.textSecondary} strokeWidth={2.2} />
<Text style={styles.commitFailureDetailsButtonText}>
{expanded
? t('sourceControl.commitFailurePanel.hideDetails', 'Hide details')
: t('sourceControl.commitFailurePanel.showDetails', 'Show details')}
</Text>
</Pressable>
{expanded ? <Text style={styles.commitFailureDetailsText}>{detailsText}</Text> : null}
</>
) : null}
<AgentLaunchNotice
availability={action.availability}
success={action.launchSuccess}
error={action.launchError}
warning={action.launchWarning}
undeliveredPrompt={action.undeliveredPrompt}
errorStyle={styles.commitFailureLaunchError}
/>
</View>
)
}