import { Check, ChevronLeft, ChevronRight, Folder, Pencil, Plus, Terminal, Trash2, X, Zap } from 'lucide-react-native' import { useEffect, useState } from 'react' import { ActivityIndicator, Pressable, ScrollView, Text, TextInput, View } from 'react-native' import { strings as zhCN } from '../../locales/i18n' import type { CustomPrompt, QuickPromptActionMode } from '../../services/storage' import type { AgentPresetOption, ModelCatalogModel, ModelProviderGroup, PermissionSelect, WorkspaceView, } from '../../types' import { Button, IconButton } from '../../ui/components' import { useTheme } from '../../ui/theme-context' import { useThemedStyles } from '../../ui/use-themed-styles' import { usePickerListMaxHeight } from './modal' import { SheetModal } from '../../ui/sheet' import { createStyles } from './styles' export function ModePicker({ visible, options, current, loading, selecting, onClose, onPick }: { visible: boolean options?: AgentPresetOption[] current?: string loading?: boolean selecting?: boolean onClose: () => void onPick: (preset: string) => void }) { const { colors } = useTheme() const styles = useThemedStyles(createStyles) const listMaxHeight = usePickerListMaxHeight() return ( {zhCN.chat.selectMode} {options === undefined || options.length === 0 ? ( loading ? : {zhCN.chat.modeLoadFailed} ) : options.map(option => { const isCurrent = option.id === current const broken = option.broken !== undefined const description = agentPresetDescription(option) return ( onPick(option.id)} style={[styles.permissionOption, isCurrent && styles.modelOptionCurrent, (selecting || broken) && styles.plusMenuOptionDisabled]} > {agentPresetName(option)} {description !== undefined && {description}} {isCurrent && } ) })} ) } export function PermissionPicker({ visible, permissions, onClose, onPick, loading, error, onRetry }: { loading: boolean error?: string onRetry: () => void visible: boolean permissions?: PermissionSelect onClose: () => void onPick: (preset: string) => void }) { const { colors } = useTheme() const styles = useThemedStyles(createStyles) const listMaxHeight = usePickerListMaxHeight() if (permissions === undefined) return null return ( {zhCN.chat.approvalMode} {loading && } {error && {error}