Skip to content

Commit a5c2459

Browse files
fix: simplify host onboarding surface (anomalyco#72)
1 parent d245199 commit a5c2459

1 file changed

Lines changed: 155 additions & 142 deletions

File tree

‎src/views/OnboardingView.tsx‎

Lines changed: 155 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -99,153 +99,165 @@ export default function OnboardingView(props: OnboardingViewProps) {
9999
<div class="space-y-2">
100100
<div class="text-sm font-medium text-white">Starter Workspace</div>
101101
<div class="text-xs text-zinc-500">
102-
OpenWork will create a ready-to-run folder and start OpenCode inside it.
102+
OpenWork will create a ready-to-run folder and get everything set up for you.
103103
</div>
104104
<div class={`text-xs ${props.developerMode ? "text-zinc-600 font-mono" : "text-zinc-500"} break-all`}>
105105
{props.developerMode ? props.activeWorkspacePath || "(initializing...)" : "A starter workspace will be created for you."}
106106
</div>
107+
</div>
107108

108-
</div>
109-
110-
<div class="pt-3 border-t border-zinc-800/60 space-y-2">
111-
<div class="text-xs font-semibold text-zinc-500 uppercase tracking-wider">What you get</div>
112-
<div class="space-y-2">
113-
<div class="flex items-center gap-3 text-sm text-zinc-300">
114-
<div class="w-2 h-2 rounded-full bg-emerald-500" />
115-
Scheduler plugin (workspace-scoped)
116-
</div>
117-
<div class="flex items-center gap-3 text-sm text-zinc-300">
118-
<div class="w-2 h-2 rounded-full bg-emerald-500" />
119-
Starter templates ("Understand this workspace", etc.)
120-
</div>
121-
<div class="flex items-center gap-3 text-sm text-zinc-300">
122-
<div class="w-2 h-2 rounded-full bg-emerald-500" />
123-
You can add more folders when prompted
124-
</div>
125-
</div>
126-
</div>
127-
</div>
128-
129-
<Button onClick={props.onStartHost} disabled={props.busy || !props.activeWorkspacePath.trim()} class="w-full py-3 text-base">
130-
Start Workspace
131-
</Button>
132-
133-
<details class="rounded-2xl border border-zinc-800 bg-zinc-950/60 px-4 py-3">
134-
<summary class="flex items-center justify-between cursor-pointer text-xs text-zinc-500">
135-
Advanced settings
136-
<ChevronDown size={14} class="text-zinc-600" />
137-
</summary>
138-
<div class="pt-3 space-y-3">
139-
<div class="text-xs text-zinc-600">
140-
Authorized folders live in <span class="font-mono">.opencode/openwork.json</span> and can be updated here anytime.
141-
</div>
142-
143-
<div class="space-y-3">
144-
<div class="flex gap-2">
145-
<input
146-
class="w-full bg-zinc-900/50 border border-zinc-800 rounded-xl px-3 py-2 text-sm text-white placeholder-zinc-600 focus:outline-none focus:ring-1 focus:ring-zinc-600 focus:border-zinc-600 transition-all"
147-
placeholder="Add folder path"
148-
value={props.newAuthorizedDir}
149-
onInput={(e) => props.onSetAuthorizedDir(e.currentTarget.value)}
150-
onKeyDown={(e) => {
151-
if (e.key === "Enter") {
152-
props.onAddAuthorizedDir();
153-
}
154-
}}
155-
/>
156-
<Show when={isTauriRuntime()}>
157-
<Button variant="outline" onClick={props.onAddAuthorizedDirFromPicker} disabled={props.busy}>
158-
Pick
159-
</Button>
160-
</Show>
161-
<Button variant="secondary" onClick={props.onAddAuthorizedDir} disabled={!props.newAuthorizedDir.trim()}>
162-
Add
163-
</Button>
164-
</div>
165-
166-
<Show when={props.authorizedDirs.length}>
167-
<div class="space-y-2">
168-
<For each={props.authorizedDirs}>
169-
{(dir, idx) => (
170-
<div class="flex items-center justify-between gap-3 rounded-xl bg-black/20 border border-zinc-800 px-3 py-2">
171-
<div class="min-w-0 text-xs font-mono text-zinc-300 truncate">{dir}</div>
172-
<Button
173-
variant="ghost"
174-
class="!p-2 rounded-lg text-xs text-zinc-400 hover:text-white"
175-
onClick={() => props.onRemoveAuthorizedDir(idx())}
176-
disabled={props.busy}
177-
title="Remove"
178-
>
179-
Remove
180-
</Button>
181-
</div>
182-
)}
183-
</For>
184-
</div>
185-
</Show>
186-
</div>
187-
188-
<Show when={isTauriRuntime() && props.developerMode}>
189-
<div class="rounded-2xl bg-zinc-900/40 border border-zinc-800 p-4">
190-
<div class="flex items-start justify-between gap-4">
191-
<div class="min-w-0">
192-
<div class="text-sm font-medium text-white">OpenCode CLI</div>
193-
<div class="mt-1 text-xs text-zinc-500">
194-
<Show when={props.engineDoctorFound != null} fallback={<span>Checking install...</span>}>
195-
<Show when={props.engineDoctorFound} fallback={<span>Not found. Install to run Host mode.</span>}>
196-
<span class="font-mono">{props.engineDoctorVersion ?? "Installed"}</span>
197-
<Show when={props.engineDoctorResolvedPath}>
198-
<span class="text-zinc-600"> · </span>
199-
<span class="font-mono text-zinc-600 truncate">{props.engineDoctorResolvedPath}</span>
200-
</Show>
201-
</Show>
202-
</Show>
203-
</div>
204-
</div>
205-
206-
<Button variant="secondary" onClick={props.onRefreshEngineDoctor} disabled={props.busy}>
207-
Re-check
208-
</Button>
209-
</div>
210-
211-
<Show when={props.engineDoctorFound === false}>
212-
<div class="mt-4 space-y-2">
213-
<div class="text-xs text-zinc-500">
214-
{isWindowsPlatform()
215-
? "Install OpenCode with one of the commands below, then restart OpenWork."
216-
: "Install OpenCode from https://opencode.ai/install"}
217-
</div>
218-
<Show when={isWindowsPlatform()}>
219-
<div class="text-xs text-zinc-500 space-y-1 font-mono">
220-
<div>choco install opencode</div>
221-
<div>scoop install extras/opencode</div>
222-
<div>npm install -g opencode-ai</div>
223-
</div>
224-
</Show>
225-
<div class="flex gap-2 pt-2">
226-
<Button onClick={props.onInstallEngine} disabled={props.busy}>
227-
Install OpenCode
228-
</Button>
229-
<Button variant="outline" onClick={props.onShowSearchNotes} disabled={props.busy}>
230-
Show search notes
231-
</Button>
232-
</div>
233-
</div>
234-
</Show>
235-
236-
<Show when={props.engineInstallLogs}>
237-
<pre class="mt-4 max-h-48 overflow-auto rounded-xl bg-black/50 border border-zinc-800 p-3 text-xs text-zinc-300 whitespace-pre-wrap">{props.engineInstallLogs}</pre>
238-
</Show>
239-
240-
<Show when={props.engineDoctorCheckedAt}>
241-
<div class="mt-3 text-[11px] text-zinc-600">
242-
Last checked {props.engineDoctorCheckedAt ? new Date(props.engineDoctorCheckedAt).toLocaleTimeString() : ""}
243-
</div>
244-
</Show>
245-
</div>
246-
</Show>
247-
</div>
248-
</details>
109+
<div class="pt-3 border-t border-zinc-800/60 space-y-2">
110+
<div class="text-xs font-semibold text-zinc-500 uppercase tracking-wider">What you get</div>
111+
<div class="space-y-2">
112+
<div class="flex items-center gap-3 text-sm text-zinc-300">
113+
<div class="w-2 h-2 rounded-full bg-emerald-500" />
114+
Scheduler plugin (workspace-scoped)
115+
</div>
116+
<div class="flex items-center gap-3 text-sm text-zinc-300">
117+
<div class="w-2 h-2 rounded-full bg-emerald-500" />
118+
Starter templates ("Understand this workspace", etc.)
119+
</div>
120+
<div class="flex items-center gap-3 text-sm text-zinc-300">
121+
<div class="w-2 h-2 rounded-full bg-emerald-500" />
122+
Add more folders when prompted
123+
</div>
124+
</div>
125+
</div>
126+
</div>
127+
128+
<div class="rounded-2xl border border-zinc-800 bg-zinc-950/50 px-4 py-3">
129+
<div class="flex items-center justify-between gap-4">
130+
<div class="min-w-0">
131+
<div class="text-xs font-semibold text-zinc-500 uppercase tracking-wider">Access</div>
132+
<div class="mt-1 text-sm text-white">{props.authorizedDirs.length} folder{props.authorizedDirs.length === 1 ? "" : "s"} allowed</div>
133+
<div class="text-xs text-zinc-500">You can manage access in advanced settings.</div>
134+
</div>
135+
<div class="text-xs text-zinc-600 font-mono truncate max-w-[9rem]">
136+
<Show when={props.developerMode}>{props.authorizedDirs[0] ?? ""}</Show>
137+
</div>
138+
</div>
139+
</div>
140+
141+
<Button onClick={props.onStartHost} disabled={props.busy || !props.activeWorkspacePath.trim()} class="w-full py-3 text-base">
142+
Start OpenWork
143+
</Button>
144+
145+
<details class="rounded-2xl border border-zinc-800 bg-zinc-950/60 px-4 py-3">
146+
<summary class="flex items-center justify-between cursor-pointer text-xs text-zinc-500">
147+
Advanced settings
148+
<ChevronDown size={14} class="text-zinc-600" />
149+
</summary>
150+
<div class="pt-3 space-y-3">
151+
<div class="text-xs text-zinc-500">
152+
Manage which folders OpenWork can access.
153+
</div>
154+
155+
<div class="space-y-3">
156+
<div class="flex gap-2">
157+
<input
158+
class="w-full bg-zinc-900/50 border border-zinc-800 rounded-xl px-3 py-2 text-sm text-white placeholder-zinc-600 focus:outline-none focus:ring-1 focus:ring-zinc-600 focus:border-zinc-600 transition-all"
159+
placeholder="Add folder path"
160+
value={props.newAuthorizedDir}
161+
onInput={(e) => props.onSetAuthorizedDir(e.currentTarget.value)}
162+
onKeyDown={(e) => {
163+
if (e.key === "Enter") {
164+
props.onAddAuthorizedDir();
165+
}
166+
}}
167+
/>
168+
<Show when={isTauriRuntime()}>
169+
<Button variant="outline" onClick={props.onAddAuthorizedDirFromPicker} disabled={props.busy}>
170+
Pick
171+
</Button>
172+
</Show>
173+
<Button variant="secondary" onClick={props.onAddAuthorizedDir} disabled={!props.newAuthorizedDir.trim()}>
174+
Add
175+
</Button>
176+
</div>
177+
178+
<Show when={props.authorizedDirs.length}>
179+
<div class="space-y-2">
180+
<For each={props.authorizedDirs}>
181+
{(dir, idx) => (
182+
<div class="flex items-center justify-between gap-3 rounded-xl bg-black/20 border border-zinc-800 px-3 py-2">
183+
<div class="min-w-0 text-xs font-mono text-zinc-300 truncate">{dir}</div>
184+
<Button
185+
variant="ghost"
186+
class="!p-2 rounded-lg text-xs text-zinc-400 hover:text-white"
187+
onClick={() => props.onRemoveAuthorizedDir(idx())}
188+
disabled={props.busy}
189+
title="Remove"
190+
>
191+
Remove
192+
</Button>
193+
</div>
194+
)}
195+
</For>
196+
</div>
197+
</Show>
198+
</div>
199+
200+
<Show when={isTauriRuntime() && props.developerMode}>
201+
<div class="rounded-2xl bg-zinc-900/40 border border-zinc-800 p-4">
202+
<div class="flex items-start justify-between gap-4">
203+
<div class="min-w-0">
204+
<div class="text-sm font-medium text-white">OpenCode CLI</div>
205+
<div class="mt-1 text-xs text-zinc-500">
206+
<Show when={props.engineDoctorFound != null} fallback={<span>Checking install...</span>}>
207+
<Show when={props.engineDoctorFound} fallback={<span>Not found. Install to run Host mode.</span>}>
208+
<span class="font-mono">{props.engineDoctorVersion ?? "Installed"}</span>
209+
<Show when={props.engineDoctorResolvedPath}>
210+
<span class="text-zinc-600"> · </span>
211+
<span class="font-mono text-zinc-600 truncate">{props.engineDoctorResolvedPath}</span>
212+
</Show>
213+
</Show>
214+
</Show>
215+
</div>
216+
</div>
217+
218+
<Button variant="secondary" onClick={props.onRefreshEngineDoctor} disabled={props.busy}>
219+
Re-check
220+
</Button>
221+
</div>
222+
223+
<Show when={props.engineDoctorFound === false}>
224+
<div class="mt-4 space-y-2">
225+
<div class="text-xs text-zinc-500">
226+
{isWindowsPlatform()
227+
? "Install OpenCode with one of the commands below, then restart OpenWork."
228+
: "Install OpenCode from https://opencode.ai/install"}
229+
</div>
230+
<Show when={isWindowsPlatform()}>
231+
<div class="text-xs text-zinc-500 space-y-1 font-mono">
232+
<div>choco install opencode</div>
233+
<div>scoop install extras/opencode</div>
234+
<div>npm install -g opencode-ai</div>
235+
</div>
236+
</Show>
237+
<div class="flex gap-2 pt-2">
238+
<Button onClick={props.onInstallEngine} disabled={props.busy}>
239+
Install OpenCode
240+
</Button>
241+
<Button variant="outline" onClick={props.onShowSearchNotes} disabled={props.busy}>
242+
Show search notes
243+
</Button>
244+
</div>
245+
</div>
246+
</Show>
247+
248+
<Show when={props.engineInstallLogs}>
249+
<pre class="mt-4 max-h-48 overflow-auto rounded-xl bg-black/50 border border-zinc-800 p-3 text-xs text-zinc-300 whitespace-pre-wrap">{props.engineInstallLogs}</pre>
250+
</Show>
251+
252+
<Show when={props.engineDoctorCheckedAt}>
253+
<div class="mt-3 text-[11px] text-zinc-600">
254+
Last checked {props.engineDoctorCheckedAt ? new Date(props.engineDoctorCheckedAt).toLocaleTimeString() : ""}
255+
</div>
256+
</Show>
257+
</div>
258+
</Show>
259+
</div>
260+
</details>
249261

250262
<Button variant="ghost" onClick={props.onBackToMode} disabled={props.busy} class="w-full">
251263
Back
@@ -351,6 +363,7 @@ export default function OnboardingView(props: OnboardingViewProps) {
351363
<div class="rounded-2xl bg-zinc-900/40 border border-zinc-800 p-5 flex items-center justify-between">
352364
<div>
353365
<div class="text-sm text-white font-medium">Engine already running</div>
366+
<div class="text-xs text-zinc-500">Attach to the existing session on this device.</div>
354367
<Show when={props.developerMode}>
355368
<div class="text-xs text-zinc-500 font-mono truncate max-w-[14rem] md:max-w-[22rem]">
356369
{props.engineBaseUrl}

0 commit comments

Comments
 (0)