import { Text, View } from 'react-native'
import type { MobileComposerSource } from '../new-workspace/source-selection/use-mobile-composer-source'
import { colors, spacing } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
import { MobileSwitch } from './MobileSwitch'
import { TextField } from './composer-input/TextField'
import { LIST_ROW_PADDING, ListGroup, ListRow } from './list/ListGroup'
import { newWorktreeFormStyles } from './new-worktree-form-styles'
type Props = {
composer: MobileComposerSource
selectedRepoIsGit: boolean
}
// Show editable Name after source pill; branch override/reuse follow desktop’s advanced composer fields.
export function SmartWorkspaceAdvancedFields({ composer, selectedRepoIsGit }: Props) {
useMobileColorScheme()
const t = useMobileTranslation()
const selection = composer.smartNameSelection
const showBranchOverride = selectedRepoIsGit && (!selection || selection.kind === 'branch')
const reuseTitle = t('workspace.branchChoice.existing', 'Existing branch')
return (
<>
{selection ? (
{t('components.smartWorkspaceAdvancedFields.name', 'Name')}
) : null}
{showBranchOverride && !composer.reuseEligibleBranch ? (
{t('components.smartWorkspaceAdvancedFields.branchName', 'Branch name')}
) : null}
{composer.reuseEligibleBranch ? (
{t('workspace.branchChoice.title', 'Branch for this worktree')}
}
/>
{composer.reuseSelectedBranch ? (
{t('workspace.branchChoice.existingHint', 'New commits go on this branch.')}
) : (
{t('workspace.branchChoice.newHint', 'Create a new local branch')}
{t('workspace.branchChoice.newName', 'New branch name')}
)}
) : null}
>
)
}
const styles = themedStyleSheet(() => ({
hint: {
fontSize: 13,
color: colors.textSecondary,
paddingHorizontal: LIST_ROW_PADDING,
marginTop: 6
},
newBranch: {
gap: 6
},
newBranchLabel: {
marginTop: spacing.sm,
marginBottom: 0
}
}))