Skip to content

Open source CapCut alternative.

TypeScript

Update site prototype to match mac app

David Lef59cca2f3765
diff --git a/AGENTS.md b/AGENTS.md
index b62b220d..874e09ee 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -18,10 +18,11 @@ Before changing `site/` UI, routes, API handlers, or data access patterns:
- Read the relevant Next.js guide in `site/node_modules/next/dist/docs/`; this version may differ from your training data.
- Read the applicable site guidance in `docs/guides/`.
- Do not run database migrations, including `prisma migrate`, `prisma db push`, or any command that applies schema changes to Supabase or another database.
+- Treat `/prototype`, "the prototype route", or route-shaped prototype requests as work on the Next.js route under `site/`, not as a repository-root `prototype/` directory.
## Working Rules
-- Do not touch `prototype/` unless the user explicitly asks for prototype work. By default, assume requested product changes are for the Mac app or the site/landing page.
+- Do not touch repository-root `prototype/` unless the user explicitly asks for that filesystem path. By default, assume requested product changes are for the Mac app or the site/landing page.
- Ask before creating any new plan document.
- Manage plans deliberately: move a plan to `plans/done/` when its work is complete, and create or keep plans only for work that remains.
- Over time, prefer shrinking active `plans/` by completing work and moving finished plans to `plans/done/`.
diff --git a/site/src/app/prototype/_components/App.tsx b/site/src/app/prototype/_components/App.tsx
index 479fe176..8e527d98 100644
--- a/site/src/app/prototype/_components/App.tsx
+++ b/site/src/app/prototype/_components/App.tsx
@@ -1,129 +1,143 @@
'use client';
-import { useLayoutEffect, useMemo, useRef, useState } from 'react';
-import { Plus } from 'lucide-react';
+import { type FormEvent, useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
import { DemoControls } from '@/app/prototype/_components/DemoControls';
import { MacDesktop } from '@/app/prototype/_components/MacDesktop';
import { TASK_COLORS } from '@/app/prototype/_components/tasks';
import type { DesktopSize, NotchState, Spawn, SpawnPhase, TaskId } from '@/app/prototype/_components/types';
-let spawnCounter = 0;
+const COMPOSER_TEXT_MIN_HEIGHT = 19.2;
+const COMPOSER_TEXT_MAX_HEIGHT = 134.4;
export default function App() {
const [state, setState] = useState<NotchState>('running-single');
const [activeTaskId, setActiveTaskId] = useState<TaskId>('compare');
- const [hovering, setHovering] = useState(false);
+ const [notchExpanded, setNotchExpanded] = useState(false);
+ const [promptText, setPromptText] = useState('');
+ const [promptTextHeight, setPromptTextHeight] = useState(COMPOSER_TEXT_MIN_HEIGHT);
const [spawns, setSpawns] = useState<Spawn[]>([]);
- const [spawnInputOpen, setSpawnInputOpen] = useState(false);
- const desktopRef = useRef<HTMLDivElement | null>(null);
- const [desktopSize, setDesktopSize] = useState<DesktopSize>({ w: 1000, h: 625 });
- const runningTaskIds = useMemo<TaskId[]>(() => {
- if (state === 'idle') return [];
- if (state === 'running-multi') return ['compare', 'research', 'schedule'];
+ const [desktopSize, setDesktopSize] = useState<DesktopSize>({ w: 1280, h: 720 });
+ const promptInputRef = useRef<HTMLTextAreaElement | null>(null);
+ const desktopRef = useRef<HTMLElement | null>(null);
+ const spawnCounterRef = useRef(0);
+ const spawnTimerRef = useRef<number[]>([]);
- return [activeTaskId];
- }, [state, activeTaskId]);
+ useLayoutEffect(() => {
+ const input = promptInputRef.current;
+ if (!input) return;
+
+ input.style.height = 'auto';
+ const nextHeight = Math.min(
+ Math.max(Math.ceil(input.scrollHeight), COMPOSER_TEXT_MIN_HEIGHT),
+ COMPOSER_TEXT_MAX_HEIGHT,
+ );
+ input.style.height = `${nextHeight}px`;
+ setPromptTextHeight(nextHeight);
+ }, [promptText]);
+
+ const promptExpanded =
+ promptText.trim().length > 0 &&
+ (promptTextHeight > COMPOSER_TEXT_MIN_HEIGHT + 1 || promptText.includes('\n'));
useLayoutEffect(() => {
- if (!desktopRef.current) return;
- const ro = new ResizeObserver((entries) => {
- const r = entries[0].contentRect;
- setDesktopSize({ w: r.width, h: r.height });
+ const desktop = desktopRef.current;
+ if (!desktop) return;
+
+ const observer = new ResizeObserver((entries) => {
+ const rect = entries[0]?.contentRect;
+ if (!rect) return;
+
+ setDesktopSize({ w: rect.width, h: rect.height });
});
- ro.observe(desktopRef.current);
- return () => ro.disconnect();
+ observer.observe(desktop);
+
+ return () => observer.disconnect();
+ }, []);
+
+ useEffect(() => {
+ return () => {
+ spawnTimerRef.current.forEach((timer) => window.clearTimeout(timer));
+ spawnTimerRef.current = [];
+ };
+ }, []);
+
+ const advanceSpawn = useCallback((id: string, nextPhase: SpawnPhase) => {
+ setSpawns((current) => current.map((spawn) => (spawn.id === id ? { ...spawn, phase: nextPhase } : spawn)));
}, []);
- const advanceSpawn = (id: string, nextPhase: SpawnPhase) => {
- setSpawns((curr) => curr.map((s) => (s.id === id ? { ...s, phase: nextPhase } : s)));
- };
+ const scheduleSpawnPhase = useCallback((id: string, nextPhase: SpawnPhase, delay: number) => {
+ const timer = window.setTimeout(() => advanceSpawn(id, nextPhase), delay);
+ spawnTimerRef.current.push(timer);
+ }, [advanceSpawn]);
- const handleSpawn = (taskText: string) => {
- const id = `spawn-${++spawnCounter}-${Date.now()}`;
- const color = TASK_COLORS[spawnCounter % TASK_COLORS.length];
+ const handleSpawn = useCallback((taskText: string) => {
+ spawnCounterRef.current += 1;
+ const id = `spawn-${spawnCounterRef.current}-${Date.now()}`;
+ const color = TASK_COLORS[spawnCounterRef.current % TASK_COLORS.length];
const label = taskText.slice(0, 40);
const padding = 60;
- const target = {
- x: padding + Math.random() * (desktopSize.w - padding * 2),
- y: 90 + Math.random() * (desktopSize.h - 160),
- };
+ const targetX = padding + Math.random() * Math.max(1, desktopSize.w - padding * 2);
+ const targetY = 90 + Math.random() * Math.max(1, desktopSize.h - 160);
const curveSide = Math.random() > 0.5 ? 1 : -1;
- setSpawns((curr) => [...curr, { id, color, label, target, phase: 'emerge', curveSide, startedAt: Date.now() }]);
- setSpawnInputOpen(false);
+ setSpawns((current) => [
+ ...current,
+ {
+ id,
+ color,
+ label,
+ target: { x: targetX, y: targetY },
+ phase: 'travel',
+ curveSide,
+ startedAt: Date.now(),
+ },
+ ]);
+
+ scheduleSpawnPhase(id, 'shake-left', 900);
+ scheduleSpawnPhase(id, 'shake-right', 1250);
+ scheduleSpawnPhase(id, 'working', 1600);
+ }, [desktopSize.h, desktopSize.w, scheduleSpawnPhase]);
+
+ const handleSubmit = useCallback((event: FormEvent<HTMLFormElement>) => {
+ event.preventDefault();
+
+ const taskText = promptText.trim();
+ if (!taskText) return;
+
+ handleSpawn(taskText);
+ setPromptText('');
+ promptInputRef.current?.focus();
+ }, [handleSpawn, promptText]);
- setTimeout(() => advanceSpawn(id, 'travel'), 500);
- setTimeout(() => advanceSpawn(id, 'shake-left'), 500 + 900);
- setTimeout(() => advanceSpawn(id, 'shake-right'), 500 + 900 + 350);
- setTimeout(() => advanceSpawn(id, 'working'), 500 + 900 + 350 + 350);
- };
+ const isNotchExpanded = notchExpanded || state === 'expanded-pinned';
return (
- <div style={{ background: '#f5f3ee', minHeight: '100vh' }} className="px-6 py-10">
- <div className="max-w-[1280px] mx-auto">
- <header className="mb-10" />
-
- <div className="mb-8">
- <MacDesktop
- state={state}
- activeTaskId={activeTaskId}
- runningTaskIds={runningTaskIds}
- hovering={hovering}
- setHovering={setHovering}
- spawns={spawns}
- onRequestSpawn={handleSpawn}
- spawnInputOpen={spawnInputOpen}
- onCloseSpawnInput={() => setSpawnInputOpen(false)}
- desktopRef={desktopRef}
- desktopSize={desktopSize}
- />
- <div className="mt-3 flex items-center justify-center gap-3 text-xs text-gray-400">
- <button
- type="button"
- onClick={() => setSpawnInputOpen((v) => !v)}
- className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md border border-[#e5e3dc] bg-white hover:bg-gray-50 text-gray-700 transition"
- >
- <Plus size={12} />
- <span className="text-[11px] font-medium">New task</span>
- <span className="text-[9px] text-gray-400 font-mono ml-1">↵ to start</span>
- </button>
- {spawns.length > 0 && (
- <button
- type="button"
- onClick={() => setSpawns([])}
- className="text-[11px] text-gray-500 hover:text-gray-800 underline underline-offset-2"
- >
- clear {spawns.length} tasks
- </button>
- )}
- <span className="text-gray-400">·</span>
- <span>{hovering ? 'move away to collapse' : 'hover the notch to expand'}</span>
- </div>
- </div>
-
- <DemoControls
- state={state}
- setState={setState}
- activeTaskId={activeTaskId}
- setActiveTaskId={setActiveTaskId}
- />
-
- <div className="mt-10 pt-6 border-t border-gray-200 grid grid-cols-1 md:grid-cols-3 gap-6 text-[13px] text-gray-600">
- <div>
- <div className="font-medium text-gray-900 mb-1">Resting</div>
- <p className="leading-relaxed">Small pill, task color + live activity bars. Does not compete with your work.</p>
- </div>
- <div>
- <div className="font-medium text-gray-900 mb-1">Attention</div>
- <p className="leading-relaxed">Bulges with the task color. Check badge = done. Pulsing pink halo = needs you.</p>
- </div>
- <div>
- <div className="font-medium text-gray-900 mb-1">Expanded</div>
- <p className="leading-relaxed">Current work, statuses, and a task prompt. Background dims so focus stays on the task.</p>
- </div>
- </div>
- </div>
+ <div className="relative min-h-screen">
+ <MacDesktop
+ state={state}
+ activeTaskId={activeTaskId}
+ notchExpanded={isNotchExpanded}
+ setNotchExpanded={setNotchExpanded}
+ promptText={promptText}
+ setPromptText={setPromptText}
+ promptInputRef={promptInputRef}
+ promptTextHeight={promptTextHeight}
+ promptExpanded={promptExpanded}
+ onPromptSubmit={handleSubmit}
+ desktopRef={desktopRef}
+ desktopSize={desktopSize}
+ spawns={spawns}
+ onRequestSpawn={handleSpawn}
+ />
+ <DemoControls
+ state={state}
+ setState={setState}
+ activeTaskId={activeTaskId}
+ setActiveTaskId={setActiveTaskId}
+ spawnCount={spawns.length}
+ onClearSpawns={() => setSpawns([])}
+ />
</div>
);
}
diff --git a/site/src/app/prototype/_components/DemoControls.tsx b/site/src/app/prototype/_components/DemoControls.tsx
index d5caab52..c6d725eb 100644
--- a/site/src/app/prototype/_components/DemoControls.tsx
+++ b/site/src/app/prototype/_components/DemoControls.tsx
@@ -1,6 +1,5 @@
-import { Check } from 'lucide-react';
+import { Check, Trash2 } from 'lucide-react';
-import { ControlButton } from '@/app/prototype/_components/ControlButton';
import { TaskArrow } from '@/app/prototype/_components/TaskArrow';
import { ALL_TASK_IDS, TASKS } from '@/app/prototype/_components/tasks';
import type { NotchState, TaskId } from '@/app/prototype/_components/types';
@@ -10,81 +9,98 @@ type Props = {
setState: (state: NotchState) => void;
activeTaskId: TaskId;
setActiveTaskId: (id: TaskId) => void;
+ spawnCount: number;
+ onClearSpawns: () => void;
};
type StateOption = {
id: NotchState;
label: string;
- desc: string;
- accent?: string;
};
-export function DemoControls({ state, setState, activeTaskId, setActiveTaskId }: Props) {
- const stateOptions: StateOption[] = [
- { id: 'idle', label: 'Idle', desc: 'Nothing running' },
- { id: 'running-single', label: 'Running', desc: 'One task active', accent: TASKS[activeTaskId].color },
- { id: 'running-multi', label: 'Busy', desc: '3 tasks in motion' },
- { id: 'complete', label: 'Task complete', desc: 'Bulge + check', accent: TASKS[activeTaskId].color },
- { id: 'needs-input', label: 'Needs your input', desc: 'Pulsing · persistent', accent: TASKS[activeTaskId].color },
- { id: 'expanded-pinned', label: 'Expanded (pinned)', desc: 'Force-open the panel' },
- ];
+const STATE_OPTIONS: StateOption[] = [
+ { id: 'idle', label: 'Idle' },
+ { id: 'running-single', label: 'Run' },
+ { id: 'running-multi', label: 'Busy' },
+ { id: 'complete', label: 'Done' },
+ { id: 'needs-input', label: 'Ask' },
+ { id: 'expanded-pinned', label: 'Open' },
+];
+export function DemoControls({
+ state,
+ setState,
+ activeTaskId,
+ setActiveTaskId,
+ spawnCount,
+ onClearSpawns,
+}: Props) {
return (
- <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
- <div className="bg-white rounded-xl border p-5" style={{ borderColor: '#e5e3dc' }}>
- <div className="flex items-center justify-between mb-4">
- <div>
- <h2 className="font-medium text-[15px]">Notch state</h2>
- <p className="text-xs text-gray-500 mt-0.5">Click to switch states</p>
- </div>
- <div className="font-mono text-[10px] text-gray-400 uppercase tracking-wider">{state}</div>
- </div>
- <div className="grid grid-cols-2 gap-2">
- {stateOptions.map((opt) => (
- <ControlButton key={opt.id} active={state === opt.id} onClick={() => setState(opt.id)} accent={opt.accent}>
- <div className="font-medium text-[13px]">{opt.label}</div>
- <div className="text-[11px] opacity-60 mt-0.5">{opt.desc}</div>
- </ControlButton>
- ))}
- </div>
+ <aside
+ aria-label="Prototype controls"
+ className="fixed bottom-5 left-1/2 z-50 flex max-w-[calc(100vw-40px)] -translate-x-1/2 items-center gap-3 rounded-xl border border-white/10 bg-black/70 px-3 py-2 text-white shadow-2xl backdrop-blur-xl"
+ >
+ <div className="flex items-center gap-1.5">
+ {STATE_OPTIONS.map((option) => {
+ const active = state === option.id;
+
+ return (
+ <button
+ key={option.id}
+ type="button"
+ onClick={() => setState(option.id)}
+ className="h-8 rounded-lg px-2.5 text-[11px] font-medium transition"
+ style={{
+ background: active ? 'rgba(255,255,255,0.92)' : 'rgba(255,255,255,0.08)',
+ color: active ? 'rgba(0,0,0,0.82)' : 'rgba(255,255,255,0.72)',
+ }}
+ >
+ {option.label}
+ </button>
+ );
+ })}
</div>
- <div className="bg-white rounded-xl border p-5" style={{ borderColor: '#e5e3dc' }}>
- <div className="flex items-center justify-between mb-4">
- <div>
- <h2 className="font-medium text-[15px]">Sample task</h2>
- <p className="text-xs text-gray-500 mt-0.5">Drives the color & message</p>
- </div>
- <div className="font-mono text-[10px] text-gray-400 uppercase tracking-wider">{activeTaskId}</div>
- </div>
- <div className="grid grid-cols-1 gap-1.5">
- {ALL_TASK_IDS.map((id) => {
- const task = TASKS[id];
- const isSelected = activeTaskId === id;
- return (
- <button
- type="button"
- key={id}
- onClick={() => setActiveTaskId(id)}
- className="px-2.5 py-2 rounded-lg flex items-center gap-2.5 transition-all border"
- style={{
- background: isSelected ? '#fafaf6' : '#fff',
- borderColor: isSelected ? task.color : '#e5e3dc',
- }}
- >
- <div className="w-6 h-6 flex items-center justify-center flex-shrink-0">
- <TaskArrow color={task.color} size={18} />
- </div>
- <div className="flex-1 text-left min-w-0">
- <div className="text-[12px] font-medium">{task.label}</div>
- <div className="text-[10px] text-gray-500 truncate">{task.detail}</div>
- </div>
- {isSelected && <Check size={14} color={task.color} />}
- </button>
- );
- })}
- </div>
+ <div className="h-7 w-px bg-white/10" />
+
+ <div className="flex items-center gap-1.5">
+ {ALL_TASK_IDS.map((id) => {
+ const task = TASKS[id];
+ const active = activeTaskId === id;
+
+ return (
+ <button
+ key={id}
+ type="button"
+ onClick={() => setActiveTaskId(id)}
+ className="grid h-8 w-8 place-items-center rounded-lg transition"
+ style={{
+ background: active ? `${task.color}33` : 'rgba(255,255,255,0.08)',
+ boxShadow: active ? `inset 0 0 0 1px ${task.color}` : 'inset 0 0 0 1px transparent',
+ }}
+ aria-label={task.label}
+ >
+ {active ? <Check size={14} color={task.color} /> : <TaskArrow color={task.color} size={15} />}
+ </button>
+ );
+ })}
</div>
- </div>
+
+ {spawnCount > 0 && (
+ <>
+ <div className="h-7 w-px bg-white/10" />
+ <div className="flex items-center gap-1.5">
+ <button
+ type="button"
+ onClick={onClearSpawns}
+ className="inline-flex h-8 items-center gap-1.5 rounded-lg bg-white/[0.08] px-2 text-[11px] font-medium text-white/[0.72] transition hover:bg-white/[0.14]"
+ >
+ <Trash2 size={12} />
+ {spawnCount}
+ </button>
+ </div>
+ </>
+ )}
+ </aside>
);
}
diff --git a/site/src/app/prototype/_components/MacDesktop.tsx b/site/src/app/prototype/_components/MacDesktop.tsx
index bd3ce3ba..44a35a6c 100644
--- a/site/src/app/prototype/_components/MacDesktop.tsx
+++ b/site/src/app/prototype/_components/MacDesktop.tsx
@@ -1,103 +1,203 @@
-import { Apple, Wifi, BatteryFull } from 'lucide-react';
+import type { FormEvent, RefObject } from 'react';
import { Notch } from '@/app/prototype/_components/Notch';
import { SpawnedCursor } from '@/app/prototype/_components/SpawnedCursor';
-import { SpawnInputOverlay } from '@/app/prototype/_components/SpawnInputOverlay';
-import { TaskArrow } from '@/app/prototype/_components/TaskArrow';
-import { ALL_TASK_IDS, TASKS } from '@/app/prototype/_components/tasks';
-import type { DesktopRef, DesktopSize, NotchState, SetHovering, Spawn, TaskId } from '@/app/prototype/_components/types';
+import type { DesktopSize, NotchState, Spawn, TaskId } from '@/app/prototype/_components/types';
type Props = {
state: NotchState;
activeTaskId: TaskId;
- runningTaskIds: TaskId[];
- hovering: boolean;
- setHovering: SetHovering;
+ notchExpanded: boolean;
+ setNotchExpanded: (expanded: boolean) => void;
+ promptText: string;
+ setPromptText: (text: string) => void;
+ promptInputRef: RefObject<HTMLTextAreaElement | null>;
+ promptTextHeight: number;
+ promptExpanded: boolean;
+ onPromptSubmit: (event: FormEvent<HTMLFormElement>) => void;
+ desktopRef: RefObject<HTMLElement | null>;
+ desktopSize: DesktopSize;
spawns: Spawn[];
onRequestSpawn: (taskText: string) => void;
- spawnInputOpen: boolean;
- onCloseSpawnInput: () => void;
- desktopRef: DesktopRef;
- desktopSize: DesktopSize;
};
+const LAYOUT = {
+ contentWidth: 592,
+ contentExtraHeight: 8,
+ stageHorizontalPadding: 8,
+ stageVerticalPadding: 10,
+ composerWidth: 576,
+ composerCornerRadius: 22,
+ composerInputMinimumHeight: 66,
+ composerInputLeadingContentPadding: 20,
+ composerInputTrailingContentPadding: 8,
+ composerWaveformWidth: 54,
+ composerWaveformHeight: 28,
+ composerWrappingTextWidth: 482,
+ composerExpandedTextWidth: 528,
+ composerExpandedTextTopPadding: 18,
+ composerExpandedTextHorizontalPadding: 24,
+ composerExpandedToolbarHeight: 54,
+ composerExpandedMinimumHeight: 156,
+} as const;
+
+const WAVEFORM_LEVELS = [0.12, 0.2, 0.34, 0.5, 0.34, 0.2, 0.12] as const;
+
+function waveformHeight(level: number) {
+ return 5 + level * 24;
+}
+
export function MacDesktop({
state,
activeTaskId,
- runningTaskIds,
- hovering,
- setHovering,
- spawns,
- onRequestSpawn,
- spawnInputOpen,
- onCloseSpawnInput,
+ notchExpanded,
+ setNotchExpanded,
+ promptText,
+ setPromptText,
+ promptInputRef,
+ promptTextHeight,
+ promptExpanded,
+ onPromptSubmit,
desktopRef,
desktopSize,
+ spawns,
+ onRequestSpawn,
}: Props) {
- const isExpanded = hovering || state === 'expanded-pinned';
- const notchAnchor = { x: desktopSize.w / 2, y: 24 };
+ const composerHeight = promptExpanded
+ ? Math.max(
+ LAYOUT.composerExpandedMinimumHeight,
+ promptTextHeight + LAYOUT.composerExpandedTextTopPadding + LAYOUT.composerExpandedToolbarHeight,
+ )
+ : LAYOUT.composerInputMinimumHeight;
+ const hostHeight = LAYOUT.stageVerticalPadding * 2 + composerHeight + LAYOUT.contentExtraHeight;
+ const spawnOrigin = { x: desktopSize.w / 2, y: -36 };
return (
- <div ref={desktopRef} className="relative w-full overflow-hidden rounded-2xl border border-black/10" style={{ aspectRatio: '16 / 10' }}>
+ <main
+ ref={desktopRef}
+ className="relative min-h-screen overflow-hidden bg-[#121419] text-white"
+ style={{ fontFamily: '-apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif' }}
+ >
+ <div
+ className="absolute inset-0"
+ style={{
+ background:
+ 'linear-gradient(145deg, rgba(44,66,78,0.82) 0%, rgba(20,21,26,0.96) 45%, rgba(33,36,51,0.92) 100%)',
+ }}
+ />
<div
className="absolute inset-0"
style={{
- backgroundImage:
- 'radial-gradient(circle at 20% 30%, rgba(120,100,200,0.25) 0%, transparent 50%), radial-gradient(circle at 80% 70%, rgba(80,140,200,0.2) 0%, transparent 50%), linear-gradient(180deg, #2d2a4a 0%, #1a1d29 100%)',
+ background:
+ 'linear-gradient(180deg, rgba(0,0,0,0.18) 0%, rgba(0,0,0,0) 26%, rgba(0,0,0,0.32) 100%)',
}}
/>
<div
- className="absolute top-0 left-0 right-0 h-7 flex items-center px-4 gap-4 text-[11px] text-white/85"
- style={{ background: 'rgba(20,22,30,0.5)', backdropFilter: 'blur(10px)' }}
+ className="absolute left-0 right-0 top-0 z-10 flex h-7 items-center gap-4 px-4 text-[13px] text-white/[0.72]"
+ style={{
+ background: 'rgba(11,12,15,0.55)',
+ backdropFilter: 'blur(14px)',
+ }}
>
- <Apple size={13} fill="currentColor" />
- <span className="font-medium">Finder</span>
+ <span className="font-medium text-white/[0.88]">Donkey</span>
<span>File</span>
<span>Edit</span>
<span>View</span>
<span>Go</span>
<span>Window</span>
<span>Help</span>
- <div className="ml-auto flex items-center gap-3.5">
- <Wifi size={13} />
- <BatteryFull size={13} />
- <span>Sun 5:02 PM</span>
- </div>
</div>
- {isExpanded && <div className="absolute inset-0 bg-black/40 z-10 transition-opacity duration-300" />}
-
- <Notch state={state} activeTaskId={activeTaskId} hovering={hovering} setHovering={setHovering} runningTaskIds={runningTaskIds} />
+ <Notch
+ state={state}
+ activeTaskId={activeTaskId}
+ expanded={notchExpanded}
+ setExpanded={setNotchExpanded}
+ onRequestSpawn={onRequestSpawn}
+ />
- {spawns.map((s) => (
- <SpawnedCursor key={s.id} spawn={s} notchAnchor={notchAnchor} />
+ {spawns.map((spawn) => (
+ <SpawnedCursor key={spawn.id} spawn={spawn} spawnOrigin={spawnOrigin} />
))}
- {spawnInputOpen && <SpawnInputOverlay onSubmit={onRequestSpawn} onClose={onCloseSpawnInput} />}
-
- <div
- className="absolute bottom-3 left-1/2 -translate-x-1/2 rounded-2xl px-3 py-1.5 flex gap-2 transition-opacity duration-300"
+ <section
+ aria-label="Donkey prompt"
+ className="absolute left-1/2 top-1/2 z-20"
style={{
- background: 'rgba(255,255,255,0.15)',
- border: '0.5px solid rgba(255,255,255,0.25)',
- backdropFilter: 'blur(20px) saturate(180%)',
- opacity: isExpanded ? 0.5 : 1,
+ width: LAYOUT.contentWidth,
+ height: hostHeight,
+ padding: `${LAYOUT.stageVerticalPadding}px ${LAYOUT.stageHorizontalPadding}px`,
+ transform: 'translate(-50%, -50%)',
}}
>
- {ALL_TASK_IDS.map((id) => {
- const task = TASKS[id];
- const isRunning = runningTaskIds.includes(id);
- return (
- <div key={id} className="relative">
- <div className="w-8 h-8 flex items-center justify-center">
- <TaskArrow color={task.color} size={22} />
- </div>
- {isRunning && <div className="absolute -bottom-1 left-1/2 -translate-x-1/2 w-1 h-1 rounded-full bg-white" />}
- </div>
- );
- })}
- </div>
- </div>
+ <form
+ onSubmit={onPromptSubmit}
+ className="relative bg-black"
+ style={{
+ width: LAYOUT.composerWidth,
+ height: composerHeight,
+ borderRadius: promptExpanded ? LAYOUT.composerCornerRadius : 999,
+ boxShadow: `0 5px 12px rgba(0,0,0,0.2), inset 0 0 0 1px ${
+ promptExpanded ? 'rgba(255,255,255,0.28)' : 'rgba(255,255,255,0.34)'
+ }`,
+ transition: 'height 160ms ease-out, border-radius 160ms ease-out',
+ }}
+ >
+ <label className="sr-only" htmlFor="donkey-prompt-input">
+ Prompt
+ </label>
+ <textarea
+ id="donkey-prompt-input"
+ ref={promptInputRef}
+ rows={1}
+ value={promptText}
+ onChange={(event) => setPromptText(event.target.value)}
+ placeholder="What can donkey do for you?"
+ className="absolute resize-none overflow-hidden border-0 bg-transparent p-0 text-[16px] font-light leading-[19.2px] text-white outline-none placeholder:text-white/[0.58]"
+ style={{
+ left: promptExpanded
+ ? LAYOUT.composerExpandedTextHorizontalPadding
+ : LAYOUT.composerInputLeadingContentPadding,
+ top: promptExpanded
+ ? LAYOUT.composerExpandedTextTopPadding
+ : (LAYOUT.composerInputMinimumHeight - promptTextHeight) / 2,
+ width: promptExpanded ? LAYOUT.composerExpandedTextWidth : LAYOUT.composerWrappingTextWidth,
+ height: promptTextHeight,
+ caretColor: 'white',
+ fontVariantLigatures: 'none',
+ }}
+ onKeyDown={(event) => {
+ if (event.key === 'Enter' && !event.shiftKey) {
+ event.preventDefault();
+ event.currentTarget.form?.requestSubmit();
+ }
+ }}
+ />
+ <div
+ className="absolute flex items-center justify-center gap-1"
+ style={{
+ right: promptExpanded
+ ? LAYOUT.composerExpandedTextHorizontalPadding
+ : LAYOUT.composerInputTrailingContentPadding,
+ top: promptExpanded
+ ? composerHeight - LAYOUT.composerExpandedToolbarHeight + (LAYOUT.composerExpandedToolbarHeight - LAYOUT.composerWaveformHeight) / 2
+ : (LAYOUT.composerInputMinimumHeight - LAYOUT.composerWaveformHeight) / 2,
+ width: LAYOUT.composerWaveformWidth,
+ height: LAYOUT.composerWaveformHeight,
+ }}
+ aria-hidden="true"
+ >
+ {WAVEFORM_LEVELS.map((level, index) => (
+ <span
+ key={`${level}-${index}`}
+ className="w-1 rounded-full bg-white"
+ style={{ height: waveformHeight(level) }}
+ />
+ ))}
+ </div>
+ </form>
+ </section>
+ </main>
);
}
diff --git a/site/src/app/prototype/_components/Notch.tsx b/site/src/app/prototype/_components/Notch.tsx
index f6d44142..febe9b11 100644
--- a/site/src/app/prototype/_components/Notch.tsx
+++ b/site/src/app/prototype/_components/Notch.tsx
@@ -1,157 +1,232 @@
-import { MousePointer2, Plus, Sparkles } from 'lucide-react';
+import { ArrowUp, Check, CircleAlert, Pause, Play } from 'lucide-react';
+import type { FormEvent } from 'react';
-import { ActivityBars } from '@/app/prototype/_components/ActivityBars';
import { TaskArrow } from '@/app/prototype/_components/TaskArrow';
-import { ALL_TASK_IDS, TASKS } from '@/app/prototype/_components/tasks';
-import type { NotchState, SetHovering, TaskId } from '@/app/prototype/_components/types';
+import { TASKS } from '@/app/prototype/_components/tasks';
+import type { NotchState, TaskId } from '@/app/prototype/_components/types';
type Props = {
state: NotchState;
activeTaskId: TaskId;
- hovering: boolean;
- setHovering: SetHovering;
- runningTaskIds: TaskId[];
+ expanded: boolean;
+ setExpanded: (expanded: boolean) => void;
+ onRequestSpawn: (taskText: string) => void;
};
-const NOTCH = {
- restWidth: 110,
- restHeight: 28,
- cornerRadius: 14,
- expandedWidth: 480,
- expandedHeight: 280,
- expandedRadius: 26,
+const METRICS = {
+ collapsedWidth: 248,
+ collapsedHeight: 32,
+ expandedWidth: 604,
+ expandedHeight: 312,
+ expandedContentHeight: 280,
+ collapsedCornerRadius: 14,
+ expandedCornerRadius: 26,
+ contentInset: 14,
} as const;
-const EASE = 'cubic-bezier(0.22, 1, 0.36, 1)';
-const DURATION = '0.55s';
+type RowStatus = 'running' | 'completed' | 'needsAttention';
-export function Notch({ state, activeTaskId, hovering, setHovering, runningTaskIds }: Props) {
+type TaskRow = {
+ id: string;
+ title: string;
+ detail: string;
+ color: string;
+ status: RowStatus;
+};
+
+function taskRowsForState(state: NotchState, activeTaskId: TaskId): TaskRow[] {
const activeTask = TASKS[activeTaskId];
- const isExpanded = hovering || state === 'expanded-pinned';
- const surfaceWidth = isExpanded ? NOTCH.expandedWidth : NOTCH.restWidth;
- const surfaceHeight = isExpanded ? NOTCH.expandedHeight : NOTCH.restHeight;
- const surfaceRadius = isExpanded ? NOTCH.expandedRadius : NOTCH.cornerRadius;
+ const activeTitle = activeTask.label;
+
+ if (state === 'idle') {
+ return [];
+ }
+
+ if (state === 'running-multi') {
+ return [
+ { id: 'compare', title: TASKS.compare.label, detail: 'Running', color: TASKS.compare.color, status: 'running' },
+ { id: 'research', title: TASKS.research.label, detail: 'Running', color: TASKS.research.color, status: 'running' },
+ { id: 'schedule', title: TASKS.schedule.label, detail: 'Running', color: TASKS.schedule.color, status: 'running' },
+ ];
+ }
+
+ if (state === 'complete') {
+ return [
+ { id: activeTask.id, title: activeTitle, detail: 'Done', color: activeTask.color, status: 'completed' },
+ { id: 'weather', title: "Find tomorrow's weather", detail: 'Done', color: TASKS.schedule.color, status: 'completed' },
+ ];
+ }
+
+ if (state === 'needs-input') {
+ return [
+ { id: activeTask.id, title: activeTitle, detail: 'Needs attention', color: activeTask.color, status: 'needsAttention' },
+ { id: 'weather', title: "Find tomorrow's weather", detail: 'Done', color: TASKS.schedule.color, status: 'completed' },
+ ];
+ }
+
+ return [
+ { id: activeTask.id, title: activeTitle, detail: 'Running', color: activeTask.color, status: 'running' },
+ { id: 'weather', title: "Find tomorrow's weather", detail: 'Done', color: TASKS.schedule.color, status: 'completed' },
+ ];
+}
+
+function collapsedStatusText(state: NotchState) {
+ if (state === 'idle') return 'Idle';
+ if (state === 'complete') return 'Done';
+ if (state === 'needs-input') return 'Ask';
+
+ return 'Run';
+}
+
+export function Notch({ state, activeTaskId, expanded, setExpanded, onRequestSpawn }: Props) {
+ const rows = taskRowsForState(state, activeTaskId);
+ const activeColor = rows[0]?.color ?? 'rgb(29,158,117)';
+
+ const handleFollowUpSubmit = (event: FormEvent<HTMLFormElement>) => {
+ event.preventDefault();
+
+ const form = event.currentTarget;
+ const formData = new FormData(form);
+ const taskText = String(formData.get('followUp') ?? '').trim();
+ if (!taskText) return;
+
+ onRequestSpawn(taskText);
+ form.reset();
+ };
return (
- <div
- className="absolute top-0 left-1/2 -translate-x-1/2 z-20"
+ <section
+ aria-label="Donkey status"
+ className="absolute left-1/2 top-0 z-30 -translate-x-1/2 overflow-hidden focus:outline-none"
style={{
- width: isExpanded ? `${NOTCH.expandedWidth + 40}px` : `${NOTCH.restWidth + 60}px`,
- height: isExpanded ? `${NOTCH.expandedHeight + 20}px` : `${NOTCH.restHeight + 20}px`,
- transition: `width ${DURATION} ${EASE}, height ${DURATION} ${EASE}`,
+ width: expanded ? METRICS.expandedWidth : METRICS.collapsedWidth,
+ height: expanded ? METRICS.expandedHeight : METRICS.collapsedHeight,
+ borderBottomLeftRadius: expanded ? METRICS.expandedCornerRadius : METRICS.collapsedCornerRadius,
+ borderBottomRightRadius: expanded ? METRICS.expandedCornerRadius : METRICS.collapsedCornerRadius,
+ transition: 'width 220ms ease-out, height 220ms ease-out, border-radius 220ms ease-out',
}}
- onMouseEnter={() => setHovering(true)}
- onMouseLeave={() => setHovering(false)}
+ tabIndex={0}
+ onClick={() => setExpanded(true)}
+ onFocus={() => setExpanded(true)}
+ onPointerEnter={() => setExpanded(true)}
+ onPointerLeave={() => setExpanded(false)}
+ onMouseEnter={() => setExpanded(true)}
+ onMouseLeave={() => setExpanded(false)}
>
<div
- className="absolute top-0 left-1/2 overflow-hidden bg-black text-white"
+ className="absolute left-1/2 top-0 overflow-hidden bg-black text-white"
style={{
- width: `${surfaceWidth}px`,
- height: `${surfaceHeight}px`,
+ width: expanded ? METRICS.expandedWidth : METRICS.collapsedWidth,
+ height: expanded ? METRICS.expandedHeight : METRICS.collapsedHeight,
transform: 'translateX(-50%)',
- borderTopLeftRadius: 0,
- borderTopRightRadius: 0,
- borderBottomLeftRadius: `${surfaceRadius}px`,
- borderBottomRightRadius: `${surfaceRadius}px`,
- boxShadow: isExpanded
- ? '0 24px 48px -12px rgba(0,0,0,0.5), 0 8px 16px -8px rgba(0,0,0,0.3)'
- : 'none',
- outline: '1px dashed rgba(255,36,148,0.95)',
- outlineOffset: '-1px',
- transition: [
- `width ${DURATION} ${EASE}`,
- `height ${DURATION} ${EASE}`,
- `border-radius ${DURATION} ${EASE}`,
- `box-shadow ${DURATION} ${EASE}`,
- ].join(', '),
- zIndex: 30,
+ borderBottomLeftRadius: expanded ? METRICS.expandedCornerRadius : METRICS.collapsedCornerRadius,
+ borderBottomRightRadius: expanded ? METRICS.expandedCornerRadius : METRICS.collapsedCornerRadius,
+ boxShadow: expanded ? '0 12px 24px rgba(0,0,0,0.5)' : '0 0 0 rgba(0,0,0,0)',
+ transition:
+ 'width 550ms cubic-bezier(0.2,0.9,0.24,1), height 550ms cubic-bezier(0.2,0.9,0.24,1), border-radius 550ms cubic-bezier(0.2,0.9,0.24,1), box-shadow 300ms ease-out',
}}
>
<div
- className="absolute inset-0 flex items-center pl-3.5 pr-3.5"
+ className="absolute inset-0"
style={{
- opacity: isExpanded ? 0 : 1,
- transition: `opacity 0.15s ${EASE}`,
+ opacity: expanded ? 0 : 1,
+ transition: 'opacity 150ms ease-out',
pointerEvents: 'none',
}}
>
- <MousePointer2
- size={14}
- color="#fff"
- fill="#fff"
- strokeWidth={0}
- style={{ transform: 'rotate(-8deg)' }}
+ <TaskArrow
+ color={activeColor}
+ size={13}
+ className="absolute top-[9.5px] left-[10.5px] -rotate-45"
/>
+ <span className="absolute right-0 top-0 grid h-8 w-[34px] place-items-center text-[9px] leading-none text-white/[0.72]">
+ {collapsedStatusText(state)}
+ </span>
</div>
<div
- className="absolute inset-0 flex flex-col"
+ className="absolute left-0 flex flex-col gap-2"
style={{
- opacity: isExpanded ? 1 : 0,
- padding: 18,
- pointerEvents: isExpanded ? 'auto' : 'none',
- transition: isExpanded ? `opacity 0.3s ${EASE} 0.15s` : `opacity 0.1s ${EASE}`,
+ top: METRICS.collapsedHeight,
+ width: METRICS.expandedWidth,
+ height: METRICS.expandedContentHeight,
+ padding: `0 ${METRICS.contentInset}px ${METRICS.contentInset}px`,
+ opacity: expanded ? 1 : 0,
+ pointerEvents: expanded ? 'auto' : 'none',
+ transition: expanded ? 'opacity 300ms ease-out 150ms' : 'opacity 100ms ease-out',
}}
>
- <div className="flex items-center gap-2 border-b border-white/10 pb-2.5">
- <TaskArrow color={activeTask.color} size={14} className="-rotate-45" />
- <span className="text-[12px] text-white/95">Donkey</span>
- <span className="text-[11px] text-white/45 ml-0.5">
- {state === 'idle' ? 'ready' : activeTask.label.toLowerCase()}
- </span>
- <div className="ml-auto flex items-center gap-1 text-[10px] text-white/45 hover:text-white/80 cursor-pointer">
- <Plus size={11} />
- <span>new task</span>
- </div>
- </div>
-
- <div className="grid grid-cols-5 gap-2 py-3">
- {ALL_TASK_IDS.map((id) => {
- const task = TASKS[id];
- const isRunning = runningTaskIds.includes(id);
- const isActiveStateTask = activeTaskId === id && (state === 'complete' || state === 'needs-input');
- let statusLabel = isRunning ? 'running' : 'idle';
- let statusColor = isRunning ? task.color : 'rgba(255,255,255,0.4)';
- if (isActiveStateTask && state === 'complete') statusLabel = 'done';
- if (isActiveStateTask && state === 'needs-input') {
- statusLabel = 'needs you';
- statusColor = task.color;
- }
-
- return (
- <div
- key={id}
- className="flex min-w-0 flex-col items-center gap-1.5 rounded-md border border-white/[0.06] bg-white/[0.04] px-1 py-2 transition hover:-translate-y-px hover:bg-white/[0.07]"
- style={isRunning ? { background: `${task.color}1A` } : undefined}
+ <div className="min-h-0 flex-1 overflow-hidden pt-2.5">
+ <div className="flex flex-col gap-2">
+ {rows.map((task) => (
+ <article
+ key={task.id}
+ className="flex h-12 items-center gap-3 rounded-lg bg-white/[0.055] px-3"
>
- <div
- className="flex h-6 w-6 items-center justify-center rounded-md"
- style={{ background: task.color }}
- >
- <TaskArrow color="#fff" size={13} className="-rotate-45" />
+ <TaskArrow color={task.color} size={14} className="-rotate-45" />
+ <div className="min-w-0 flex-1">
+ <h2 className="truncate text-[13px] font-normal leading-4 text-white/[0.9]">{task.title}</h2>
+ <p className="mt-1 truncate text-[12px] font-normal leading-[14px] text-white/[0.42]">{task.detail}</p>
</div>
- <span className="max-w-full truncate text-[10px] text-white/75">{task.label.split(' ')[0]}</span>
- <span
- className="max-w-full truncate rounded px-1 py-px text-[8px]"
- style={{
- background: `${statusColor}30`,
- color: statusColor === 'rgba(255,255,255,0.4)' ? 'rgba(255,255,255,0.5)' : statusColor,
- }}
- >
- {statusLabel}
- </span>
- </div>
- );
- })}
+ {task.status === 'running' ? (
+ <div className="flex gap-1.5">
+ <button
+ type="button"
+ className="grid h-6 w-6 place-items-center rounded-full bg-white/[0.055] text-white/[0.3]"
+ aria-label="Resume"
+ disabled
+ >
+ <Play size={10} fill="currentColor" />
+ </button>
+ <button
+ type="button"
+ className="grid h-6 w-6 place-items-center rounded-full bg-white/[0.12] text-white/[0.88]"
+ aria-label="Pause"
+ >
+ <Pause size={10} fill="currentColor" />
+ </button>
+ </div>
+ ) : task.status === 'completed' ? (
+ <Check size={18} color={task.color} strokeWidth={1.35} />
+ ) : (
+ <CircleAlert size={18} color={task.color} strokeWidth={1.35} />
+ )}
+ </article>
+ ))}
+ </div>
</div>
- <div className="mt-auto flex items-center gap-2 rounded-md border border-white/[0.08] bg-white/[0.06] px-3 py-2.5">
- <Sparkles size={12} color="rgba(255,255,255,0.45)" />
- <span className="min-w-0 flex-1 truncate text-[12px] text-white/40">Tell Donkey what to do...</span>
- {state !== 'idle' && <ActivityBars color={activeTask.color} />}
- </div>
+ <form
+ className="relative h-[92px] w-[576px] rounded-[22px] bg-white/[0.085]"
+ onSubmit={handleFollowUpSubmit}
+ >
+ <label className="sr-only" htmlFor="donkey-follow-up-input">
+ Follow-up
+ </label>
+ <textarea
+ id="donkey-follow-up-input"
+ name="followUp"
+ rows={1}
+ placeholder="What can donkey do for you?"
+ className="absolute left-6 top-3 h-[19.2px] w-[528px] resize-none overflow-hidden border-0 bg-transparent p-0 text-[16px] font-light leading-[19.2px] text-white outline-none placeholder:text-white/[0.58]"
+ style={{ caretColor: 'white', fontVariantLigatures: 'none' }}
+ onKeyDown={(event) => {
+ if (event.key === 'Enter' && !event.shiftKey) {
+ event.preventDefault();
+ event.currentTarget.form?.requestSubmit();
+ }
+ }}
+ />
+ <button
+ type="submit"
+ className="absolute bottom-4 right-4 grid h-8 w-8 place-items-center rounded-full bg-white/[0.9] text-black/[0.75]"
+ aria-label="Send follow-up"
+ >
+ <ArrowUp size={16} strokeWidth={2} />
+ </button>
+ </form>
</div>
</div>
- </div>
+ </section>
);
}
diff --git a/site/src/app/prototype/_components/SpawnInputOverlay.tsx b/site/src/app/prototype/_components/SpawnInputOverlay.tsx
deleted file mode 100644
index dccca2b9..00000000
--- a/site/src/app/prototype/_components/SpawnInputOverlay.tsx
+++ /dev/null
@@ -1,70 +0,0 @@
-import { useCallback, useEffect, useRef, useState } from 'react';
-import { Sparkles } from 'lucide-react';
-import type { KeyboardEvent as ReactKeyboardEvent } from 'react';
-
-type Props = {
- onSubmit: (taskText: string) => void;
- onClose: () => void;
-};
-
-export function SpawnInputOverlay({ onSubmit, onClose }: Props) {
- const [text, setText] = useState('');
- const inputRef = useRef<HTMLInputElement | null>(null);
-
- useEffect(() => {
- setTimeout(() => inputRef.current?.focus(), 50);
- }, []);
-
- useEffect(() => {
- const handleWindowKey = (event: KeyboardEvent) => {
- if (event.key !== 'Escape') return;
-
- onClose();
- };
-
- window.addEventListener('keydown', handleWindowKey);
- return () => window.removeEventListener('keydown', handleWindowKey);
- }, [onClose]);
-
- const handleKey = useCallback((e: ReactKeyboardEvent<HTMLInputElement>) => {
- if (e.key === 'Enter' && text.trim()) {
- onSubmit(text.trim());
- setText('');
- } else if (e.key === 'Escape') {
- onClose();
- }
- }, [onClose, onSubmit, text]);
-
- return (
- <div
- className="absolute left-1/2 -translate-x-1/2 z-30"
- style={{ top: 56, animation: 'fadein-input 0.25s cubic-bezier(0.32, 0.72, 0, 1) both' }}
- >
- <style>{`
- @keyframes fadein-input {
- from { opacity: 0; transform: translate(-50%, -8px); }
- to { opacity: 1; transform: translate(-50%, 0); }
- }
- `}</style>
- <div className="bg-black/90 backdrop-blur rounded-xl px-3 py-2.5 flex items-center gap-2 shadow-xl border border-white/10" style={{ width: 360 }}>
- <Sparkles size={13} color="rgba(255,255,255,0.6)" />
- <input
- ref={inputRef}
- value={text}
- onChange={(e) => setText(e.target.value)}
- onKeyDown={handleKey}
- placeholder="Ask Donkey to…"
- className="bg-transparent border-0 outline-none flex-1 text-[12px] text-white placeholder-white/40"
- />
- <button
- type="button"
- onClick={() => text.trim() && (onSubmit(text.trim()), setText(''))}
- disabled={!text.trim()}
- className="text-[9px] text-white/70 px-1.5 py-px border border-white/15 rounded font-mono disabled:opacity-30"
- >
- ↵
- </button>
- </div>
- </div>
- );
-}
diff --git a/site/src/app/prototype/_components/SpawnedCursor.tsx b/site/src/app/prototype/_components/SpawnedCursor.tsx
index 8314f5a6..1c9b48e0 100644
--- a/site/src/app/prototype/_components/SpawnedCursor.tsx
+++ b/site/src/app/prototype/_components/SpawnedCursor.tsx
@@ -3,14 +3,14 @@ import type { Point, Spawn } from '@/app/prototype/_components/types';
type Props = {
spawn: Spawn;
- notchAnchor: Point;
+ spawnOrigin: Point;
};
-export function SpawnedCursor({ spawn, notchAnchor }: Props) {
+export function SpawnedCursor({ spawn, spawnOrigin }: Props) {
const { id, color, label, target, phase } = spawn;
- const sx = notchAnchor.x;
- const sy = notchAnchor.y;
+ const sx = spawnOrigin.x;
+ const sy = spawnOrigin.y;
const tx = target.x;
const ty = target.y;
const mx = (sx + tx) / 2;