({
open,
config,
setConfig,
setupChecklist,
connectionReport,
isTestingConnection,
onSaveConfig,
onTestConnection,
onClose,
onComplete,
}: SetupWizardProps)
| 73 | } |
| 74 | |
| 75 | export function SetupWizard({ |
| 76 | open, |
| 77 | config, |
| 78 | setConfig, |
| 79 | setupChecklist, |
| 80 | connectionReport, |
| 81 | isTestingConnection, |
| 82 | onSaveConfig, |
| 83 | onTestConnection, |
| 84 | onClose, |
| 85 | onComplete, |
| 86 | }: SetupWizardProps) { |
| 87 | const [step, setStep] = useState<WizardStep>('welcome'); |
| 88 | |
| 89 | const stepIndex = wizardSteps.indexOf(step); |
| 90 | const allReady = setupChecklist.every(item => item.ready); |
| 91 | const canFinish = allReady && Boolean(connectionReport?.ok); |
| 92 | const providerReady = Boolean(config.upstreamBaseUrl && config.upstreamModel); |
| 93 | const workspaceReady = Boolean(config.workspaceDir && config.clawProjectDir); |
| 94 | const runtimeReady = |
| 95 | config.runner === 'binary' ? Boolean(config.clawBinaryPath) : Boolean(config.clawProjectDir); |
| 96 | |
| 97 | const completedSteps = useMemo( |
| 98 | () => ({ |
| 99 | welcome: false, |
| 100 | provider: providerReady, |
| 101 | workspace: workspaceReady, |
| 102 | runtime: runtimeReady, |
| 103 | verify: canFinish, |
| 104 | }), |
| 105 | [providerReady, workspaceReady, runtimeReady, canFinish], |
| 106 | ); |
| 107 | |
| 108 | if (!open) { |
| 109 | return null; |
| 110 | } |
| 111 | |
| 112 | async function pickDirectory(target: 'workspaceDir' | 'clawProjectDir') { |
| 113 | const nextPath = await window.clawDesktop?.pickDirectory?.(); |
| 114 | if (nextPath) { |
| 115 | setConfig(current => ({ |
| 116 | ...current, |
| 117 | [target]: nextPath, |
| 118 | })); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | async function pickBinaryPath() { |
| 123 | const nextPath = await window.clawDesktop?.pickFile?.([ |
| 124 | { name: 'Executable', extensions: ['exe', 'bin', 'cmd'] }, |
| 125 | { name: 'All Files', extensions: ['*'] }, |
| 126 | ]); |
| 127 | if (nextPath) { |
| 128 | setConfig(current => ({ |
| 129 | ...current, |
| 130 | clawBinaryPath: nextPath, |
| 131 | })); |
| 132 | } |
nothing calls this directly
no test coverage detected