Skip to content

Open source CapCut alternative.

TypeScript

chore(site): delete the notch prototype route

David Led8fc5f45d0d5
diff --git a/site/src/app/prototype/_components/App.tsx b/site/src/app/prototype/_components/App.tsx
deleted file mode 100644
index ea287cda..00000000
--- a/site/src/app/prototype/_components/App.tsx
+++ /dev/null
@@ -1,310 +0,0 @@
-'use client';
-
-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 {
- AUTH_ERROR_MESSAGE,
- INITIAL_LIVE_TASKS,
- MAX_LIVE_TASKS,
- SAMPLE_SUBTEXTS,
- TASK_COLORS,
- TASK_DONE_AT_SECONDS,
- UPDATE_MESSAGES,
-} from '@/app/prototype/_components/tasks';
-import type { LiveTask, NotchState, NotchUpdate, NotchVariant, TaskId } from '@/app/prototype/_components/types';
-
-const firstRunning = INITIAL_LIVE_TASKS.find((task) => task.status === 'running');
-const INITIAL_UPDATE: NotchUpdate | null = firstRunning
- ? { color: firstRunning.color, message: firstRunning.detail }
- : null;
-
-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 [notchVariant, setNotchVariant] = useState<NotchVariant>('real');
- // App-update notification is detected once on launch; the prototype seeds it on.
- const [updateAvailable, setUpdateAvailable] = useState(true);
- const [missingPermissions, setMissingPermissions] = useState(false);
- // Out of credits gates the notch into a reload call-to-action; the prototype seeds it off.
- const [outOfCredits, setOutOfCredits] = useState(false);
- // Logged out gates the notch into a login call-to-action; the prototype seeds it off.
- const [loggedOut, setLoggedOut] = useState(false);
- const [liveTasks, setLiveTasks] = useState<LiveTask[]>(INITIAL_LIVE_TASKS);
- // The update currently streaming into the collapsed notch chin (rotates across running tasks).
- const [chinUpdate, setChinUpdate] = useState<NotchUpdate | null>(INITIAL_UPDATE);
- // Terminal tasks — completions and errors — keep surfacing in the collapsed notch until the user
- // expands; expanding marks them acknowledged so they stop surfacing as floating pointers / chin
- // messages (they stay in the expanded list).
- const [acknowledgedIds, setAcknowledgedIds] = useState<Set<string>>(() => new Set());
- const acknowledgedRef = useRef(acknowledgedIds);
- const [activeTaskId, setActiveTaskId] = useState<TaskId>('compare');
- const [notchExpanded, setNotchExpanded] = useState(false);
- // Center composer is summoned with a double-tap of Cmd (like the app), hidden otherwise.
- const [composerVisible, setComposerVisible] = useState(false);
- const [promptText, setPromptText] = useState('');
- const [promptTextHeight, setPromptTextHeight] = useState(COMPOSER_TEXT_MIN_HEIGHT);
- const promptInputRef = useRef<HTMLTextAreaElement | null>(null);
- const liveTaskIdRef = useRef(0);
- const liveTasksRef = useRef(liveTasks);
- const updateCounterRef = useRef(0);
-
- 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]);
-
- // Double-tap Cmd summons the composer; Escape dismisses it.
- useEffect(() => {
- let lastMetaAt = 0;
- const onKeyDown = (event: KeyboardEvent) => {
- if (event.key === 'Meta') {
- const now = Date.now();
- if (now - lastMetaAt < 400) {
- lastMetaAt = 0;
- setComposerVisible(true);
- } else {
- lastMetaAt = now;
- }
- } else if (event.key === 'Escape') {
- setComposerVisible(false);
- }
- };
-
- window.addEventListener('keydown', onKeyDown);
- return () => window.removeEventListener('keydown', onKeyDown);
- }, []);
-
- useEffect(() => {
- if (composerVisible) promptInputRef.current?.focus();
- }, [composerVisible]);
-
- // Any click outside the composer dismisses it.
- useEffect(() => {
- if (!composerVisible) return;
-
- const onPointerDown = (event: PointerEvent) => {
- const target = event.target;
- if (target instanceof Element && target.closest('[aria-label="Donkey prompt"]')) return;
- setComposerVisible(false);
- };
-
- document.addEventListener('pointerdown', onPointerDown);
- return () => document.removeEventListener('pointerdown', onPointerDown);
- }, [composerVisible]);
-
- // Run the simulation: each running task's clock ticks up, finishing (→ done) at the cap.
- useEffect(() => {
- const interval = window.setInterval(() => {
- setLiveTasks((tasks) =>
- tasks.map((task) => {
- if (task.status !== 'running') return task;
- const seconds = task.seconds + 1;
- return seconds >= TASK_DONE_AT_SECONDS ? { ...task, seconds, status: 'done' } : { ...task, seconds };
- }),
- );
- }, 1000);
-
- return () => window.clearInterval(interval);
- }, []);
-
- // Keep a ref of the latest tasks so the rotation timer can read them without re-subscribing.
- useEffect(() => {
- liveTasksRef.current = liveTasks;
- }, [liveTasks]);
-
- // Keep a ref of the acknowledged set so the rotation timer can read it without re-subscribing.
- useEffect(() => {
- acknowledgedRef.current = acknowledgedIds;
- }, [acknowledgedIds]);
-
- // Rotate the collapsed chin through running tasks' streaming updates, one at a time. An
- // unacknowledged error outranks everything and holds the chin until the user expands; otherwise,
- // when nothing is running, the most recent completion keeps surfacing until it's acknowledged.
- useEffect(() => {
- const interval = window.setInterval(() => {
- const tasks = liveTasksRef.current;
- const errored = tasks.find((task) => task.status === 'error' && !acknowledgedRef.current.has(task.id));
- if (errored) {
- setChinUpdate({ color: errored.color, message: errored.detail, isError: true });
- return;
- }
- const running = tasks.filter((task) => task.status === 'running');
- if (running.length > 0) {
- updateCounterRef.current += 1;
- const task = running[updateCounterRef.current % running.length];
- const message = UPDATE_MESSAGES[updateCounterRef.current % UPDATE_MESSAGES.length];
- setChinUpdate({ color: task.color, message });
- return;
- }
- const done = tasks.find((task) => task.status === 'done' && !acknowledgedRef.current.has(task.id));
- setChinUpdate(done ? { color: done.color, message: done.detail } : null);
- }, 2600);
-
- return () => window.clearInterval(interval);
- }, []);
-
- const addLiveTask = useCallback((title: string) => {
- liveTaskIdRef.current += 1;
- const color = TASK_COLORS[(INITIAL_LIVE_TASKS.length + liveTaskIdRef.current) % TASK_COLORS.length];
- const detail = SAMPLE_SUBTEXTS[liveTaskIdRef.current % SAMPLE_SUBTEXTS.length];
- const created: LiveTask = { id: `live-${liveTaskIdRef.current}`, title, detail, color, seconds: 0, status: 'running' };
- // New task goes to the front of the queue so the user sees it's processing right away.
- setLiveTasks((tasks) => (tasks.length >= MAX_LIVE_TASKS ? tasks : [created, ...tasks]));
- // Briefly surface the new task's own color + subtext before the rotation takes over.
- setChinUpdate({ color, message: detail });
- }, []);
-
- // Simulate an auth error. It attaches to a real task (the most recent running one, else any live
- // task) so the error is tied to that task's own pointer — the chin holds its message with a red
- // warning glyph in the right rail until the user expands to acknowledge it. Only when there's no
- // task to attach to does it synthesize one, so the demo can still show the error chin.
- const triggerAuthError = useCallback(() => {
- const tasks = liveTasksRef.current;
- const target = tasks.find((task) => task.status === 'running') ?? tasks.find((task) => task.status !== 'error');
- if (target) {
- setLiveTasks((current) =>
- current.map((task) =>
- task.id === target.id ? { ...task, status: 'error', detail: AUTH_ERROR_MESSAGE } : task,
- ),
- );
- setChinUpdate({ color: target.color, message: AUTH_ERROR_MESSAGE, isError: true });
- return;
- }
-
- liveTaskIdRef.current += 1;
- const color = TASK_COLORS[(INITIAL_LIVE_TASKS.length + liveTaskIdRef.current) % TASK_COLORS.length];
- const created: LiveTask = {
- id: `live-${liveTaskIdRef.current}`,
- title: 'Authentication required',
- detail: AUTH_ERROR_MESSAGE,
- color,
- seconds: 0,
- status: 'error',
- };
- setLiveTasks((current) => (current.length >= MAX_LIVE_TASKS ? current : [created, ...current]));
- setChinUpdate({ color, message: AUTH_ERROR_MESSAGE, isError: true });
- }, []);
-
- const stopLiveTask = useCallback((id: string) => {
- setLiveTasks((tasks) => tasks.map((task) => (task.id === id ? { ...task, status: 'stopped' } : task)));
- }, []);
-
- const resumeLiveTask = useCallback((id: string) => {
- setLiveTasks((tasks) => tasks.map((task) => (task.id === id ? { ...task, status: 'running' } : task)));
- }, []);
-
- // Replying to a thread continues it with the user's message: the task goes back to running and its
- // line shows what the user just said, mirroring the app's "pin the next message to this task".
- const replyToLiveTask = useCallback((id: string, text: string) => {
- setLiveTasks((tasks) =>
- tasks.map((task) => (task.id === id ? { ...task, status: 'running', detail: text } : task)),
- );
- }, []);
-
- const closeLiveTask = useCallback((id: string) => {
- setLiveTasks((tasks) => tasks.filter((task) => task.id !== id));
- }, []);
-
- const handleSubmit = useCallback((event: FormEvent<HTMLFormElement>) => {
- event.preventDefault();
-
- const taskText = promptText.trim();
- if (!taskText) return;
-
- // The composer adds a task to the notch list and runs it through the simulation.
- addLiveTask(taskText);
- setPromptText('');
- setComposerVisible(false);
- }, [addLiveTask, promptText]);
-
- const isNotchExpanded = notchExpanded || state === 'expanded-pinned';
-
- // Expanding the notch acknowledges the surfaced terminal tasks: the running tasks keep streaming,
- // but the completions and errors that piled up in the collapsed notch (pointers + the held error
- // chin) are acknowledged and stop surfacing there.
- useEffect(() => {
- if (!isNotchExpanded) return;
-
- setAcknowledgedIds((prev) => {
- let changed = false;
- const next = new Set(prev);
- for (const task of liveTasksRef.current) {
- if ((task.status === 'done' || task.status === 'error') && !next.has(task.id)) {
- next.add(task.id);
- changed = true;
- }
- }
- return changed ? next : prev;
- });
- }, [isNotchExpanded]);
-
- // The collapsed notch surfaces running tasks plus unacknowledged terminal tasks (completions and
- // errors) as a pointer cluster.
- const surfacedTasks = liveTasks.filter(
- (task) =>
- task.status === 'running' ||
- ((task.status === 'done' || task.status === 'error') && !acknowledgedIds.has(task.id)),
- );
-
- return (
- <div className="relative min-h-screen">
- <MacDesktop
- state={state}
- notchVariant={notchVariant}
- updateAvailable={updateAvailable}
- onRestart={() => setUpdateAvailable(false)}
- missingPermissions={missingPermissions}
- onReviewPermissions={() => setMissingPermissions(false)}
- outOfCredits={outOfCredits}
- onReloadCredits={() => setOutOfCredits(false)}
- notchExpanded={isNotchExpanded}
- setNotchExpanded={setNotchExpanded}
- composerVisible={composerVisible}
- promptText={promptText}
- setPromptText={setPromptText}
- promptInputRef={promptInputRef}
- promptTextHeight={promptTextHeight}
- onPromptSubmit={handleSubmit}
- liveTasks={liveTasks}
- surfacedTasks={surfacedTasks}
- chinUpdate={chinUpdate}
- onAddTask={addLiveTask}
- onStopTask={stopLiveTask}
- onResumeTask={resumeLiveTask}
- onReplyToTask={replyToLiveTask}
- onCloseTask={closeLiveTask}
- loggedOut={loggedOut}
- onLogin={() => setLoggedOut(false)}
- />
- <DemoControls
- state={state}
- setState={setState}
- notchVariant={notchVariant}
- setNotchVariant={setNotchVariant}
- updateAvailable={updateAvailable}
- setUpdateAvailable={setUpdateAvailable}
- missingPermissions={missingPermissions}
- setMissingPermissions={setMissingPermissions}
- outOfCredits={outOfCredits}
- setOutOfCredits={setOutOfCredits}
- loggedOut={loggedOut}
- setLoggedOut={setLoggedOut}
- activeTaskId={activeTaskId}
- setActiveTaskId={setActiveTaskId}
- onTriggerAuthError={triggerAuthError}
- />
- </div>
- );
-}
diff --git a/site/src/app/prototype/_components/ControlButton.tsx b/site/src/app/prototype/_components/ControlButton.tsx
deleted file mode 100644
index 5be16883..00000000
--- a/site/src/app/prototype/_components/ControlButton.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import type { ReactNode } from 'react';
-
-type Props = {
- active: boolean;
- onClick: () => void;
- children: ReactNode;
- accent?: string;
-};
-
-export function ControlButton({ active, onClick, children, accent }: Props) {
- return (
- <button
- type="button"
- onClick={onClick}
- className="px-3 py-2 text-left rounded-lg transition-all border text-sm flex items-start gap-2.5"
- style={{
- background: active ? '#1a1a1a' : '#fff',
- color: active ? '#fff' : '#1a1a1a',
- borderColor: active ? '#1a1a1a' : '#e5e3dc',
- }}
- >
- {accent && <div className="w-1 self-stretch rounded-full mt-0.5" style={{ background: accent }} />}
- <div className="flex-1">{children}</div>
- </button>
- );
-}
diff --git a/site/src/app/prototype/_components/DemoControls.tsx b/site/src/app/prototype/_components/DemoControls.tsx
deleted file mode 100644
index 1a5b207e..00000000
--- a/site/src/app/prototype/_components/DemoControls.tsx
+++ /dev/null
@@ -1,209 +0,0 @@
-import { Check, ChevronDown } from 'lucide-react';
-import { useState } from 'react';
-
-import { DonkeyCursor } from '@/app/prototype/_components/DonkeyCursor';
-import { ALL_TASK_IDS, TASKS } from '@/app/prototype/_components/tasks';
-import type { NotchState, NotchVariant, TaskId } from '@/app/prototype/_components/types';
-
-type Props = {
- state: NotchState;
- setState: (state: NotchState) => void;
- notchVariant: NotchVariant;
- setNotchVariant: (variant: NotchVariant) => void;
- updateAvailable: boolean;
- setUpdateAvailable: (available: boolean) => void;
- missingPermissions: boolean;
- setMissingPermissions: (missing: boolean) => void;
- outOfCredits: boolean;
- setOutOfCredits: (out: boolean) => void;
- activeTaskId: TaskId;
- setActiveTaskId: (id: TaskId) => void;
- onTriggerAuthError: () => void;
- loggedOut: boolean;
- setLoggedOut: (loggedOut: boolean) => void;
-};
-
-type StateOption = {
- id: NotchState;
- label: string;
-};
-
-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' },
-];
-
-const VARIANT_OPTIONS: { id: NotchVariant; label: string }[] = [
- { id: 'real', label: 'Real' },
- { id: 'simulated', label: 'Sim' },
-];
-
-export function DemoControls({
- state,
- setState,
- notchVariant,
- setNotchVariant,
- updateAvailable,
- setUpdateAvailable,
- missingPermissions,
- setMissingPermissions,
- outOfCredits,
- setOutOfCredits,
- activeTaskId,
- setActiveTaskId,
- onTriggerAuthError,
- loggedOut,
- setLoggedOut,
-}: Props) {
- const [notificationsOpen, setNotificationsOpen] = useState(false);
-
- const notifications = [
- { label: 'Out of Credits', on: outOfCredits, toggle: () => setOutOfCredits(!outOfCredits) },
- { label: 'Update Available', on: updateAvailable, toggle: () => setUpdateAvailable(!updateAvailable) },
- { label: 'Missing Permissions', on: missingPermissions, toggle: () => setMissingPermissions(!missingPermissions) },
- ];
- const activeNotifications = notifications.filter((notification) => notification.on).length;
-
- return (
- <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="h-7 w-px bg-white/10" />
-
- <div className="flex items-center gap-1.5">
- {VARIANT_OPTIONS.map((option) => {
- const active = notchVariant === option.id;
-
- return (
- <button
- key={option.id}
- type="button"
- onClick={() => setNotchVariant(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="h-7 w-px bg-white/10" />
-
- <button
- type="button"
- onClick={onTriggerAuthError}
- className="h-8 rounded-lg px-2.5 text-[11px] font-medium transition"
- style={{ background: 'rgba(255,255,255,0.08)', color: 'rgba(255,255,255,0.72)' }}
- >
- Auth error
- </button>
-
- <button
- type="button"
- onClick={() => setLoggedOut(!loggedOut)}
- className="h-8 rounded-lg px-2.5 text-[11px] font-medium transition"
- style={{
- background: loggedOut ? 'rgba(255,255,255,0.92)' : 'rgba(255,255,255,0.08)',
- color: loggedOut ? 'rgba(0,0,0,0.82)' : 'rgba(255,255,255,0.72)',
- }}
- >
- Logged out
- </button>
-
- <div className="h-7 w-px bg-white/10" />
-
- <div className="relative flex items-center gap-1.5">
- <button
- type="button"
- onClick={() => setNotificationsOpen((open) => !open)}
- className="flex h-8 items-center gap-1.5 rounded-lg px-2.5 text-[11px] font-medium transition"
- style={{
- background: activeNotifications > 0 ? 'rgba(255,255,255,0.92)' : 'rgba(255,255,255,0.08)',
- color: activeNotifications > 0 ? 'rgba(0,0,0,0.82)' : 'rgba(255,255,255,0.72)',
- }}
- >
- Notifications{activeNotifications > 0 ? ` · ${activeNotifications}` : ''}
- <ChevronDown size={12} />
- </button>
- {notificationsOpen && (
- <>
- <button
- type="button"
- aria-label="Close notifications menu"
- className="fixed inset-0 z-40 cursor-default"
- onClick={() => setNotificationsOpen(false)}
- />
- <div className="absolute bottom-full right-0 z-50 mb-2 w-52 rounded-lg border border-white/10 bg-[#1b1c20] p-1 shadow-2xl">
- {notifications.map((notification) => (
- <button
- key={notification.label}
- type="button"
- onClick={notification.toggle}
- className="flex w-full items-center justify-between gap-3 rounded-md px-2.5 py-2 text-left text-[12px] text-white/[0.82] transition hover:bg-white/[0.08]"
- >
- {notification.label}
- {notification.on && <Check size={14} className="text-white" />}
- </button>
- ))}
- </div>
- </>
- )}
- </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} /> : <DonkeyCursor color={task.color} size={15} />}
- </button>
- );
- })}
- </div>
- </aside>
- );
-}
diff --git a/site/src/app/prototype/_components/DonkeyCursor.tsx b/site/src/app/prototype/_components/DonkeyCursor.tsx
deleted file mode 100644
index 14a1c54b..00000000
--- a/site/src/app/prototype/_components/DonkeyCursor.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-type Props = {
- color: string;
- size?: number;
- className?: string;
- silhouette?: boolean;
-};
-
-export function DonkeyCursor({ color, size = 28, className, silhouette = false }: Props) {
- return (
- <div className={`relative flex-shrink-0 ${className ?? ''}`} style={{ width: size, height: size }}>
- <svg
- viewBox="0 0 100 100"
- width={size}
- height={size}
- style={{
- position: 'absolute',
- left: 0,
- top: 0,
- filter: silhouette ? 'none' : 'drop-shadow(0 2px 4px rgba(0,0,0,0.34))',
- overflow: 'visible',
- }}
- >
- <path
- d="m83.086 5.6406-72.633 29.043c-7.6016 3.0391-7.1445 13.949 0.67969 16.344l24.562 7.5195c2.7539 0.84375 4.9102 3 5.7539 5.7539l7.5195 24.562c2.3984 7.8281 13.305 8.2812 16.344 0.67969l29.043-72.633c2.832-7.0781-4.1953-14.102-11.273-11.273z"
- fill={silhouette ? 'none' : color}
- stroke={silhouette ? 'rgba(255,255,255,0.5)' : 'rgba(255,255,255,0.92)'}
- strokeWidth={silhouette ? 6 : 5.36}
- strokeLinejoin="round"
- />
- </svg>
- </div>
- );
-}
diff --git a/site/src/app/prototype/_components/ExpandedTaskRow.tsx b/site/src/app/prototype/_components/ExpandedTaskRow.tsx
deleted file mode 100644
index bc7c0d52..00000000
--- a/site/src/app/prototype/_components/ExpandedTaskRow.tsx
+++ /dev/null
@@ -1,140 +0,0 @@
-import { MessageSquareReply, Play, Square, X } from 'lucide-react';
-import type { MouseEvent } from 'react';
-
-import { DonkeyCursor } from '@/app/prototype/_components/DonkeyCursor';
-import type { LiveTaskStatus } from '@/app/prototype/_components/types';
-
-type Props = {
- // Used to scroll the row into view when the keyboard highlight lands on it.
- taskId: string;
- title: string;
- detail: string;
- color: string;
- status: LiveTaskStatus;
- timeText: string;
- // Whether this row is the active reply target (full opacity, lit pointer, accent focus).
- isReplyTarget: boolean;
- // Whether this row is the keyboard highlight — a brighter fill and a ring on top of the reply focus,
- // shown until the user starts typing a draft.
- isSelected: boolean;
- // Whether another row is the reply target, so this one recedes.
- dimmed: boolean;
- onStop: () => void;
- onResume: () => void;
- onClose: () => void;
- // Begin/toggle reply for this thread — fired by tapping the row and by the Reply button.
- onActivate: () => void;
-};
-
-const controlClass =
- 'grid h-6 w-6 place-items-center rounded-full bg-white/[0.12] text-white/[0.88] transition hover:bg-white/[0.2]';
-
-export function ExpandedTaskRow({
- taskId,
- title,
- detail,
- color,
- status,
- timeText,
- isReplyTarget,
- isSelected,
- dimmed,
- onStop,
- onResume,
- onClose,
- onActivate,
-}: Props) {
- const running = status === 'running';
- // The agent is waiting on the user (a clarification/review): it's the only state with a Reply button,
- // and its pointer gently pulses to call attention.
- const waiting = status === 'waiting';
- // Leave room for the pinned controls (a two-button pair when stopped or waiting, else a single
- // button) so the title runs to just left of them; the subtext also clears the bottom-pinned time.
- const controlsReserve = status === 'stopped' || waiting ? 74 : 44;
- const detailReserve = Math.max(controlsReserve, 52);
-
- // The reply dim is applied per-element so an attention pointer (a waiting thread) can stay lit while
- // the rest of its row recedes. The targeted row's pointer shows its live color even if it had stopped.
- const contentOpacity = dimmed ? 0.5 : 1;
- const pointerOpacity = waiting ? 1 : contentOpacity;
- const pointerActive = running || isReplyTarget;
-
- // Buttons sit inside the clickable row, so stop their clicks from also activating reply.
- const withStop = (handler: () => void) => (event: MouseEvent) => {
- event.stopPropagation();
- handler();
- };
-
- return (
- <article
- data-task-id={taskId}
- onClick={withStop(onActivate)}
- className="group relative flex cursor-pointer items-start gap-3 rounded-lg px-3 py-2.5 transition-colors hover:bg-white/[0.07]"
- style={{
- // The keyboard highlight brightens the fill and adds a ring; a plain reply target keeps the
- // softer fill. The inline fill wins over the hover class, so a highlighted row holds its color.
- background: isSelected
- ? 'rgba(255,255,255,0.16)'
- : isReplyTarget
- ? 'rgba(255,255,255,0.07)'
- : undefined,
- boxShadow: isSelected ? 'inset 0 0 0 1px rgba(255,255,255,0.3)' : undefined,
- }}
- >
- <div
- style={{
- opacity: pointerOpacity,
- animation: waiting ? 'notchArrowPulse 1.6s ease-in-out infinite' : undefined,
- }}
- >
- <DonkeyCursor color={color} size={14} silhouette={!pointerActive} className="mt-0.5" />
- </div>
- <div className="min-w-0 flex-1" style={{ opacity: contentOpacity }}>
- <h2 className="truncate text-[13px] font-normal leading-4 text-white/[0.9]" style={{ paddingRight: controlsReserve }}>
- {title}
- </h2>
- {detail && (
- <p
- className="mt-1 line-clamp-5 text-[12px] font-normal leading-[14px] text-white/[0.42]"
- style={{ paddingRight: detailReserve }}
- >
- {detail}
- </p>
- )}
- </div>
-
- {/* Controls (fixed top-right): running → stop; stopped → resume + close; waiting → reply + close;
- done / error → close. A finished or failed thread has no button — tap the row to reply. */}
- <div className="absolute right-3 top-2 flex items-center gap-1.5" style={{ opacity: contentOpacity }}>
- {running && (
- <button type="button" onClick={withStop(onStop)} aria-label="Stop" className={controlClass}>
- <Square size={9} fill="currentColor" />
- </button>
- )}
- {status === 'stopped' && (
- <button type="button" onClick={withStop(onResume)} aria-label="Resume" className={controlClass}>
- <Play size={10} fill="currentColor" />
- </button>
- )}
- {waiting && (
- <button type="button" onClick={withStop(onActivate)} aria-label="Reply" className={controlClass}>
- <MessageSquareReply size={12} strokeWidth={2} />
- </button>
- )}
- {!running && (
- <button type="button" onClick={withStop(onClose)} aria-label="Close" className={controlClass}>
- <X size={11} strokeWidth={2.25} />
- </button>
- )}
- </div>
-
- {/* Elapsed time is pinned to the bottom-right of the cell so it never moves as the cell grows. */}
- <span
- className="absolute bottom-2.5 right-3 whitespace-nowrap text-[10px] leading-none text-white/[0.55]"
- style={{ opacity: contentOpacity }}
- >
- {timeText}
- </span>
- </article>
- );
-}
diff --git a/site/src/app/prototype/_components/MacDesktop.tsx b/site/src/app/prototype/_components/MacDesktop.tsx
deleted file mode 100644
index 3c4fd01b..00000000
--- a/site/src/app/prototype/_components/MacDesktop.tsx
+++ /dev/null
@@ -1,219 +0,0 @@
-import { ArrowUp, Mic } from 'lucide-react';
-import type { FormEvent, RefObject } from 'react';
-
-import { Notch } from '@/app/prototype/_components/Notch';
-import type { LiveTask, NotchState, NotchUpdate, NotchVariant } from '@/app/prototype/_components/types';
-
-type Props = {
- state: NotchState;
- notchVariant: NotchVariant;
- updateAvailable: boolean;
- onRestart: () => void;
- missingPermissions: boolean;
- onReviewPermissions: () => void;
- outOfCredits: boolean;
- onReloadCredits: () => void;
- notchExpanded: boolean;
- setNotchExpanded: (expanded: boolean) => void;
- composerVisible: boolean;
- promptText: string;
- setPromptText: (text: string) => void;
- promptInputRef: RefObject<HTMLTextAreaElement | null>;
- promptTextHeight: number;
- onPromptSubmit: (event: FormEvent<HTMLFormElement>) => void;
- liveTasks: LiveTask[];
- surfacedTasks: LiveTask[];
- chinUpdate: NotchUpdate | null;
- onAddTask: (title: string) => void;
- onStopTask: (id: string) => void;
- onResumeTask: (id: string) => void;
- onReplyToTask: (id: string, text: string) => void;
- onCloseTask: (id: string) => void;
- loggedOut: boolean;
- onLogin: () => void;
-};
-
-const LAYOUT = {
- contentWidth: 592,
- stageHorizontalPadding: 8,
- stageVerticalPadding: 10,
- composerWidth: 576,
- // Single growing layout: one line by default, grows with content; controls pinned bottom-right.
- composerMinHeight: 56,
- composerCornerRadius: 28,
- composerTextMaxHeight: 134.4,
- composerMicrophoneSize: 28,
- composerSendButtonSize: 36.8,
-} as const;
-
-export function MacDesktop({
- state,
- notchVariant,
- updateAvailable,
- onRestart,
- missingPermissions,
- onReviewPermissions,
- outOfCredits,
- onReloadCredits,
- notchExpanded,
- setNotchExpanded,
- composerVisible,
- promptText,
- setPromptText,
- promptInputRef,
- promptTextHeight,
- onPromptSubmit,
- liveTasks,
- surfacedTasks,
- chinUpdate,
- onAddTask,
- onStopTask,
- onResumeTask,
- onReplyToTask,
- onCloseTask,
- loggedOut,
- onLogin,
-}: Props) {
- const hasPromptText = promptText.trim().length > 0;
-
- return (
- <main
- 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={{
- 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 left-0 right-0 top-0 z-10 flex h-8 items-center gap-4 px-4 text-[13px] text-white/[0.72]"
- style={{
- background: 'rgba(11,12,15,0.55)',
- backdropFilter: 'blur(14px)',
- }}
- >
- <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>
-
- <Notch
- state={state}
- variant={notchVariant}
- updateAvailable={updateAvailable}
- onRestart={onRestart}
- missingPermissions={missingPermissions}
- onReviewPermissions={onReviewPermissions}
- outOfCredits={outOfCredits}
- onReloadCredits={onReloadCredits}
- expanded={notchExpanded}
- setExpanded={setNotchExpanded}
- liveTasks={liveTasks}
- surfacedTasks={surfacedTasks}
- chinUpdate={chinUpdate}
- onAddTask={onAddTask}
- onStopTask={onStopTask}
- onResumeTask={onResumeTask}
- onReplyToTask={onReplyToTask}
- onCloseTask={onCloseTask}
- loggedOut={loggedOut}
- onLogin={onLogin}
- />
-
- <section
- aria-label="Donkey prompt"
- className="absolute left-1/2 top-1/2 z-20"
- style={{
- width: LAYOUT.contentWidth,
- padding: `${LAYOUT.stageVerticalPadding}px ${LAYOUT.stageHorizontalPadding}px`,
- transform: `translate(-50%, -50%) scale(${composerVisible ? 1 : 0.98})`,
- opacity: composerVisible ? 1 : 0,
- pointerEvents: composerVisible ? 'auto' : 'none',
- transition: 'opacity 160ms ease-out, transform 160ms ease-out',
- }}
- >
- {/* Single layout: one line that grows with its text; controls pinned bottom-right. */}
- <form
- onSubmit={onPromptSubmit}
- className="relative flex items-center bg-black"
- style={{
- width: LAYOUT.composerWidth,
- minHeight: LAYOUT.composerMinHeight,
- borderRadius: LAYOUT.composerCornerRadius,
- padding: '10px 20px',
- boxShadow: '0 5px 12px rgba(0,0,0,0.2), inset 0 0 0 1px rgba(255,255,255,0.34)',
- }}
- >
- <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="flex-1 resize-none border-0 bg-transparent p-0 pr-[84px] text-[16px] font-light leading-[19.2px] text-white outline-none placeholder:text-white/[0.58]"
- style={{
- height: promptTextHeight,
- maxHeight: LAYOUT.composerTextMaxHeight,
- overflowY: 'auto',
- caretColor: 'white',
- fontVariantLigatures: 'none',
- }}
- onKeyDown={(event) => {
- if (event.key === 'Enter' && !event.shiftKey) {
- event.preventDefault();
- event.currentTarget.form?.requestSubmit();
- }
- }}
- />
- <div className="absolute bottom-2.5 right-3.5 flex items-center gap-2">
- <button
- type="button"
- className="grid place-items-center rounded-full transition"
- style={{
- width: LAYOUT.composerMicrophoneSize,
- height: LAYOUT.composerMicrophoneSize,
- color: hasPromptText ? 'rgba(255,255,255,0.42)' : 'rgba(255,255,255,0.78)',
- }}
- aria-label="Voice input"
- >
- <Mic size={24} strokeWidth={1.15} />
- </button>
- <button
- type="submit"
- className="grid place-items-center rounded-full transition disabled:cursor-default"
- style={{
- width: LAYOUT.composerSendButtonSize,
- height: LAYOUT.composerSendButtonSize,
- background: hasPromptText ? 'rgba(255,255,255,0.94)' : 'rgba(255,255,255,0.68)',
- color: hasPromptText ? 'rgba(0,0,0,0.78)' : 'rgba(0,0,0,0.42)',
- }}
- disabled={!hasPromptText}
- aria-label="Send"
- >
- <ArrowUp size={18} strokeWidth={2.25} />
- </button>
- </div>
- </form>
- </section>
- </main>
- );
-}
diff --git a/site/src/app/prototype/_components/Notch.tsx b/site/src/app/prototype/_components/Notch.tsx
deleted file mode 100644
index d4004291..00000000
--- a/site/src/app/prototype/_components/Notch.tsx
+++ /dev/null
@@ -1,682 +0,0 @@
-import { ArrowUp, CloudSync, Coins, MessageCircleWarning, Shield } from 'lucide-react';
-import { type FormEvent, type KeyboardEvent, useEffect, useLayoutEffect, useRef, useState } from 'react';
-
-import { DonkeyCursor } from '@/app/prototype/_components/DonkeyCursor';
-import { ExpandedTaskRow } from '@/app/prototype/_components/ExpandedTaskRow';
-import { ERROR_RED } from '@/app/prototype/_components/tasks';
-import type { LiveTask, NotchState, NotchUpdate, NotchVariant } from '@/app/prototype/_components/types';
-
-type Props = {
- state: NotchState;
- variant: NotchVariant;
- updateAvailable: boolean;
- onRestart: () => void;
- missingPermissions: boolean;
- onReviewPermissions: () => void;
- outOfCredits: boolean;
- onReloadCredits: () => void;
- expanded: boolean;
- setExpanded: (expanded: boolean) => void;
- liveTasks: LiveTask[];
- surfacedTasks: LiveTask[];
- chinUpdate: NotchUpdate | null;
- onAddTask: (title: string) => void;
- onStopTask: (id: string) => void;
- onResumeTask: (id: string) => void;
- onReplyToTask: (id: string, text: string) => void;
- onCloseTask: (id: string) => void;
- loggedOut: boolean;
- onLogin: () => void;
-};
-
-const METRICS = {
- collapsedWidth: 253,
- collapsedHeight: 32,
- // The MacBook notch void sits between two 34px content areas (left arrow, right time).
- contentAreaWidth: 34,
- // Chin hangs below the real notch: a 12px streaming line (no top padding) that grows to a second
- // line before truncating. `chinBaseHeight` is one line + the bottom margin; each extra line adds
- // exactly `chinLineHeight`, so the bottom margin stays constant no matter the line count.
- chinBaseHeight: 23,
- chinLineHeight: 15,
- // Surfaced pointers (running + undismissed completions) stack as an overlapping cluster.
- pointerSize: 14,
- pointerStepX: 8,
- pointerStepY: 3,
- maxClusterPointers: 3,
- // Simulated notch grows to fit a two-line message inline.
- simulatedMessageHeight: 50,
- expandedWidth: 604,
- expandedHeight: 312,
- expandedContentHeight: 280,
- collapsedCornerRadius: 14,
- simulatedCornerRadius: 16,
- // Spec: the expanded notch window and its input box both use a 14px radius.
- expandedCornerRadius: 14,
- contentInset: 14,
- // Logged out: collapsed just shows the "Login to use Donkey" line; expanding reveals a wide bar with
- // the label on the left and the Login button on the right.
- loginCollapsedChinHeight: 22,
- loginExpandedHeight: 84,
-} as const;
-
-// The follow-up input starts as one line and grows with content up to a scroll cap.
-const FOLLOWUP_MIN_HEIGHT = 20;
-const FOLLOWUP_MAX_HEIGHT = 120;
-
-// Expanded rows have room for the full elapsed time.
-function formatRunningTime(totalSeconds: number) {
- const minutes = Math.floor(totalSeconds / 60);
- const seconds = totalSeconds % 60;
-
- return `${minutes}m ${seconds}s`;
-}
-
-// The collapsed right slot is only 34px wide, so it shows a single unit — the largest non-zero
-// value (hours, else minutes, else seconds). The full elapsed breakdown lives in the expanded row.
-function formatCompactTime(totalSeconds: number) {
- const hours = Math.floor(totalSeconds / 3600);
- const minutes = Math.floor((totalSeconds % 3600) / 60);
- const seconds = totalSeconds % 60;
-
- if (hours > 0) return `${hours}h`;
- if (minutes > 0) return `${minutes}m`;
- return `${seconds}s`;
-}
-
-// Running states stream a message into the chin and pulse the arrow.
-function isRunningState(state: NotchState) {
- return state === 'running-single' || state === 'running-multi';
-}
-
-// Any state other than idle has an active task worth showing run time / a message for.
-function hasActiveTask(state: NotchState) {
- return state !== 'idle';
-}
-
-export function Notch({
- state,
- variant,
- updateAvailable,
- onRestart,
- missingPermissions,
- onReviewPermissions,
- outOfCredits,
- onReloadCredits,
- expanded,
- setExpanded,
- liveTasks,
- surfacedTasks,
- chinUpdate,
- onAddTask,
- onStopTask,
- onResumeTask,
- onReplyToTask,
- onCloseTask,
- loggedOut,
- onLogin,
-}: Props) {
- const isRunning = isRunningState(state);
- const isActive = hasActiveTask(state);
- const needsAttention = state === 'needs-input';
- // The collapsed arrow + chin follow the streaming task update; silhouette when nothing is streaming.
- const streaming = chinUpdate !== null;
- const activeColor = chinUpdate?.color ?? 'rgb(29,158,117)';
-
- // The left content area surfaces a cluster of pointers — running tasks plus completions the user
- // hasn't dismissed yet. One pointer renders alone; several overlap as a centered, cascading stack
- // (newest on top), capped so the notch never crowds. A completed pointer is colored but still.
- // A failed task is a real task, so it keeps its own pointer here (alongside the right-rail warning
- // glyph and held chin); each surfaced task shows a single pointer.
- const clusterTasks = surfacedTasks.slice(0, METRICS.maxClusterPointers);
- const clusterCount = clusterTasks.length;
- const clusterWidth = METRICS.pointerSize + METRICS.pointerStepX * Math.max(0, clusterCount - 1);
- const clusterHeight = METRICS.pointerSize + METRICS.pointerStepY * Math.max(0, clusterCount - 1);
-
- // Collapsed run clock — drives the right-slot elapsed time while a task is active.
- const [runningSeconds, setRunningSeconds] = useState(0);
- const [wasActive, setWasActive] = useState(isActive);
- if (wasActive !== isActive) {
- setWasActive(isActive);
- if (!isActive) setRunningSeconds(0);
- }
-
- useEffect(() => {
- if (!isRunning) return;
-
- const interval = window.setInterval(() => setRunningSeconds((seconds) => seconds + 1), 1000);
-
- return () => window.clearInterval(interval);
- }, [isRunning]);
-
- // The chin (real) / inline (simulated) shows the current streaming update; hidden when expanded or
- // once nothing is surfaced, so it never lingers a beat after the last pointer is dismissed.
- const message = !expanded && chinUpdate && surfacedTasks.length > 0 ? chinUpdate.message : '';
- const isErrorChin = chinUpdate?.isError === true;
- const collapsedTime = formatCompactTime(runningSeconds);
-
- // Measure how many lines the chin message wraps to (capped at two) so the band grows by exactly one
- // line-height for a second line, keeping the bottom margin constant.
- const chinTextRef = useRef<HTMLParagraphElement | null>(null);
- const [chinLines, setChinLines] = useState(1);
- useLayoutEffect(() => {
- const el = chinTextRef.current;
- if (!el) return;
- setChinLines(Math.min(2, Math.max(1, Math.round(el.offsetHeight / METRICS.chinLineHeight))));
- }, [message]);
- const chinHeight = METRICS.chinBaseHeight + (chinLines - 1) * METRICS.chinLineHeight;
-
- // App-level notices share a single slot. Out of credits outranks everything — nothing can run
- // without a balance; permissions then outranks an update since it blocks functionality.
- const appNotice: 'credits' | 'permissions' | 'update' | null = outOfCredits
- ? 'credits'
- : missingPermissions
- ? 'permissions'
- : updateAvailable
- ? 'update'
- : null;
- // Each notice's collapsed glyph and expanded label + CTA. Out of credits points the user to reload.
- const noticeContent = {
- credits: { Icon: Coins, label: 'Out of Credits', action: 'Reload', onAction: onReloadCredits },
- permissions: { Icon: Shield, label: 'Missing Permissions', action: 'Review', onAction: onReviewPermissions },
- update: { Icon: CloudSync, label: 'Update Available', action: 'Restart', onAction: onRestart },
- } as const;
- const notice = appNotice ? noticeContent[appNotice] : null;
- const showChin = variant === 'real' && message !== '';
- const isSimulatedExpandedMessage = variant === 'simulated' && message !== '';
-
- const collapsedHeight = expanded
- ? loggedOut
- ? METRICS.loginExpandedHeight
- : METRICS.expandedHeight
- : loggedOut
- ? METRICS.collapsedHeight + METRICS.loginCollapsedChinHeight
- : variant === 'real'
- ? METRICS.collapsedHeight + (showChin ? chinHeight : 0)
- : isSimulatedExpandedMessage
- ? METRICS.simulatedMessageHeight
- : METRICS.collapsedHeight;
- const collapsedWidth = expanded ? METRICS.expandedWidth : METRICS.collapsedWidth;
-
- // Both variants keep a flush top edge (no top corner radius) and round only the bottom.
- const cornerRadius = expanded
- ? METRICS.expandedCornerRadius
- : variant === 'simulated'
- ? METRICS.simulatedCornerRadius
- : METRICS.collapsedCornerRadius;
-
- // Arrow and run time sit in the real notch's 32px bar, but center in the full simulated pill.
- const contentRowHeight = variant === 'real' ? METRICS.collapsedHeight : collapsedHeight;
-
- const followUpRef = useRef<HTMLTextAreaElement | null>(null);
- const listRef = useRef<HTMLDivElement | null>(null);
- const [canSendFollowUp, setCanSendFollowUp] = useState(false);
-
- // Reply mode: the thread the user is replying to. Tapping a repliable row (waiting / done / error)
- // pins the next message to it and dims the others; the composer takes that thread's accent color.
- const [replyTargetId, setReplyTargetId] = useState<string | null>(null);
- const replyTarget = replyTargetId ? liveTasks.find((task) => task.id === replyTargetId) ?? null : null;
- // The keyboard highlight: the row the arrows last landed on. It rides on top of the reply focus
- // (brighter fill + ring) and is released as soon as the user starts typing a draft, the same as the
- // app, so the arrows hand back to text editing while the reply stays pinned.
- const [selectedId, setSelectedId] = useState<string | null>(null);
-
- // Focusing a row is the shared effect of clicking it and of arrowing onto it: it becomes both the
- // keyboard highlight and the pinned reply target (lit pointer, accent composer, dimmed siblings).
- const focusRow = (id: string | null) => {
- setSelectedId(id);
- setReplyTargetId(id);
- };
-
- // Every thread is repliable by tapping its row, whatever its state. Tapping the active thread again
- // leaves reply mode; tapping any other switches to it. (Only 'waiting' also shows a Reply button,
- // since only there is the agent actively asking.)
- const handleRowActivate = (task: LiveTask) => {
- focusRow(replyTargetId === task.id ? null : task.id);
- };
-
- // Up/Down move the focus through the rows, landing on each exactly as a click would. The arrows clamp
- // at the ends so the selection is held rather than dropped, and enter the list from the empty composer
- // (Up at the bottom row nearest the input, Down at the top). Escape clears the focus. Once a draft is
- // typed the arrows fall through to edit the text instead (handled by leaving them to the textarea).
- const handleNotchKeyDown = (event: KeyboardEvent) => {
- if (!expanded || loggedOut) return;
-
- if (event.key === 'Escape') {
- if (selectedId || replyTargetId) {
- event.preventDefault();
- focusRow(null);
- }
- return;
- }
-
- if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return;
- if (liveTasks.length === 0) return;
-
- const currentIndex = selectedId ? liveTasks.findIndex((task) => task.id === selectedId) : -1;
- const draft = followUpRef.current?.value ?? '';
- // No row highlighted and a draft in progress: leave the arrows to the textarea for text editing.
- if (currentIndex === -1 && draft.length > 0) return;
-
- event.preventDefault();
- const last = liveTasks.length - 1;
- let nextIndex: number;
- if (currentIndex === -1) {
- nextIndex = event.key === 'ArrowUp' ? last : 0;
- } else if (event.key === 'ArrowUp') {
- nextIndex = Math.max(0, currentIndex - 1);
- } else {
- nextIndex = Math.min(last, currentIndex + 1);
- }
- focusRow(liveTasks[nextIndex].id);
- };
-
- // Focus the composer when a reply begins, so the user can type straight away (no second click).
- useEffect(() => {
- if (replyTargetId) followUpRef.current?.focus();
- }, [replyTargetId]);
-
- // Keep the keyboard-highlighted row on screen as the arrows walk past the fold.
- useEffect(() => {
- if (!selectedId) return;
- listRef.current?.querySelector(`[data-task-id="${selectedId}"]`)?.scrollIntoView({ block: 'nearest' });
- }, [selectedId]);
-
- // Collapsing the notch also leaves reply mode, so it never reopens with stale dimming or a highlight.
- const collapse = () => {
- setExpanded(false);
- focusRow(null);
- };
-
- const resizeFollowUp = () => {
- const input = followUpRef.current;
- if (!input) return;
-
- input.style.height = 'auto';
- input.style.height = `${Math.min(Math.max(input.scrollHeight, FOLLOWUP_MIN_HEIGHT), FOLLOWUP_MAX_HEIGHT)}px`;
- setCanSendFollowUp(input.value.trim().length > 0);
- // Starting a draft hands the arrows back to the text; the reply stays pinned until sent.
- if (input.value.length > 0) setSelectedId(null);
- };
-
- 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;
-
- if (replyTargetId) {
- // Replying to a pinned thread continues it with the message rather than starting a new task.
- onReplyToTask(replyTargetId, taskText);
- focusRow(null);
- } else {
- onAddTask(taskText);
- setSelectedId(null);
- }
- form.reset();
- setCanSendFollowUp(false);
- if (followUpRef.current) followUpRef.current.style.height = `${FOLLOWUP_MIN_HEIGHT}px`;
- };
-
- return (
- <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: collapsedWidth,
- height: collapsedHeight,
- borderBottomLeftRadius: cornerRadius,
- borderBottomRightRadius: cornerRadius,
- transition: 'width 220ms ease-out, height 220ms ease-out, border-radius 220ms ease-out',
- }}
- tabIndex={0}
- onKeyDown={handleNotchKeyDown}
- onClick={() => setExpanded(true)}
- onFocus={() => setExpanded(true)}
- onPointerEnter={() => setExpanded(true)}
- onPointerLeave={collapse}
- onMouseEnter={() => setExpanded(true)}
- onMouseLeave={collapse}
- >
- <style>{`
- @keyframes notchArrowPulse {
- 0%, 100% { transform: scale(1); opacity: 1; }
- 50% { transform: scale(1.12); opacity: 0.74; }
- }
- `}</style>
- <div
- className="absolute left-1/2 top-0 overflow-hidden bg-black text-white"
- style={{
- width: collapsedWidth,
- height: collapsedHeight,
- transform: 'translateX(-50%)',
- borderBottomLeftRadius: cornerRadius,
- borderBottomRightRadius: cornerRadius,
- 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',
- }}
- >
- {/* Logged out: the notch becomes a login call-to-action instead of the task surface. The
- collapsed chin reads "Login to use Donkey" with a Login button; expanding shows the
- minimal login view. */}
- {loggedOut && (
- <>
- {/* Collapsed: the idle silhouette sits in the left gutter beside the void, and the chin
- below reads "Login to use Donkey" — no button until expanded. */}
- <div
- className="absolute inset-0"
- style={{ opacity: expanded ? 0 : 1, transition: 'opacity 150ms ease-out' }}
- >
- <div
- className="absolute left-0 top-0 grid place-items-center"
- style={{ width: METRICS.contentAreaWidth, height: contentRowHeight }}
- >
- <DonkeyCursor color={activeColor} size={METRICS.pointerSize} silhouette />
- </div>
- <div
- className="absolute left-0 overflow-hidden"
- style={{
- top: METRICS.collapsedHeight,
- width: METRICS.collapsedWidth,
- height: METRICS.loginCollapsedChinHeight,
- padding: '0 12px',
- }}
- >
- <p className="truncate text-[12px] leading-[15px] text-white/[0.82]">Login to use Donkey</p>
- </div>
- </div>
-
- {/* Expanded: a wide bar — the label on the left, the Login button on the right. */}
- <div
- className="absolute left-0 flex items-center justify-between"
- style={{
- top: METRICS.collapsedHeight,
- width: METRICS.expandedWidth,
- height: METRICS.loginExpandedHeight - METRICS.collapsedHeight,
- padding: `0 ${METRICS.contentInset + 4}px`,
- opacity: expanded ? 1 : 0,
- pointerEvents: expanded ? 'auto' : 'none',
- transition: expanded ? 'opacity 300ms ease-out 150ms' : 'opacity 100ms ease-out',
- }}
- >
- <span className="text-[16px] leading-none text-white/[0.92]">Login to use Donkey</span>
- <button
- type="button"
- onClick={(event) => {
- event.stopPropagation();
- onLogin();
- }}
- className="flex items-center rounded-lg bg-white px-5 py-2 text-[14px] font-medium leading-none text-black/[0.82] transition hover:bg-white/[0.92]"
- >
- Login
- </button>
- </div>
- </>
- )}
-
- {!loggedOut && (
- <>
- <div
- className="absolute inset-0"
- style={{
- opacity: expanded ? 0 : 1,
- transition: 'opacity 150ms ease-out',
- pointerEvents: 'none',
- }}
- >
- {/* Left content area — a silhouette when nothing is surfaced, otherwise the pointer cluster
- centered in the lane: one colored pointer, or an overlapping stack for several tasks. */}
- <div
- className="absolute left-0 top-0"
- style={{ width: METRICS.contentAreaWidth, height: contentRowHeight }}
- >
- {clusterCount === 0 ? (
- <div className="grid h-full w-full place-items-center">
- <DonkeyCursor color={activeColor} size={METRICS.pointerSize} silhouette />
- </div>
- ) : (
- <div
- style={{
- position: 'absolute',
- left: (METRICS.contentAreaWidth - clusterWidth) / 2,
- top: (contentRowHeight - clusterHeight) / 2,
- width: clusterWidth,
- height: clusterHeight,
- }}
- >
- {/* Oldest first so the newest pointer lands on top, furthest along the cascade. */}
- {[...clusterTasks].reverse().map((task, index) => (
- <div
- key={task.id}
- style={{
- position: 'absolute',
- left: index * METRICS.pointerStepX,
- top: index * METRICS.pointerStepY,
- zIndex: index,
- animation: task.status === 'running' ? 'notchArrowPulse 1.6s ease-in-out infinite' : undefined,
- }}
- >
- <DonkeyCursor color={task.color} size={METRICS.pointerSize} />
- </div>
- ))}
- </div>
- )}
- </div>
-
- {/* Right content area — notifications surface here only when needed, otherwise run time. */}
- {isErrorChin && message !== '' ? (
- // Error (e.g. an auth failure): the warning glyph rides the right rail in error red while
- // the message holds the chin, until the user expands to acknowledge it.
- <div
- className="absolute right-0 top-0 grid place-items-center"
- style={{ width: METRICS.contentAreaWidth, height: contentRowHeight }}
- >
- <MessageCircleWarning size={15} strokeWidth={1.9} color={ERROR_RED} />
- </div>
- ) : needsAttention ? (
- // Chat-bubble alert: the LLM needs the user's attention (e.g. clarification).
- <div
- className="absolute right-0 top-0 grid place-items-center text-white/[0.85]"
- style={{ width: METRICS.contentAreaWidth, height: contentRowHeight }}
- >
- <MessageCircleWarning size={15} strokeWidth={1.9} />
- </div>
- ) : isRunning && streaming ? (
- // Live run time only rides alongside the chin narration; without a chin the gutter stays empty.
- <div
- className="absolute right-0 top-0 grid place-items-center whitespace-nowrap text-[11px] leading-none text-white/[0.72]"
- style={{ width: METRICS.contentAreaWidth, height: contentRowHeight }}
- >
- {collapsedTime}
- </div>
- ) : notice ? (
- // Coins = out of credits; shield = missing permissions; cloud-sync = app update available.
- <div
- className="absolute right-0 top-0 grid place-items-center text-white/[0.85]"
- style={{ width: METRICS.contentAreaWidth, height: contentRowHeight }}
- >
- <notice.Icon size={15} strokeWidth={1.9} />
- </div>
- ) : null}
-
- {/* Real notch: chin hangs below with the streaming line, growing to two lines before it
- truncates with an ellipsis. An error holds the chin; its warning icon rides the right rail. */}
- {variant === 'real' && showChin && (
- <div
- className="absolute left-0 overflow-hidden"
- style={{
- top: METRICS.collapsedHeight,
- width: METRICS.collapsedWidth,
- height: chinHeight,
- padding: '0 12px',
- }}
- >
- <p
- ref={chinTextRef}
- className="text-[12px] leading-[15px] text-white/[0.72]"
- style={{
- display: '-webkit-box',
- WebkitLineClamp: 2,
- WebkitBoxOrient: 'vertical',
- overflow: 'hidden',
- }}
- >
- {message}
- </p>
- </div>
- )}
-
- {/* Simulated notch: message sits inline between the arrow and the run time (two lines max);
- an error's warning icon rides the right rail, matching the real notch. */}
- {variant === 'simulated' && message !== '' && (
- <div
- className="absolute flex items-center"
- style={{
- left: METRICS.contentAreaWidth,
- top: 0,
- width: METRICS.collapsedWidth - METRICS.contentAreaWidth * 2,
- height: collapsedHeight,
- }}
- >
- <p
- className="text-[12px] leading-[15px] text-white/[0.72]"
- style={{
- display: '-webkit-box',
- WebkitLineClamp: 2,
- WebkitBoxOrient: 'vertical',
- overflow: 'hidden',
- }}
- >
- {message}
- </p>
- </div>
- )}
- </div>
-
- {/* Expanded right gutter — the only content on the notch row: an app-level action (reload
- credits / review permissions / restart to update). */}
- {notice && (
- <div
- className="absolute right-0 top-0 z-10 flex items-center justify-end gap-2"
- style={{
- height: METRICS.collapsedHeight,
- paddingRight: METRICS.contentInset,
- opacity: expanded ? 1 : 0,
- pointerEvents: expanded ? 'auto' : 'none',
- transition: expanded ? 'opacity 300ms ease-out 150ms' : 'opacity 100ms ease-out',
- }}
- >
- <span className="whitespace-nowrap text-[11px] leading-none text-white/[0.7]">{notice.label}</span>
- <button
- type="button"
- onClick={notice.onAction}
- className="flex items-center rounded bg-white px-2 py-1 text-[11px] font-medium leading-none text-black/[0.82] transition hover:bg-white/[0.92]"
- >
- {notice.action}
- </button>
- </div>
- )}
-
- <div
- className="absolute left-0 flex flex-col gap-2"
- style={{
- 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',
- }}
- // Tapping bare chrome (not a row or the composer, which stop propagation) leaves reply mode.
- onClick={() => {
- if (replyTargetId || selectedId) focusRow(null);
- }}
- >
- {/* Scrollable task list fills the space above the always-visible input. */}
- <div ref={listRef} className="min-h-0 flex-1 overflow-y-auto pt-2.5">
- <div className="flex flex-col gap-2">
- {liveTasks.map((task) => (
- <ExpandedTaskRow
- key={task.id}
- taskId={task.id}
- title={task.title}
- detail={task.detail}
- color={task.color}
- status={task.status}
- timeText={formatRunningTime(task.seconds)}
- isReplyTarget={replyTargetId === task.id}
- isSelected={selectedId === task.id}
- dimmed={replyTargetId !== null && replyTargetId !== task.id}
- onStop={() => onStopTask(task.id)}
- onResume={() => onResumeTask(task.id)}
- onClose={() => {
- if (replyTargetId === task.id || selectedId === task.id) focusRow(null);
- onCloseTask(task.id);
- }}
- onActivate={() => handleRowActivate(task)}
- />
- ))}
- </div>
- </div>
-
- {/* Input box is pinned to the bottom and always visible — one line that grows with its text.
- While replying it's outlined in the targeted thread's accent color. */}
- <form
- className="relative flex min-h-[40px] w-[576px] shrink-0 items-center rounded-[14px] bg-white/[0.085] px-5 py-1.5"
- style={{
- boxShadow: replyTarget ? `inset 0 0 0 1.5px ${replyTarget.color}` : undefined,
- transition: 'box-shadow 160ms ease-out',
- }}
- onClick={(event) => event.stopPropagation()}
- onSubmit={handleFollowUpSubmit}
- >
- <label className="sr-only" htmlFor="donkey-follow-up-input">
- Follow-up
- </label>
- <textarea
- id="donkey-follow-up-input"
- ref={followUpRef}
- name="followUp"
- rows={1}
- placeholder="What can Donkey do for you?"
- onInput={resizeFollowUp}
- className="flex-1 resize-none border-0 bg-transparent p-0 pr-11 text-[16px] font-light leading-[20px] text-white outline-none placeholder:text-white/[0.58]"
- style={{
- height: FOLLOWUP_MIN_HEIGHT,
- maxHeight: FOLLOWUP_MAX_HEIGHT,
- overflowY: 'auto',
- caretColor: 'white',
- fontVariantLigatures: 'none',
- }}
- onKeyDown={(event) => {
- if (event.key === 'Enter' && !event.shiftKey) {
- event.preventDefault();
- event.currentTarget.form?.requestSubmit();
- }
- }}
- />
- {/* Send button stays pinned in the lower-right corner, inset from the radius; disabled when empty. */}
- <button
- type="submit"
- disabled={!canSendFollowUp}
- className="absolute bottom-1.5 right-1.5 grid h-7 w-7 place-items-center rounded-full transition disabled:cursor-default"
- style={{
- background: canSendFollowUp ? 'rgba(255,255,255,0.9)' : 'rgba(255,255,255,0.32)',
- color: canSendFollowUp ? 'rgba(0,0,0,0.75)' : 'rgba(0,0,0,0.4)',
- }}
- aria-label="Send follow-up"
- >
- <ArrowUp size={15} strokeWidth={2} />
- </button>
- </form>
- </div>
- </>
- )}
- </div>
- </section>
- );
-}
diff --git a/site/src/app/prototype/_components/tasks.ts b/site/src/app/prototype/_components/tasks.ts
deleted file mode 100644
index 1cd71b91..00000000
--- a/site/src/app/prototype/_components/tasks.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-import type { LiveTask, TaskId, TaskSample } from '@/app/prototype/_components/types';
-
-export const TASKS: Record<TaskId, TaskSample> = {
- compare: { id: 'compare', label: 'Compare options', color: '#1D9E75', detail: 'Ranking the best choices' },
- research: { id: 'research', label: 'Gather research', color: '#EF9F27', detail: 'Reading sources' },
- reply: { id: 'reply', label: 'Draft a reply', color: '#D4537E', detail: 'Writing the message' },
- schedule: { id: 'schedule', label: 'Plan a time', color: '#378ADD', detail: 'Finding open slots' },
- update: { id: 'update', label: 'Update a file', color: '#7F77DD', detail: 'Making edits' },
-};
-
-export const ALL_TASK_IDS = ['compare', 'research', 'reply', 'schedule', 'update'] satisfies TaskId[];
-
-export const TASK_COLORS = ['#1D9E75', '#EF9F27', '#D4537E', '#378ADD', '#7F77DD', '#E15A47', '#3DB0B5', '#A856C9'];
-
-export const MAX_LIVE_TASKS = 8;
-
-// Subtext shown under a task title (and shown briefly in the chin when a task is added). Round-robin.
-export const SAMPLE_SUBTEXTS = [
- 'Reading the linked sources',
- 'Ranking the best options',
- 'Drafting the message',
- 'Finding open time slots',
- 'Comparing prices across sites',
- 'Summarizing the thread',
- 'Checking the latest figures',
- 'Pulling the relevant files together',
-];
-
-// Streaming updates a running task emits; the collapsed chin rotates through these.
-export const UPDATE_MESSAGES = [
- 'Searching for the most relevant results…',
- 'Comparing the top options side by side…',
- 'Found a strong match — verifying it…',
- 'Reading through the linked document…',
- 'Summarizing what I found so far…',
- 'Cross-referencing the latest figures…',
- 'Drafting a response for you to review…',
- 'Tidying up the details…',
- 'Almost done — finalizing the results…',
-];
-
-// A running task finishes (→ done) once it reaches this elapsed time.
-export const TASK_DONE_AT_SECONDS = 180;
-
-// Error chin: macOS system red for the warning icon, plus the copy an auth failure surfaces.
-export const ERROR_RED = 'rgb(255,69,58)';
-export const AUTH_ERROR_MESSAGE = 'Authentication failed — sign in again to keep running your tasks.';
-
-export const INITIAL_LIVE_TASKS: LiveTask[] = [
- {
- id: 'seed-long',
- title: 'Summarize the research thread',
- detail:
- 'Reading through the full discussion, pulling out every decision and open question, cross-referencing the linked documents, and drafting a structured summary that captures the key trade-offs, who raised them, and what still needs a follow-up before this can ship.',
- color: TASKS.update.color,
- seconds: 64,
- status: 'running',
- },
- { id: 'seed-1', title: TASKS.compare.label, detail: TASKS.compare.detail, color: TASKS.compare.color, seconds: 95, status: 'running' },
- // Waiting on the user: the agent asked a question and is blocked — shows the Reply button and a
- // gently pulsing pointer until the user answers.
- { id: 'seed-wait', title: 'Reschedule the standup', detail: 'Which day works better — Tuesday or Thursday?', color: TASK_COLORS[6], seconds: 18, status: 'waiting' },
- { id: 'seed-2', title: TASKS.research.label, detail: TASKS.research.detail, color: TASKS.research.color, seconds: 527, status: 'stopped' },
- { id: 'seed-3', title: TASKS.reply.label, detail: TASKS.reply.detail, color: TASKS.reply.color, seconds: 180, status: 'done' },
- { id: 'seed-4', title: TASKS.schedule.label, detail: TASKS.schedule.detail, color: TASKS.schedule.color, seconds: 40, status: 'running' },
-];
diff --git a/site/src/app/prototype/_components/types.ts b/site/src/app/prototype/_components/types.ts
deleted file mode 100644
index fe999b32..00000000
--- a/site/src/app/prototype/_components/types.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-export type TaskId = 'compare' | 'research' | 'reply' | 'schedule' | 'update';
-
-export type NotchState =
- | 'idle'
- | 'running-single'
- | 'running-multi'
- | 'complete'
- | 'needs-input'
- | 'expanded-pinned';
-
-// 'real' targets devices with a hardware notch (content flanks the void, chin hangs below).
-// 'simulated' targets devices without one (external displays); a free-floating pill.
-export type NotchVariant = 'real' | 'simulated';
-
-export type TaskSample = {
- id: TaskId;
- label: string;
- color: string;
- detail: string;
-};
-
-// 'running' ticks; 'stopped' is paused (resume or close); 'done' is finished; 'waiting' means the
-// agent is blocked on the user (a clarification or review — the only state with a Reply button, since
-// only there is the agent asking); 'error' is a terminal failure (e.g. an auth error) that keeps
-// surfacing until acknowledged. 'waiting', 'done', and 'error' threads are repliable: the user taps the
-// row to pick them back up.
-export type LiveTaskStatus = 'running' | 'stopped' | 'done' | 'waiting' | 'error';
-
-// The streaming update currently surfaced in the collapsed notch chin (with its task's color).
-// `isError` marks a failure so the chin renders the warning icon in error red.
-export type NotchUpdate = {
- color: string;
- message: string;
- isError?: boolean;
-};
-
-// A task shown in the expanded notch list.
-export type LiveTask = {
- id: string;
- title: string;
- detail: string;
- color: string;
- seconds: number;
- status: LiveTaskStatus;
-};
diff --git a/site/src/app/prototype/page.tsx b/site/src/app/prototype/page.tsx
deleted file mode 100644
index f751c9de..00000000
--- a/site/src/app/prototype/page.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import type { Metadata } from "next";
-
-import NotchPrototypeApp from "@/app/prototype/_components/App";
-
-export const runtime = "nodejs";
-
-export const metadata: Metadata = {
- title: "Donkey Notch Prototype",
- description: "Interactive Donkey notch prototype.",
-};
-
-export default function Page() {
- return <NotchPrototypeApp />;
-}
diff --git a/site/src/proxy.ts b/site/src/proxy.ts
index 4cb8515d..1346679a 100644
--- a/site/src/proxy.ts
+++ b/site/src/proxy.ts
@@ -1,11 +1,7 @@
import { NextResponse, type NextRequest } from "next/server";
import { allowedOrigin, corsHeaders, preflightHeaders } from "@/cut/server/cors";
-import {
- DONKEYCUT_CANONICAL,
- isDonkeycutHost,
- isLocalHost,
-} from "@/cut/lib/hosts";
+import { DONKEYCUT_CANONICAL, isDonkeycutHost } from "@/cut/lib/hosts";
// Cut (the video editor, publicly "Donkey Cut") lives under /cut in this single
// site app: the marketing landing at /cut and the app under /cut/app. Every
@@ -98,10 +94,6 @@ export function proxy(req: NextRequest) {
if (underPath(pathname, "/api")) return NextResponse.next();
if (passesThrough(pathname)) return NextResponse.next();
- // The notch prototype is a dev-only page.
- if (isLocalHost(host) && underPath(pathname, "/prototype")) {
- return NextResponse.next();
- }
const url = req.nextUrl.clone();
url.pathname =