Skip to content

Open source CapCut alternative.

TypeScript

feat(site): surface completed tasks as a notch pointer cluster, drop the "Done" gutter

David Led6351daf8db9
diff --git a/site/src/app/prototype/_components/App.tsx b/site/src/app/prototype/_components/App.tsx
index 60176b00..56695756 100644
--- a/site/src/app/prototype/_components/App.tsx
+++ b/site/src/app/prototype/_components/App.tsx
@@ -31,6 +31,10 @@ export default function App() {
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);
+ // Completed tasks keep surfacing in the collapsed notch until the user expands; expanding marks
+ // them acknowledged so they stop surfacing as floating pointers (they stay in the expanded list).
+ const [acknowledgedDoneIds, setAcknowledgedDoneIds] = useState<Set<string>>(() => new Set());
+ const acknowledgedDoneRef = useRef(acknowledgedDoneIds);
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.
@@ -114,18 +118,26 @@ export default function App() {
liveTasksRef.current = liveTasks;
}, [liveTasks]);
- // Rotate the collapsed chin through running tasks' streaming updates, one at a time.
+ // Keep a ref of the acknowledged set so the rotation timer can read it without re-subscribing.
+ useEffect(() => {
+ acknowledgedDoneRef.current = acknowledgedDoneIds;
+ }, [acknowledgedDoneIds]);
+
+ // Rotate the collapsed chin through running tasks' streaming updates, one at a time. When nothing
+ // is running, keep surfacing the most recent completed task's result until the user dismisses it.
useEffect(() => {
const interval = window.setInterval(() => {
- const running = liveTasksRef.current.filter((task) => task.status === 'running');
- if (running.length === 0) {
- setChinUpdate(null);
+ const tasks = liveTasksRef.current;
+ 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;
}
- updateCounterRef.current += 1;
- const task = running[updateCounterRef.current % running.length];
- const message = UPDATE_MESSAGES[updateCounterRef.current % UPDATE_MESSAGES.length];
- setChinUpdate({ color: task.color, message });
+ const done = tasks.find((task) => task.status === 'done' && !acknowledgedDoneRef.current.has(task.id));
+ setChinUpdate(done ? { color: done.color, message: done.detail } : null);
}, 2600);
return () => window.clearInterval(interval);
@@ -168,6 +180,29 @@ export default function App() {
const isNotchExpanded = notchExpanded || state === 'expanded-pinned';
+ // Expanding the notch dismisses the surfaced completions: the running tasks keep streaming, but the
+ // completed pointers that piled up in the collapsed notch are acknowledged and stop floating there.
+ useEffect(() => {
+ if (!isNotchExpanded) return;
+
+ setAcknowledgedDoneIds((prev) => {
+ let changed = false;
+ const next = new Set(prev);
+ for (const task of liveTasksRef.current) {
+ if (task.status === 'done' && !next.has(task.id)) {
+ next.add(task.id);
+ changed = true;
+ }
+ }
+ return changed ? next : prev;
+ });
+ }, [isNotchExpanded]);
+
+ // The collapsed notch surfaces running tasks and completed-but-undismissed tasks as a pointer cluster.
+ const surfacedTasks = liveTasks.filter(
+ (task) => task.status === 'running' || (task.status === 'done' && !acknowledgedDoneIds.has(task.id)),
+ );
+
return (
<div className="relative min-h-screen">
<MacDesktop
@@ -186,6 +221,7 @@ export default function App() {
promptTextHeight={promptTextHeight}
onPromptSubmit={handleSubmit}
liveTasks={liveTasks}
+ surfacedTasks={surfacedTasks}
chinUpdate={chinUpdate}
onAddTask={addLiveTask}
onStopTask={stopLiveTask}
diff --git a/site/src/app/prototype/_components/MacDesktop.tsx b/site/src/app/prototype/_components/MacDesktop.tsx
index 001f2c49..a30db53f 100644
--- a/site/src/app/prototype/_components/MacDesktop.tsx
+++ b/site/src/app/prototype/_components/MacDesktop.tsx
@@ -20,6 +20,7 @@ type Props = {
promptTextHeight: number;
onPromptSubmit: (event: FormEvent<HTMLFormElement>) => void;
liveTasks: LiveTask[];
+ surfacedTasks: LiveTask[];
chinUpdate: NotchUpdate | null;
onAddTask: (title: string) => void;
onStopTask: (id: string) => void;
@@ -56,6 +57,7 @@ export function MacDesktop({
promptTextHeight,
onPromptSubmit,
liveTasks,
+ surfacedTasks,
chinUpdate,
onAddTask,
onStopTask,
@@ -110,6 +112,7 @@ export function MacDesktop({
expanded={notchExpanded}
setExpanded={setNotchExpanded}
liveTasks={liveTasks}
+ surfacedTasks={surfacedTasks}
chinUpdate={chinUpdate}
onAddTask={onAddTask}
onStopTask={onStopTask}
diff --git a/site/src/app/prototype/_components/Notch.tsx b/site/src/app/prototype/_components/Notch.tsx
index edcada13..dea6c3b1 100644
--- a/site/src/app/prototype/_components/Notch.tsx
+++ b/site/src/app/prototype/_components/Notch.tsx
@@ -15,6 +15,7 @@ type Props = {
expanded: boolean;
setExpanded: (expanded: boolean) => void;
liveTasks: LiveTask[];
+ surfacedTasks: LiveTask[];
chinUpdate: NotchUpdate | null;
onAddTask: (title: string) => void;
onStopTask: (id: string) => void;
@@ -29,6 +30,11 @@ const METRICS = {
contentAreaWidth: 34,
// Chin hangs below the real notch: single streaming line, 9px font, no top padding.
chinHeight: 20,
+ // 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,
@@ -85,6 +91,7 @@ export function Notch({
expanded,
setExpanded,
liveTasks,
+ surfacedTasks,
chinUpdate,
onAddTask,
onStopTask,
@@ -93,12 +100,19 @@ export function Notch({
}: 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)';
+ // 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.
+ 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);
@@ -115,8 +129,9 @@ export function Notch({
return () => window.clearInterval(interval);
}, [isRunning]);
- // The chin (real) / inline (simulated) shows the current streaming update; hidden when expanded.
- const message = !expanded && chinUpdate ? chinUpdate.message : '';
+ // 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 collapsedTime = formatCompactTime(runningSeconds);
// App-level notices share a single slot; permissions outranks update since it blocks functionality.
@@ -219,14 +234,43 @@ export function Notch({
pointerEvents: 'none',
}}
>
- {/* Left content area — arrow silhouette when not active; colored, pulsing while running. */}
+ {/* 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 grid place-items-center"
+ className="absolute left-0 top-0"
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>
+ {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. */}
@@ -238,14 +282,6 @@ export function Notch({
>
<MessageCircleWarning size={15} strokeWidth={1.9} />
</div>
- ) : isComplete ? (
- // A finished task shows a status, not a clock — the elapsed total lives in the expanded row.
- <div
- className="absolute right-0 top-0 grid place-items-center whitespace-nowrap text-[11px] leading-none text-white/[0.92]"
- style={{ width: METRICS.contentAreaWidth, height: contentRowHeight }}
- >
- Done
- </div>
) : isRunning && streaming ? (
// Live run time only rides alongside the chin narration; without a chin the gutter stays empty.
<div