Skip to content

Open source CapCut alternative.

TypeScript

feat(site): rebuild notch prototype with task queue, streaming chin, and notifications

David Le9797a18527fa
diff --git a/site/src/app/prototype/_components/ActivityBars.tsx b/site/src/app/prototype/_components/ActivityBars.tsx
deleted file mode 100644
index a539547b..00000000
--- a/site/src/app/prototype/_components/ActivityBars.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-type Props = {
- color?: string;
- height?: number;
-};
-
-const BAR_SCALES = [0.44, 0.82, 0.58] as const;
-
-export function ActivityBars({ color = '#fff', height = 18 }: Props) {
- return (
- <div className="flex w-[18px] flex-shrink-0 items-center justify-center gap-[3px]" style={{ height }}>
- {BAR_SCALES.map((scale) => (
- <span
- key={scale}
- className="w-[3px] rounded-full"
- style={{ height: height * scale, background: color }}
- />
- ))}
- </div>
- );
-}
diff --git a/site/src/app/prototype/_components/App.tsx b/site/src/app/prototype/_components/App.tsx
index ed8f53ad..60176b00 100644
--- a/site/src/app/prototype/_components/App.tsx
+++ b/site/src/app/prototype/_components/App.tsx
@@ -4,48 +4,43 @@ import { type FormEvent, useCallback, useEffect, useLayoutEffect, useRef, useSta
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';
+import {
+ 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;
-const COLLAPSED_NOTCH_VISIBLE_HEIGHT = 32;
-const SPAWN_FALLBACK_VERTICAL_OFFSET = 250;
-const SPAWN_SCREEN_INSET = 36;
-const SPAWN_NOTCH_CUE_DURATION_MS = 260;
-const SPAWN_TRAVEL_DURATION_MS = 820;
-
-function clampedSpawnPoint(x: number, y: number, desktopSize: DesktopSize) {
- return {
- x: Math.min(Math.max(x, SPAWN_SCREEN_INSET), Math.max(SPAWN_SCREEN_INSET, desktopSize.w - SPAWN_SCREEN_INSET)),
- y: Math.min(Math.max(y, SPAWN_SCREEN_INSET), Math.max(SPAWN_SCREEN_INSET, desktopSize.h - SPAWN_SCREEN_INSET)),
- };
-}
-
-function fallbackSpawnTarget(desktopSize: DesktopSize, spawnIndex: number) {
- const stagger = ((spawnIndex % 5) - 2) * 18;
-
- return clampedSpawnPoint(
- desktopSize.w / 2 + stagger,
- COLLAPSED_NOTCH_VISIBLE_HEIGHT + SPAWN_FALLBACK_VERTICAL_OFFSET,
- desktopSize,
- );
-}
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);
+ 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);
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 [spawns, setSpawns] = useState<Spawn[]>([]);
- const [selectedSpawnId, setSelectedSpawnId] = useState<string | null>(null);
- const [editingSpawnId, setEditingSpawnId] = useState<string | null>(null);
- 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[]>([]);
+ const liveTaskIdRef = useRef(0);
+ const liveTasksRef = useRef(liveTasks);
+ const updateCounterRef = useRef(0);
useLayoutEffect(() => {
const input = promptInputRef.current;
@@ -60,86 +55,103 @@ export default function App() {
setPromptTextHeight(nextHeight);
}, [promptText]);
- const promptExpanded =
- promptText.trim().length > 0 &&
- (promptTextHeight > COMPOSER_TEXT_MIN_HEIGHT + 1 || promptText.includes('\n'));
+ // 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]);
- useLayoutEffect(() => {
- const desktop = desktopRef.current;
- if (!desktop) return;
+ // Any click outside the composer dismisses it.
+ useEffect(() => {
+ if (!composerVisible) return;
- const observer = new ResizeObserver((entries) => {
- const rect = entries[0]?.contentRect;
- if (!rect) return;
+ const onPointerDown = (event: PointerEvent) => {
+ const target = event.target;
+ if (target instanceof Element && target.closest('[aria-label="Donkey prompt"]')) return;
+ setComposerVisible(false);
+ };
- setDesktopSize({ w: rect.width, h: rect.height });
- });
- observer.observe(desktop);
+ document.addEventListener('pointerdown', onPointerDown);
+ return () => document.removeEventListener('pointerdown', onPointerDown);
+ }, [composerVisible]);
- return () => observer.disconnect();
+ // 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(() => {
- return () => {
- spawnTimerRef.current.forEach((timer) => window.clearTimeout(timer));
- spawnTimerRef.current = [];
- };
+ liveTasksRef.current = liveTasks;
+ }, [liveTasks]);
+
+ // Rotate the collapsed chin through running tasks' streaming updates, one at a time.
+ useEffect(() => {
+ const interval = window.setInterval(() => {
+ const running = liveTasksRef.current.filter((task) => task.status === 'running');
+ if (running.length === 0) {
+ setChinUpdate(null);
+ return;
+ }
+ updateCounterRef.current += 1;
+ const task = running[updateCounterRef.current % running.length];
+ const message = UPDATE_MESSAGES[updateCounterRef.current % UPDATE_MESSAGES.length];
+ setChinUpdate({ color: task.color, message });
+ }, 2600);
+
+ return () => window.clearInterval(interval);
}, []);
- const advanceSpawn = useCallback((id: string, nextPhase: SpawnPhase) => {
- setSpawns((current) => current.map((spawn) => (spawn.id === id ? { ...spawn, phase: nextPhase } : spawn)));
+ 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 });
}, []);
- const scheduleSpawnPhase = useCallback((id: string, nextPhase: SpawnPhase, delay: number) => {
- const timer = window.setTimeout(() => advanceSpawn(id, nextPhase), delay);
- spawnTimerRef.current.push(timer);
- }, [advanceSpawn]);
-
- const handleSpawn = useCallback((taskText: string) => {
- const spawnIndex = spawnCounterRef.current;
- spawnCounterRef.current += 1;
- const id = `spawn-${spawnCounterRef.current}-${Date.now()}`;
- const color = TASK_COLORS[spawnIndex % TASK_COLORS.length];
- const target = fallbackSpawnTarget(desktopSize, spawnIndex);
-
- setSpawns((current) => [
- ...current,
- {
- id,
- taskId: id,
- color,
- label: taskText,
- target,
- phase: 'notch-cue',
- notchCueAngleDegrees: 90,
- startedAt: Date.now(),
- },
- ]);
- setSelectedSpawnId(id);
- setEditingSpawnId(null);
-
- scheduleSpawnPhase(id, 'traveling', SPAWN_NOTCH_CUE_DURATION_MS);
- scheduleSpawnPhase(id, 'holding', SPAWN_NOTCH_CUE_DURATION_MS + SPAWN_TRAVEL_DURATION_MS);
- }, [desktopSize, scheduleSpawnPhase]);
-
- const handleSpawnFollowUp = useCallback((spawnId: string, text: string) => {
- const label = text.trim();
- if (!label) return;
-
- setSpawns((current) =>
- current.map((spawn) =>
- spawn.id === spawnId
- ? {
- ...spawn,
- label,
- phase: 'holding',
- startedAt: Date.now(),
- }
- : spawn,
- ),
- );
- setSelectedSpawnId(spawnId);
- setEditingSpawnId(null);
+ 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)));
+ }, []);
+
+ const closeLiveTask = useCallback((id: string) => {
+ setLiveTasks((tasks) => tasks.filter((task) => task.id !== id));
}, []);
const handleSubmit = useCallback((event: FormEvent<HTMLFormElement>) => {
@@ -148,10 +160,11 @@ export default function App() {
const taskText = promptText.trim();
if (!taskText) return;
- handleSpawn(taskText);
+ // The composer adds a task to the notch list and runs it through the simulation.
+ addLiveTask(taskText);
setPromptText('');
- promptInputRef.current?.focus();
- }, [handleSpawn, promptText]);
+ setComposerVisible(false);
+ }, [addLiveTask, promptText]);
const isNotchExpanded = notchExpanded || state === 'expanded-pinned';
@@ -159,36 +172,37 @@ export default function App() {
<div className="relative min-h-screen">
<MacDesktop
state={state}
- activeTaskId={activeTaskId}
+ notchVariant={notchVariant}
+ updateAvailable={updateAvailable}
+ onRestart={() => setUpdateAvailable(false)}
+ missingPermissions={missingPermissions}
+ onReviewPermissions={() => setMissingPermissions(false)}
notchExpanded={isNotchExpanded}
setNotchExpanded={setNotchExpanded}
+ composerVisible={composerVisible}
promptText={promptText}
setPromptText={setPromptText}
promptInputRef={promptInputRef}
promptTextHeight={promptTextHeight}
- promptExpanded={promptExpanded}
onPromptSubmit={handleSubmit}
- desktopRef={desktopRef}
- desktopSize={desktopSize}
- spawns={spawns}
- selectedSpawnId={selectedSpawnId}
- editingSpawnId={editingSpawnId}
- setSelectedSpawnId={setSelectedSpawnId}
- setEditingSpawnId={setEditingSpawnId}
- onSpawnFollowUp={handleSpawnFollowUp}
- onRequestSpawn={handleSpawn}
+ liveTasks={liveTasks}
+ chinUpdate={chinUpdate}
+ onAddTask={addLiveTask}
+ onStopTask={stopLiveTask}
+ onResumeTask={resumeLiveTask}
+ onCloseTask={closeLiveTask}
/>
<DemoControls
state={state}
setState={setState}
+ notchVariant={notchVariant}
+ setNotchVariant={setNotchVariant}
+ updateAvailable={updateAvailable}
+ setUpdateAvailable={setUpdateAvailable}
+ missingPermissions={missingPermissions}
+ setMissingPermissions={setMissingPermissions}
activeTaskId={activeTaskId}
setActiveTaskId={setActiveTaskId}
- spawnCount={spawns.length}
- onClearSpawns={() => {
- setSpawns([]);
- setSelectedSpawnId(null);
- setEditingSpawnId(null);
- }}
/>
</div>
);
diff --git a/site/src/app/prototype/_components/DemoControls.tsx b/site/src/app/prototype/_components/DemoControls.tsx
index 969fde32..193d57c1 100644
--- a/site/src/app/prototype/_components/DemoControls.tsx
+++ b/site/src/app/prototype/_components/DemoControls.tsx
@@ -1,16 +1,21 @@
-import { Check, Trash2 } from 'lucide-react';
+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, TaskId } from '@/app/prototype/_components/types';
+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;
activeTaskId: TaskId;
setActiveTaskId: (id: TaskId) => void;
- spawnCount: number;
- onClearSpawns: () => void;
};
type StateOption = {
@@ -27,14 +32,31 @@ const STATE_OPTIONS: StateOption[] = [
{ 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,
activeTaskId,
setActiveTaskId,
- spawnCount,
- onClearSpawns,
}: Props) {
+ const [notificationsOpen, setNotificationsOpen] = useState(false);
+
+ const notifications = [
+ { 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"
@@ -63,6 +85,69 @@ export function DemoControls({
<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" />
+
+ <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];
@@ -85,22 +170,6 @@ export function DemoControls({
);
})}
</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/DonkeyCursor.tsx b/site/src/app/prototype/_components/DonkeyCursor.tsx
index 1f8e8c5b..14a1c54b 100644
--- a/site/src/app/prototype/_components/DonkeyCursor.tsx
+++ b/site/src/app/prototype/_components/DonkeyCursor.tsx
@@ -2,9 +2,10 @@ type Props = {
color: string;
size?: number;
className?: string;
+ silhouette?: boolean;
};
-export function DonkeyCursor({ color, size = 28, className }: Props) {
+export function DonkeyCursor({ color, size = 28, className, silhouette = false }: Props) {
return (
<div className={`relative flex-shrink-0 ${className ?? ''}`} style={{ width: size, height: size }}>
<svg
@@ -15,15 +16,15 @@ export function DonkeyCursor({ color, size = 28, className }: Props) {
position: 'absolute',
left: 0,
top: 0,
- filter: 'drop-shadow(0 2px 4px rgba(0,0,0,0.34))',
+ 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={color}
- stroke="rgba(255,255,255,0.92)"
- strokeWidth="5.36"
+ 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>
diff --git a/site/src/app/prototype/_components/ExpandedTaskRow.tsx b/site/src/app/prototype/_components/ExpandedTaskRow.tsx
new file mode 100644
index 00000000..e41cadc3
--- /dev/null
+++ b/site/src/app/prototype/_components/ExpandedTaskRow.tsx
@@ -0,0 +1,58 @@
+import { Play, Square, X } from 'lucide-react';
+
+import { DonkeyCursor } from '@/app/prototype/_components/DonkeyCursor';
+import type { LiveTaskStatus } from '@/app/prototype/_components/types';
+
+type Props = {
+ title: string;
+ detail: string;
+ color: string;
+ status: LiveTaskStatus;
+ timeText: string;
+ onStop: () => void;
+ onResume: () => void;
+ onClose: () => 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({ title, detail, color, status, timeText, onStop, onResume, onClose }: Props) {
+ const running = status === 'running';
+
+ return (
+ <article className="group relative flex items-start gap-3 rounded-lg px-3 py-2.5 transition-colors hover:bg-white/[0.07]">
+ <DonkeyCursor color={color} size={14} silhouette={!running} className="mt-0.5" />
+ <div className="min-w-0 flex-1 pr-[88px]">
+ <h2 className="truncate text-[13px] font-normal leading-4 text-white/[0.9]">{title}</h2>
+ {detail && (
+ <p className="mt-1 line-clamp-5 text-[12px] font-normal leading-[14px] text-white/[0.42]">{detail}</p>
+ )}
+ </div>
+
+ {/* Controls (fixed top-right): running → stop; stopped → resume + close; done → close. */}
+ <div className="absolute right-3 top-2 flex items-center gap-1.5">
+ {running && (
+ <button type="button" onClick={onStop} aria-label="Stop" className={controlClass}>
+ <Square size={9} fill="currentColor" />
+ </button>
+ )}
+ {status === 'stopped' && (
+ <button type="button" onClick={onResume} aria-label="Resume" className={controlClass}>
+ <Play size={10} fill="currentColor" />
+ </button>
+ )}
+ {!running && (
+ <button type="button" onClick={onClose} aria-label="Close" className={controlClass}>
+ <X size={11} strokeWidth={2.25} />
+ </button>
+ )}
+ </div>
+
+ {/* Elapsed time is pinned underneath the controls (with a clear gap) so it never shifts. */}
+ <span className="absolute right-3 top-[36px] whitespace-nowrap text-[10px] leading-none text-white/[0.55]">
+ {timeText}
+ </span>
+ </article>
+ );
+}
diff --git a/site/src/app/prototype/_components/MacDesktop.tsx b/site/src/app/prototype/_components/MacDesktop.tsx
index 11b2e34f..001f2c49 100644
--- a/site/src/app/prototype/_components/MacDesktop.tsx
+++ b/site/src/app/prototype/_components/MacDesktop.tsx
@@ -1,103 +1,73 @@
import { ArrowUp, Mic } from 'lucide-react';
-import type { FormEvent, PointerEvent, RefObject } from 'react';
+import type { FormEvent, RefObject } from 'react';
import { Notch } from '@/app/prototype/_components/Notch';
-import { SpawnedCursor } from '@/app/prototype/_components/SpawnedCursor';
-import type { DesktopSize, NotchState, Spawn, TaskId } from '@/app/prototype/_components/types';
+import type { LiveTask, NotchState, NotchUpdate, NotchVariant } from '@/app/prototype/_components/types';
type Props = {
state: NotchState;
- activeTaskId: TaskId;
+ notchVariant: NotchVariant;
+ updateAvailable: boolean;
+ onRestart: () => void;
+ missingPermissions: boolean;
+ onReviewPermissions: () => void;
notchExpanded: boolean;
setNotchExpanded: (expanded: boolean) => void;
+ composerVisible: boolean;
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[];
- selectedSpawnId: string | null;
- editingSpawnId: string | null;
- setSelectedSpawnId: (id: string | null) => void;
- setEditingSpawnId: (id: string | null) => void;
- onSpawnFollowUp: (spawnId: string, text: string) => void;
- onRequestSpawn: (taskText: string) => void;
+ liveTasks: LiveTask[];
+ chinUpdate: NotchUpdate | null;
+ onAddTask: (title: string) => void;
+ onStopTask: (id: string) => void;
+ onResumeTask: (id: string) => void;
+ onCloseTask: (id: string) => void;
};
const LAYOUT = {
contentWidth: 592,
- contentExtraHeight: 8,
stageHorizontalPadding: 8,
stageVerticalPadding: 10,
composerWidth: 576,
- composerCornerRadius: 22,
- composerInputMinimumHeight: 66,
- composerInputLeadingContentPadding: 20,
- composerInputTrailingContentPadding: 14.6,
- composerWaveformWidth: 54,
- composerWaveformHeight: 28,
- composerMicrophoneIconSize: 28,
+ // 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,
- composerTrailingControlsSpacing: 16,
- composerTrailingControlsWidth: 80.8,
- composerWrappingTextWidth: 449,
- composerExpandedTextWidth: 528,
- composerExpandedTextTopPadding: 18,
- composerExpandedTextHorizontalPadding: 24,
- composerExpandedToolbarHeight: 54,
- composerExpandedMinimumHeight: 156,
} as const;
export function MacDesktop({
state,
- activeTaskId,
+ notchVariant,
+ updateAvailable,
+ onRestart,
+ missingPermissions,
+ onReviewPermissions,
notchExpanded,
setNotchExpanded,
+ composerVisible,
promptText,
setPromptText,
promptInputRef,
promptTextHeight,
- promptExpanded,
onPromptSubmit,
- desktopRef,
- desktopSize,
- spawns,
- selectedSpawnId,
- editingSpawnId,
- setSelectedSpawnId,
- setEditingSpawnId,
- onSpawnFollowUp,
- onRequestSpawn,
+ liveTasks,
+ chinUpdate,
+ onAddTask,
+ onStopTask,
+ onResumeTask,
+ onCloseTask,
}: Props) {
- const composerHeight = promptExpanded
- ? Math.max(
- LAYOUT.composerExpandedMinimumHeight,
- promptTextHeight + LAYOUT.composerExpandedTextTopPadding + LAYOUT.composerExpandedToolbarHeight,
- )
- : LAYOUT.composerInputMinimumHeight;
- const hostHeight = LAYOUT.stageVerticalPadding * 2 + composerHeight + LAYOUT.contentExtraHeight;
- const activeSpawnCue = [...spawns].reverse().find((spawn) => spawn.phase === 'notch-cue') ?? null;
const hasPromptText = promptText.trim().length > 0;
- const handleDesktopPointerDown = (event: PointerEvent<HTMLElement>) => {
- if (!editingSpawnId) return;
-
- const target = event.target;
- if (!(target instanceof Element)) return;
- if (target.closest('[data-spawn-interactive="true"]')) return;
-
- setEditingSpawnId(null);
- };
-
return (
<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' }}
- onPointerDown={handleDesktopPointerDown}
>
<div
className="absolute inset-0"
@@ -115,7 +85,7 @@ export function MacDesktop({
/>
<div
- 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]"
+ 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)',
@@ -132,52 +102,43 @@ export function MacDesktop({
<Notch
state={state}
- activeTaskId={activeTaskId}
+ variant={notchVariant}
+ updateAvailable={updateAvailable}
+ onRestart={onRestart}
+ missingPermissions={missingPermissions}
+ onReviewPermissions={onReviewPermissions}
expanded={notchExpanded}
setExpanded={setNotchExpanded}
- spawnCue={activeSpawnCue}
- onRequestSpawn={onRequestSpawn}
+ liveTasks={liveTasks}
+ chinUpdate={chinUpdate}
+ onAddTask={onAddTask}
+ onStopTask={onStopTask}
+ onResumeTask={onResumeTask}
+ onCloseTask={onCloseTask}
/>
- {spawns.map((spawn, index) => (
- <SpawnedCursor
- key={spawn.id}
- spawn={spawn}
- spawnOrigin={{ x: desktopSize.w / 2 + ((index % 5) - 2) * 18, y: -24 }}
- desktopSize={desktopSize}
- selected={selectedSpawnId === spawn.id}
- editing={editingSpawnId === spawn.id}
- onSelect={() => setSelectedSpawnId(spawn.id)}
- onBeginEditing={() => {
- setSelectedSpawnId(spawn.id);
- setEditingSpawnId(spawn.id);
- }}
- onCancelEditing={() => setEditingSpawnId(null)}
- onSubmitFollowUp={(text) => onSpawnFollowUp(spawn.id, text)}
- />
- ))}
-
<section
aria-label="Donkey prompt"
className="absolute left-1/2 top-1/2 z-20"
style={{
width: LAYOUT.contentWidth,
- height: hostHeight,
padding: `${LAYOUT.stageVerticalPadding}px ${LAYOUT.stageHorizontalPadding}px`,
- transform: 'translate(-50%, -50%)',
+ 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 bg-black"
+ className="relative flex items-center 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',
+ 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">
@@ -190,16 +151,11 @@ export function MacDesktop({
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]"
+ 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={{
- left: promptExpanded
- ? LAYOUT.composerExpandedTextHorizontalPadding
- : LAYOUT.composerInputLeadingContentPadding,
- top: promptExpanded
- ? LAYOUT.composerExpandedTextTopPadding
- : (LAYOUT.composerInputMinimumHeight - promptTextHeight) / 2,
- width: promptExpanded ? LAYOUT.composerExpandedTextWidth : LAYOUT.composerWrappingTextWidth,
height: promptTextHeight,
+ maxHeight: LAYOUT.composerTextMaxHeight,
+ overflowY: 'auto',
caretColor: 'white',
fontVariantLigatures: 'none',
}}
@@ -210,26 +166,13 @@ export function MacDesktop({
}
}}
/>
- <div
- className="absolute flex items-center justify-end"
- style={{
- right: promptExpanded
- ? LAYOUT.composerExpandedTextHorizontalPadding
- : LAYOUT.composerInputTrailingContentPadding,
- top: promptExpanded
- ? composerHeight - LAYOUT.composerExpandedToolbarHeight + (LAYOUT.composerExpandedToolbarHeight - LAYOUT.composerSendButtonSize) / 2
- : (LAYOUT.composerInputMinimumHeight - LAYOUT.composerSendButtonSize) / 2,
- width: LAYOUT.composerTrailingControlsWidth,
- height: LAYOUT.composerSendButtonSize,
- gap: LAYOUT.composerTrailingControlsSpacing,
- }}
- >
+ <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.composerMicrophoneIconSize,
- height: LAYOUT.composerMicrophoneIconSize,
+ width: LAYOUT.composerMicrophoneSize,
+ height: LAYOUT.composerMicrophoneSize,
color: hasPromptText ? 'rgba(255,255,255,0.42)' : 'rgba(255,255,255,0.78)',
}}
aria-label="Voice input"
diff --git a/site/src/app/prototype/_components/Notch.tsx b/site/src/app/prototype/_components/Notch.tsx
index 04f16724..8cfe8331 100644
--- a/site/src/app/prototype/_components/Notch.tsx
+++ b/site/src/app/prototype/_components/Notch.tsx
@@ -1,91 +1,162 @@
-import { ArrowUp, Check, MessageCircle, Pause, Play } from 'lucide-react';
-import type { FormEvent } from 'react';
+import { ArrowUp, CloudSync, MessageCircleWarning, Shield } from 'lucide-react';
+import { type FormEvent, useEffect, useRef, useState } from 'react';
-import { ActivityBars } from '@/app/prototype/_components/ActivityBars';
import { DonkeyCursor } from '@/app/prototype/_components/DonkeyCursor';
-import { TASKS } from '@/app/prototype/_components/tasks';
-import type { NotchState, Spawn, TaskId } from '@/app/prototype/_components/types';
+import { ExpandedTaskRow } from '@/app/prototype/_components/ExpandedTaskRow';
+import type { LiveTask, NotchState, NotchUpdate, NotchVariant } from '@/app/prototype/_components/types';
type Props = {
state: NotchState;
- activeTaskId: TaskId;
+ variant: NotchVariant;
+ updateAvailable: boolean;
+ onRestart: () => void;
+ missingPermissions: boolean;
+ onReviewPermissions: () => void;
expanded: boolean;
setExpanded: (expanded: boolean) => void;
- spawnCue: Spawn | null;
- onRequestSpawn: (taskText: string) => void;
+ liveTasks: LiveTask[];
+ chinUpdate: NotchUpdate | null;
+ onAddTask: (title: string) => void;
+ onStopTask: (id: string) => void;
+ onResumeTask: (id: string) => void;
+ onCloseTask: (id: string) => void;
};
const METRICS = {
- collapsedWidth: 248,
+ 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: single streaming line, 9px font, no top padding.
+ chinHeight: 20,
+ // Simulated notch grows to fit a two-line message inline.
+ simulatedMessageHeight: 50,
expandedWidth: 604,
expandedHeight: 312,
expandedContentHeight: 280,
collapsedCornerRadius: 14,
- expandedCornerRadius: 26,
+ simulatedCornerRadius: 16,
+ // Spec: the expanded notch window and its input box both use a 14px radius.
+ expandedCornerRadius: 14,
contentInset: 14,
} as const;
-type RowStatus = 'running' | 'completed' | 'needsAttention';
+// 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;
-type TaskRow = {
- id: string;
- title: string;
- detail: string;
- color: string;
- status: RowStatus;
-};
+// Expanded rows have room for the full elapsed time.
+function formatRunningTime(totalSeconds: number) {
+ const minutes = Math.floor(totalSeconds / 60);
+ const seconds = totalSeconds % 60;
-function taskRowsForState(state: NotchState, activeTaskId: TaskId): TaskRow[] {
- const activeTask = TASKS[activeTaskId];
- const activeTitle = activeTask.label;
+ return `${minutes}m ${seconds}s`;
+}
- if (state === 'idle') {
- return [];
- }
+// The collapsed right slot is only 34px wide, so keep elapsed time to ~3 chars: seconds, then minutes, then hours.
+function formatCompactTime(totalSeconds: number) {
+ const hours = Math.floor(totalSeconds / 3600);
+ const minutes = Math.floor((totalSeconds % 3600) / 60);
+ const seconds = totalSeconds % 60;
- 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 (hours > 0) return `${hours}h ${minutes}m`;
+ if (minutes > 0) return `${minutes}m`;
+ return `${seconds}s`;
+}
- 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' },
- ];
- }
+// Running states stream a message into the chin and pulse the arrow.
+function isRunningState(state: NotchState) {
+ return state === 'running-single' || state === 'running-multi';
+}
- 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' },
- ];
+// 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,
+ expanded,
+ setExpanded,
+ liveTasks,
+ chinUpdate,
+ onAddTask,
+ onStopTask,
+ onResumeTask,
+ onCloseTask,
+}: Props) {
+ const isRunning = isRunningState(state);
+ const isActive = hasActiveTask(state);
+ const isComplete = state === 'complete';
+ 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)';
+
+ // 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);
}
- 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' },
- ];
-}
+ useEffect(() => {
+ if (!isRunning) return;
-function spawnCueExitTransform(angleDegrees: number) {
- const radians = (angleDegrees * Math.PI) / 180;
- const distance = 28;
+ const interval = window.setInterval(() => setRunningSeconds((seconds) => seconds + 1), 1000);
- return {
- x: Math.cos(radians) * distance,
- y: Math.sin(radians) * distance,
- };
-}
+ return () => window.clearInterval(interval);
+ }, [isRunning]);
+
+ // The chin (real) / inline (simulated) shows the current streaming update; hidden when expanded.
+ const message = !expanded && chinUpdate ? chinUpdate.message : '';
+ const collapsedTime = formatCompactTime(runningSeconds);
+
+ // App-level notices share a single slot; permissions outranks update since it blocks functionality.
+ const appNotice: 'permissions' | 'update' | null = missingPermissions
+ ? 'permissions'
+ : updateAvailable
+ ? 'update'
+ : null;
+ const showChin = variant === 'real' && message !== '';
+ const isSimulatedExpandedMessage = variant === 'simulated' && message !== '';
-export function Notch({ state, activeTaskId, expanded, setExpanded, spawnCue, onRequestSpawn }: Props) {
- const rows = taskRowsForState(state, activeTaskId);
- const activeColor = rows[0]?.color ?? 'rgb(29,158,117)';
- const spawnCueOffset = spawnCue ? spawnCueExitTransform(spawnCue.notchCueAngleDegrees) : null;
+ const collapsedHeight = expanded
+ ? METRICS.expandedHeight
+ : variant === 'real'
+ ? METRICS.collapsedHeight + (showChin ? METRICS.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 [canSendFollowUp, setCanSendFollowUp] = useState(false);
+
+ 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);
+ };
const handleFollowUpSubmit = (event: FormEvent<HTMLFormElement>) => {
event.preventDefault();
@@ -95,49 +166,21 @@ export function Notch({ state, activeTaskId, expanded, setExpanded, spawnCue, on
const taskText = String(formData.get('followUp') ?? '').trim();
if (!taskText) return;
- onRequestSpawn(taskText);
+ onAddTask(taskText);
form.reset();
+ setCanSendFollowUp(false);
+ if (followUpRef.current) followUpRef.current.style.height = `${FOLLOWUP_MIN_HEIGHT}px`;
};
- const spawnCueArrow = spawnCue && spawnCueOffset && (
- <>
- <style>{`
- @keyframes notchSpawnCue-${spawnCue.id} {
- 0%, 30% {
- transform: translate(-50%, -50%) rotate(-45deg);
- opacity: 1;
- }
- 100% {
- transform: translate(calc(-50% + ${spawnCueOffset.x}px), calc(-50% + ${spawnCueOffset.y}px)) rotate(${spawnCue.notchCueAngleDegrees}deg);
- opacity: 0;
- }
- }
- `}</style>
- <div
- className="absolute z-10"
- style={{
- left: 17,
- top: Math.max(14, METRICS.collapsedHeight / 2),
- width: 15,
- height: 15,
- animation: `notchSpawnCue-${spawnCue.id} 260ms ease-in-out both`,
- }}
- aria-hidden="true"
- >
- <DonkeyCursor color={spawnCue.color} size={15} />
- </div>
- </>
- );
-
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: expanded ? METRICS.expandedWidth : METRICS.collapsedWidth,
- height: expanded ? METRICS.expandedHeight : METRICS.collapsedHeight,
- borderBottomLeftRadius: expanded ? METRICS.expandedCornerRadius : METRICS.collapsedCornerRadius,
- borderBottomRightRadius: expanded ? METRICS.expandedCornerRadius : METRICS.collapsedCornerRadius,
+ width: collapsedWidth,
+ height: collapsedHeight,
+ borderBottomLeftRadius: cornerRadius,
+ borderBottomRightRadius: cornerRadius,
transition: 'width 220ms ease-out, height 220ms ease-out, border-radius 220ms ease-out',
}}
tabIndex={0}
@@ -148,14 +191,20 @@ export function Notch({ state, activeTaskId, expanded, setExpanded, spawnCue, on
onMouseEnter={() => setExpanded(true)}
onMouseLeave={() => setExpanded(false)}
>
+ <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: expanded ? METRICS.expandedWidth : METRICS.collapsedWidth,
- height: expanded ? METRICS.expandedHeight : METRICS.collapsedHeight,
+ width: collapsedWidth,
+ height: collapsedHeight,
transform: 'translateX(-50%)',
- borderBottomLeftRadius: expanded ? METRICS.expandedCornerRadius : METRICS.collapsedCornerRadius,
- borderBottomRightRadius: expanded ? METRICS.expandedCornerRadius : METRICS.collapsedCornerRadius,
+ 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',
@@ -164,15 +213,117 @@ export function Notch({ state, activeTaskId, expanded, setExpanded, spawnCue, on
<div
className="absolute inset-0"
style={{
- opacity: expanded || spawnCue ? 0 : 1,
+ opacity: expanded ? 0 : 1,
transition: 'opacity 150ms ease-out',
pointerEvents: 'none',
}}
>
- <DonkeyCursor color={activeColor} size={13} className="absolute left-[10.5px] top-[9.5px]" />
+ {/* Left content area — arrow silhouette when not active; colored, pulsing while running. */}
+ <div
+ className="absolute left-0 top-0 grid place-items-center"
+ style={{ width: METRICS.contentAreaWidth, height: contentRowHeight }}
+ >
+ <div style={{ animation: streaming ? 'notchArrowPulse 1.6s ease-in-out infinite' : undefined }}>
+ <DonkeyCursor color={activeColor} size={14} silhouette={!streaming} />
+ </div>
+ </div>
+
+ {/* Right content area — notifications surface here only when needed, otherwise run time. */}
+ {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>
+ ) : isActive ? (
+ <div
+ className="absolute right-0 top-0 flex flex-col justify-center whitespace-nowrap text-[9px] leading-[11px] text-white/[0.72]"
+ style={{ width: METRICS.contentAreaWidth, height: contentRowHeight }}
+ >
+ {isComplete && <span className="text-white/[0.92]">Done</span>}
+ <span>{collapsedTime}</span>
+ </div>
+ ) : appNotice ? (
+ // Shield = missing permissions; cloud-sync = app update available (detected on launch).
+ <div
+ className="absolute right-0 top-0 grid place-items-center text-white/[0.85]"
+ style={{ width: METRICS.contentAreaWidth, height: contentRowHeight }}
+ >
+ {appNotice === 'permissions' ? (
+ <Shield size={15} strokeWidth={1.9} />
+ ) : (
+ <CloudSync size={15} strokeWidth={1.9} />
+ )}
+ </div>
+ ) : null}
+
+ {/* Real notch: chin hangs below with the single streaming line (ellipsis if too long). */}
+ {variant === 'real' && showChin && (
+ <div
+ className="absolute left-0 overflow-hidden"
+ style={{
+ top: METRICS.collapsedHeight,
+ width: METRICS.collapsedWidth,
+ height: METRICS.chinHeight,
+ padding: '0 12px',
+ }}
+ >
+ <p className="truncate text-[9px] leading-[12px] text-white/[0.72]">{message}</p>
+ </div>
+ )}
+
+ {/* Simulated notch: message sits inline between the arrow and the run time (two lines max). */}
+ {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-[9px] leading-[12px] text-white/[0.72]"
+ style={{
+ display: '-webkit-box',
+ WebkitLineClamp: 2,
+ WebkitBoxOrient: 'vertical',
+ overflow: 'hidden',
+ }}
+ >
+ {message}
+ </p>
+ </div>
+ )}
</div>
- {spawnCueArrow}
+ {/* Expanded right gutter — the only content on the notch row: an app-level action (update / permissions). */}
+ {appNotice && (
+ <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]">
+ {appNotice === 'permissions' ? 'Missing Permissions' : 'Update Available'}
+ </span>
+ <button
+ type="button"
+ onClick={appNotice === 'permissions' ? onReviewPermissions : onRestart}
+ 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]"
+ >
+ {appNotice === 'permissions' ? 'Review' : 'Restart'}
+ </button>
+ </div>
+ )}
<div
className="absolute left-0 flex flex-col gap-2"
@@ -186,55 +337,28 @@ export function Notch({ state, activeTaskId, expanded, setExpanded, spawnCue, on
transition: expanded ? 'opacity 300ms ease-out 150ms' : 'opacity 100ms ease-out',
}}
>
- {rows.length > 0 && (
- <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"
- >
- <DonkeyCursor color={task.color} size={14} />
- <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>
- {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} />
- ) : task.status === 'needsAttention' ? (
- <MessageCircle size={18} color={task.color} strokeWidth={1.35} />
- ) : (
- <ActivityBars color={task.color} />
- )}
- </article>
- ))}
- </div>
+ {/* Scrollable task list fills the space above the always-visible input. */}
+ <div 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}
+ title={task.title}
+ detail={task.detail}
+ color={task.color}
+ status={task.status}
+ timeText={formatRunningTime(task.seconds)}
+ onStop={() => onStopTask(task.id)}
+ onResume={() => onResumeTask(task.id)}
+ onClose={() => onCloseTask(task.id)}
+ />
+ ))}
</div>
- )}
+ </div>
+ {/* Input box is pinned to the bottom and always visible — one line that grows with its text. */}
<form
- className="relative h-[92px] w-[576px] rounded-[22px] bg-white/[0.085]"
- style={{ marginTop: rows.length === 0 ? 16 : 0 }}
+ className="relative flex min-h-[56px] w-[576px] shrink-0 items-center rounded-[14px] bg-white/[0.085] px-5 py-3"
onSubmit={handleFollowUpSubmit}
>
<label className="sr-only" htmlFor="donkey-follow-up-input">
@@ -242,11 +366,19 @@ export function Notch({ state, activeTaskId, expanded, setExpanded, spawnCue, on
</label>
<textarea
id="donkey-follow-up-input"
+ ref={followUpRef}
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' }}
+ placeholder="What can Donkey do for you?"
+ onInput={resizeFollowUp}
+ className="flex-1 resize-none border-0 bg-transparent p-0 pr-12 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();
@@ -254,9 +386,15 @@ export function Notch({ state, activeTaskId, expanded, setExpanded, spawnCue, on
}
}}
/>
+ {/* Send button stays pinned in the lower-right corner, inset from the radius; disabled when empty. */}
<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]"
+ disabled={!canSendFollowUp}
+ className="absolute bottom-3 right-3 grid h-8 w-8 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={16} strokeWidth={2} />
diff --git a/site/src/app/prototype/_components/SpawnedCursor.tsx b/site/src/app/prototype/_components/SpawnedCursor.tsx
deleted file mode 100644
index 4c50e837..00000000
--- a/site/src/app/prototype/_components/SpawnedCursor.tsx
+++ /dev/null
@@ -1,431 +0,0 @@
-import { useEffect, useLayoutEffect, useRef, useState } from 'react';
-import type { CSSProperties, KeyboardEvent } from 'react';
-
-import { DonkeyCursor } from '@/app/prototype/_components/DonkeyCursor';
-import type { DesktopSize, Point, Spawn } from '@/app/prototype/_components/types';
-
-type Props = {
- spawn: Spawn;
- spawnOrigin: Point;
- desktopSize: DesktopSize;
- selected: boolean;
- editing: boolean;
- onSelect: () => void;
- onBeginEditing: () => void;
- onCancelEditing: () => void;
- onSubmitFollowUp: (text: string) => void;
-};
-
-type MotionPathStyle = CSSProperties & {
- WebkitOffsetPath?: string;
- WebkitOffsetRotate?: string;
-};
-
-const TRAVEL_DURATION_MS = 820;
-const CURSOR_BASE_ROTATION_DEG = 50;
-const COLLAPSED_LABEL_WIDTH = 260;
-const COLLAPSED_LABEL_CONTENT_WIDTH = 240;
-const COLLAPSED_LABEL_BOTTOM_GAP = 22;
-const EXPANDED_LABEL_CONTENT_WIDTH = 480;
-const LABEL_HORIZONTAL_PADDING = 10;
-const LABEL_VERTICAL_PADDING = 5;
-const LABEL_FONT_SIZE = 12;
-const LABEL_LINE_HEIGHT = 14;
-const COLLAPSED_LABEL_APPROX_CHARS_PER_LINE = 40;
-const INLINE_EDITOR_CONTENT_WIDTH = 480;
-const INLINE_EDITOR_INPUT_HEIGHT = 64;
-const INLINE_EDITOR_HORIZONTAL_PADDING = 16;
-const INLINE_EDITOR_VERTICAL_PADDING = 14;
-const INLINE_EDITOR_SPACING = 12;
-const INLINE_EDITOR_MIN_TEXT_HEIGHT = 14;
-const INLINE_EDITOR_MAX_TEXT_HEIGHT = 44;
-const HALO_VERTICAL_OFFSET = 12;
-
-const INPUT_ACCENT_BY_COLOR: Record<string, string> = {
- '#1D9E75': '#B0DECF',
- '#EF9F27': '#FADEB3',
- '#D4537E': '#F0C4D1',
- '#378ADD': '#BAD6F2',
- '#7F77DD': '#D4CFF2',
- '#E15A47': '#F5C4BF',
- '#3DB0B5': '#BAE3E6',
- '#A856C9': '#E0C4ED',
-};
-
-function useTypewriterText(text: string, identity: string) {
- const [visibleText, setVisibleText] = useState('');
-
- useEffect(() => {
- const characters = Array.from(text);
- const resetTimer = window.setTimeout(() => setVisibleText(''), 0);
- if (characters.length === 0) {
- return () => window.clearTimeout(resetTimer);
- }
-
- const timers = characters.map((_, index) =>
- window.setTimeout(() => {
- setVisibleText(characters.slice(0, index + 1).join(''));
- }, (index + 1) * 26),
- );
-
- return () => {
- window.clearTimeout(resetTimer);
- timers.forEach((timer) => window.clearTimeout(timer));
- };
- }, [identity, text]);
-
- return visibleText;
-}
-
-function textCharacterCount(text: string) {
- return Math.max(Array.from(text.trim()).length, 1);
-}
-
-function collapsedLabelNeedsExpansion(text: string) {
- return text.includes('\n') || textCharacterCount(text) > 78;
-}
-
-function collapsedLabelHeight(text: string) {
- const lineCount = Math.min(
- Math.max(Math.ceil(textCharacterCount(text) / COLLAPSED_LABEL_APPROX_CHARS_PER_LINE), 1),
- 2,
- );
-
- return lineCount * LABEL_LINE_HEIGHT + LABEL_VERTICAL_PADDING * 2;
-}
-
-function expandedLabelHeight(text: string) {
- const lineCount = Math.max(1, Math.ceil(textCharacterCount(text) / 44));
-
- return Math.max(collapsedLabelHeight(text), lineCount * LABEL_LINE_HEIGHT + LABEL_VERTICAL_PADDING * 2);
-}
-
-function inlineEditorMessageHeight(text: string) {
- const lineCount = Math.min(Math.max(Math.ceil(textCharacterCount(text) / 64), 1), 3);
-
- return lineCount * 14 + 6;
-}
-
-function inlineEditorSize(text: string) {
- return {
- width: INLINE_EDITOR_CONTENT_WIDTH + INLINE_EDITOR_HORIZONTAL_PADDING * 2,
- height:
- inlineEditorMessageHeight(text) +
- INLINE_EDITOR_SPACING +
- INLINE_EDITOR_INPUT_HEIGHT +
- INLINE_EDITOR_VERTICAL_PADDING * 2,
- };
-}
-
-function pointFits(point: Point, offset: Point, labelSize: { width: number; height: number }, desktopSize: DesktopSize) {
- const margin = 20;
- const minX = point.x + offset.x - labelSize.width / 2;
- const minY = point.y + offset.y - labelSize.height / 2;
- const maxX = minX + labelSize.width;
- const maxY = minY + labelSize.height;
-
- return minX >= margin && minY >= margin && maxX <= desktopSize.w - margin && maxY <= desktopSize.h - margin;
-}
-
-function labelOffset(point: Point, labelSize: { width: number; height: number }, desktopSize: DesktopSize) {
- const preferred = { x: 0, y: -(labelSize.height / 2 + COLLAPSED_LABEL_BOTTOM_GAP) };
- const left = { x: -(labelSize.width / 2 + 44), y: 0 };
- const right = { x: labelSize.width / 2 + 44, y: 0 };
- const below = { x: 0, y: labelSize.height / 2 + 44 };
-
- if (pointFits(point, preferred, labelSize, desktopSize)) return preferred;
- if (pointFits(point, left, labelSize, desktopSize)) return left;
- if (pointFits(point, right, labelSize, desktopSize)) return right;
-
- return below;
-}
-
-function inputAccentColor(color: string) {
- return INPUT_ACCENT_BY_COLOR[color.toUpperCase()] ?? 'rgba(255,255,255,0.72)';
-}
-
-export function SpawnedCursor({
- spawn,
- spawnOrigin,
- desktopSize,
- selected,
- editing,
- onSelect,
- onBeginEditing,
- onCancelEditing,
- onSubmitFollowUp,
-}: Props) {
- const { id, color, label, target, phase } = spawn;
- const [labelHovered, setLabelHovered] = useState(false);
- const [draftText, setDraftText] = useState('');
- const [draftTextHeight, setDraftTextHeight] = useState(INLINE_EDITOR_MIN_TEXT_HEIGHT);
- const editorRef = useRef<HTMLTextAreaElement | null>(null);
- const visibleLabel = useTypewriterText(label, `${id}:${label}`);
-
- useEffect(() => {
- if (!editing) return;
-
- window.setTimeout(() => editorRef.current?.focus(), 0);
- }, [editing]);
-
- useLayoutEffect(() => {
- if (!editing) return;
-
- const editor = editorRef.current;
- if (!editor) return;
-
- editor.style.height = 'auto';
- const nextHeight = Math.min(
- Math.max(Math.ceil(editor.scrollHeight), INLINE_EDITOR_MIN_TEXT_HEIGHT),
- INLINE_EDITOR_MAX_TEXT_HEIGHT,
- );
- editor.style.height = `${nextHeight}px`;
- setDraftTextHeight(nextHeight);
- }, [draftText, editing]);
-
- if (phase === 'notch-cue' || phase === 'fading') {
- return null;
- }
-
- const sx = spawnOrigin.x;
- const sy = spawnOrigin.y;
- const tx = target.x;
- const ty = target.y;
- const dx = tx - sx;
- const dy = ty - sy;
- const endAngleDeg = (Math.atan2(dy, dx) * 180) / Math.PI;
- const pathD = `M ${sx},${sy} L ${tx},${ty}`;
- const isTraveling = phase === 'traveling';
- const isHolding = phase === 'holding';
- const labelIsExpanded = labelHovered && collapsedLabelNeedsExpansion(label);
- const labelSize = editing
- ? inlineEditorSize(label)
- : {
- width: labelIsExpanded ? EXPANDED_LABEL_CONTENT_WIDTH + LABEL_HORIZONTAL_PADDING * 2 : COLLAPSED_LABEL_WIDTH,
- height: labelIsExpanded ? expandedLabelHeight(label) : collapsedLabelHeight(label),
- };
- const offset = labelOffset(target, labelSize, desktopSize);
- const cursorStyle: MotionPathStyle = isTraveling
- ? {
- left: 0,
- top: 0,
- width: 28,
- height: 28,
- offsetPath: `path("${pathD}")`,
- WebkitOffsetPath: `path("${pathD}")`,
- offsetRotate: `auto ${CURSOR_BASE_ROTATION_DEG}deg`,
- WebkitOffsetRotate: `auto ${CURSOR_BASE_ROTATION_DEG}deg`,
- animation: `spawnTravel-${id} ${TRAVEL_DURATION_MS}ms cubic-bezier(0.45, 0.05, 0.3, 1) both`,
- }
- : {
- left: target.x,
- top: target.y,
- width: 28,
- height: 28,
- transform: `translate(-50%, -50%) rotate(${endAngleDeg + CURSOR_BASE_ROTATION_DEG}deg)`,
- };
-
- const submitInlineFollowUp = () => {
- const text = draftText.trim();
- if (!text) {
- onCancelEditing();
- return;
- }
-
- onSubmitFollowUp(text);
- setDraftText('');
- };
-
- const handleEditorKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {
- if (event.key === 'Escape') {
- event.preventDefault();
- onCancelEditing();
- return;
- }
-
- if (event.key === 'Enter' && !event.shiftKey) {
- event.preventDefault();
- submitInlineFollowUp();
- }
- };
-
- return (
- <>
- <style>{`
- @keyframes spawnTravel-${id} {
- 0% { offset-distance: 0%; opacity: 0; }
- 14% { opacity: 1; }
- 100% { offset-distance: 100%; opacity: 1; }
- }
- @keyframes spawnTerminalTail-${id} {
- 0%, 50%, 100% { transform: rotate(0deg); }
- 12.5% { transform: rotate(-14deg); }
- 37.5% { transform: rotate(-7deg); }
- 62.5% { transform: rotate(14deg); }
- 87.5% { transform: rotate(7deg); }
- }
- @keyframes spawnWorkingPulse-${id} {
- 0%, 100% { transform: scale(1); }
- 50% { transform: scale(1.08); }
- }
- @keyframes spawnHaloPulse-${id} {
- 0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
- 50% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.2; }
- }
- `}</style>
-
- {isHolding && (
- <div
- className="absolute pointer-events-none rounded-full"
- style={{
- left: target.x,
- top: target.y + HALO_VERTICAL_OFFSET,
- width: 40,
- height: 40,
- border: `1.5px solid ${color}`,
- transform: 'translate(-50%, -50%)',
- animation: `spawnHaloPulse-${id} 1.6s ease-in-out 700ms infinite`,
- zIndex: 29,
- }}
- />
- )}
-
- <button
- type="button"
- data-spawn-interactive="true"
- className="absolute z-30 cursor-default border-0 bg-transparent p-0"
- style={cursorStyle}
- onPointerDown={(event) => {
- event.stopPropagation();
- onSelect();
- }}
- aria-label={selected ? 'Selected Donkey agent' : 'Select Donkey agent'}
- >
- <div
- style={{
- transformOrigin: '50% 50%',
- animation: isHolding ? `spawnTerminalTail-${id} 700ms ease-in-out both` : 'none',
- }}
- >
- <div
- style={{
- transformOrigin: '50% 50%',
- animation: isHolding ? `spawnWorkingPulse-${id} 1.4s ease-in-out 700ms infinite` : 'none',
- }}
- >
- <DonkeyCursor color={color} />
- </div>
- </div>
- </button>
-
- {isHolding && (
- <div
- data-spawn-interactive="true"
- className="absolute text-white"
- style={{
- left: target.x + offset.x,
- top: target.y + offset.y,
- width: labelSize.width,
- minHeight: labelSize.height,
- transform: 'translate(-50%, -50%)',
- zIndex: 29,
- }}
- onPointerDown={(event) => event.stopPropagation()}
- onMouseEnter={() => setLabelHovered(true)}
- onMouseLeave={() => setLabelHovered(false)}
- >
- <div
- className="overflow-hidden"
- style={{
- borderRadius: 8,
- background: color,
- boxShadow: selected ? '0 0 0 1px rgba(255,255,255,0.28), 0 4px 14px rgba(0,0,0,0.24)' : 'none',
- }}
- >
- {editing ? (
- <div
- style={{
- width: INLINE_EDITOR_CONTENT_WIDTH + INLINE_EDITOR_HORIZONTAL_PADDING * 2,
- padding: `${INLINE_EDITOR_VERTICAL_PADDING}px ${INLINE_EDITOR_HORIZONTAL_PADDING}px`,
- }}
- >
- <div
- className="overflow-hidden text-left font-medium text-white"
- style={{
- width: INLINE_EDITOR_CONTENT_WIDTH,
- maxHeight: 42,
- fontSize: LABEL_FONT_SIZE,
- lineHeight: '14px',
- display: '-webkit-box',
- WebkitLineClamp: 3,
- WebkitBoxOrient: 'vertical',
- }}
- >
- {label}
- </div>
- <div
- className="mt-3 overflow-hidden"
- style={{
- width: INLINE_EDITOR_CONTENT_WIDTH,
- height: INLINE_EDITOR_INPUT_HEIGHT,
- padding: '8px 12px',
- borderRadius: 7,
- background: inputAccentColor(color),
- }}
- >
- <textarea
- ref={editorRef}
- rows={1}
- value={draftText}
- onChange={(event) => setDraftText(event.target.value)}
- onKeyDown={handleEditorKeyDown}
- className="block w-full resize-none overflow-hidden border-0 bg-transparent p-0 text-left font-medium outline-none"
- style={{
- height: draftTextHeight,
- color: 'rgba(0,0,0,0.68)',
- caretColor: 'rgba(0,0,0,0.72)',
- fontSize: LABEL_FONT_SIZE,
- lineHeight: '14px',
- fontVariantLigatures: 'none',
- }}
- aria-label="Follow-up"
- />
- </div>
- </div>
- ) : (
- <button
- type="button"
- className="block w-full border-0 bg-transparent text-left text-white"
- style={{
- padding: `${LABEL_VERTICAL_PADDING}px ${LABEL_HORIZONTAL_PADDING}px`,
- fontSize: LABEL_FONT_SIZE,
- fontWeight: 500,
- lineHeight: `${LABEL_LINE_HEIGHT}px`,
- }}
- onClick={onBeginEditing}
- onPointerDown={() => {
- setDraftText('');
- setDraftTextHeight(INLINE_EDITOR_MIN_TEXT_HEIGHT);
- }}
- >
- <span
- className="block overflow-hidden"
- style={{
- maxWidth: labelIsExpanded ? EXPANDED_LABEL_CONTENT_WIDTH : COLLAPSED_LABEL_CONTENT_WIDTH,
- display: labelIsExpanded ? 'block' : '-webkit-box',
- WebkitLineClamp: labelIsExpanded ? 'unset' : 2,
- WebkitBoxOrient: 'vertical',
- whiteSpace: 'pre-wrap',
- textOverflow: 'ellipsis',
- }}
- >
- {visibleLabel}
- </span>
- </button>
- )}
- </div>
- </div>
- )}
- </>
- );
-}
diff --git a/site/src/app/prototype/_components/tasks.ts b/site/src/app/prototype/_components/tasks.ts
index 400a01e2..8c1b6e8d 100644
--- a/site/src/app/prototype/_components/tasks.ts
+++ b/site/src/app/prototype/_components/tasks.ts
@@ -1,4 +1,4 @@
-import type { TaskId, TaskSample } from '@/app/prototype/_components/types';
+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' },
@@ -11,3 +11,49 @@ export const TASKS: Record<TaskId, TaskSample> = {
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;
+
+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' },
+ { 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
index 4ceea587..ae976392 100644
--- a/site/src/app/prototype/_components/types.ts
+++ b/site/src/app/prototype/_components/types.ts
@@ -1,5 +1,3 @@
-import type { Dispatch, RefObject, SetStateAction } from 'react';
-
export type TaskId = 'compare' | 'research' | 'reply' | 'schedule' | 'update';
export type NotchState =
@@ -10,6 +8,10 @@ export type NotchState =
| '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;
@@ -17,29 +19,21 @@ export type TaskSample = {
detail: string;
};
-export type Point = {
- x: number;
- y: number;
-};
+// 'running' ticks; 'stopped' is paused (resume or close); 'done' is finished (close only).
+export type LiveTaskStatus = 'running' | 'stopped' | 'done';
-export type DesktopSize = {
- w: number;
- h: number;
+// The streaming update currently surfaced in the collapsed notch chin (with its task's color).
+export type NotchUpdate = {
+ color: string;
+ message: string;
};
-export type SpawnPhase = 'notch-cue' | 'traveling' | 'holding' | 'fading';
-
-export type Spawn = {
+// A task shown in the expanded notch list.
+export type LiveTask = {
id: string;
- taskId: string;
+ title: string;
+ detail: string;
color: string;
- label: string;
- target: Point;
- phase: SpawnPhase;
- notchCueAngleDegrees: number;
- startedAt: number;
+ seconds: number;
+ status: LiveTaskStatus;
};
-
-export type SetHovering = Dispatch<SetStateAction<boolean>>;
-
-export type DesktopRef = RefObject<HTMLDivElement | null>;