Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

[codex] make Live Views canvas-only (#5757)

Louis Beaumontd1a2610e714e
diff --git a/apps/screenpipe-app-tauri/components/settings/__tests__/brain-overview.test.tsx b/apps/screenpipe-app-tauri/components/settings/__tests__/brain-overview.test.tsx
index ed9005535..691d9e65b 100644
--- a/apps/screenpipe-app-tauri/components/settings/__tests__/brain-overview.test.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/__tests__/brain-overview.test.tsx
@@ -415,7 +415,7 @@ describe("BrainOverview", () => {
await screen.findByTestId("onboarding-live-view-cold-start"),
).toHaveTextContent("starts with your real work");
expect(screen.getByText(/10–15 minutes/)).toBeTruthy();
- expect(screen.queryByTestId("brain-overview-grid")).toBeNull();
+ expect(screen.queryByTestId("live-view-canvas")).toBeNull();
expect(
screen.queryByText("waiting for daily-summary to publish data"),
).toBeNull();
@@ -510,7 +510,9 @@ describe("BrainOverview", () => {
expect(
await screen.findByTestId("onboarding-live-view-first-result"),
).toHaveTextContent("your first real result is ready");
- expect(screen.getByTestId("brain-overview-grid")).toBeTruthy();
+ expect(
+ await screen.findByTestId("live-view-canvas", {}, { timeout: 10_000 }),
+ ).toBeTruthy();
fireEvent.click(screen.getByTestId("onboarding-live-view-reviewed"));
await waitFor(() =>
@@ -665,7 +667,9 @@ describe("BrainOverview", () => {
fireEvent.change(selector, { target: { value: "weekly-review" } });
expect(selector.value).toBe("weekly-review");
- expect(await screen.findByText("Weekly total")).toBeTruthy();
+ expect(
+ await screen.findByTestId("canvas-block-weekly-total"),
+ ).toHaveTextContent("Weekly total");
expect(screen.queryByText("Focus time")).toBeNull();
expect(mocks.saveBrainView).not.toHaveBeenCalled();
});
@@ -860,9 +864,7 @@ describe("BrainOverview", () => {
const controls = await screen.findByTestId("overview-header-controls");
expect(controls.className).toContain("flex-wrap");
- expect(controls.parentElement?.className).toContain(
- "xl:grid-cols-[minmax(0,1fr)_auto]",
- );
+ expect(controls.parentElement?.className).toContain("lg:flex-row");
expect(screen.getByTestId("overview-time-range").className).toContain(
"h-9",
);
@@ -871,6 +873,15 @@ describe("BrainOverview", () => {
);
expect(screen.getByTestId("overview-refresh-data").textContent).toBe("");
expect(screen.queryByTestId("overview-edit")).toBeNull();
+ const overviewShell = screen.getByTestId("brain-overview-scroll");
+ expect(overviewShell.className).toContain("overflow-hidden");
+ expect(overviewShell.className).not.toContain("overflow-y-auto");
+ expect(screen.getByTestId("live-view-canvas").className).toContain(
+ "flex-1",
+ );
+ expect(
+ screen.getByTestId("overview-floating-composer").className,
+ ).toContain("absolute");
const prompt = screen.getByTestId(
"live-view-ai-prompt",
) as HTMLTextAreaElement;
@@ -2292,21 +2303,42 @@ describe("BrainOverview", () => {
);
});
- it("switches to a source-backed Canvas and persists the layout mode", async () => {
+ it("opens Canvas by default and migrates the removed dashboard mode", async () => {
mocks.listBrainViews.mockResolvedValue({
status: "ok",
data: [populatedView],
});
+ mocks.loadBrainViewCanvas.mockResolvedValue({
+ status: "ok",
+ data: {
+ schema: "live-view-canvas.v1",
+ viewId: populatedView.id,
+ revision: 4,
+ mode: "dashboard",
+ viewport: { x: 24, y: 24, zoom: 1 },
+ blocks: [
+ {
+ slotId: "focus-time",
+ x: 64,
+ y: 64,
+ width: 440,
+ height: 280,
+ },
+ ],
+ notes: [],
+ arrows: [],
+ strokes: [],
+ updatedAt: "2026-07-27T17:00:00Z",
+ },
+ });
render(<BrainOverview />);
- const canvasMode = await screen.findByTestId("overview-mode-canvas");
- await waitFor(() => expect(canvasMode).not.toBeDisabled());
- fireEvent.click(canvasMode);
-
expect(
await screen.findByTestId("live-view-canvas", {}, { timeout: 10_000 }),
).toBeTruthy();
- expect(screen.queryByTestId("brain-overview-grid")).toBeNull();
+ expect(screen.queryByTestId("overview-display-mode")).toBeNull();
+ expect(screen.queryByTestId("overview-mode-dashboard")).toBeNull();
+ expect(screen.queryByTestId("overview-mode-canvas")).toBeNull();
expect(screen.getByTestId("canvas-block-focus-time")).toBeTruthy();
expect(screen.getByText("Pipe: daily-summary")).toBeTruthy();
expect(screen.getByText("artifact #88 · v2")).toBeTruthy();
@@ -2314,7 +2346,7 @@ describe("BrainOverview", () => {
expect(mocks.saveBrainViewCanvas).toHaveBeenCalledWith(
expect.objectContaining({
viewId: "my-overview",
- expectedRevision: null,
+ expectedRevision: 4,
mode: "canvas",
blocks: [
expect.objectContaining({
@@ -2326,20 +2358,10 @@ describe("BrainOverview", () => {
}),
),
);
- expect(mocks.capture).toHaveBeenCalledWith(
+ expect(mocks.capture).not.toHaveBeenCalledWith(
"live_view_layout_mode_changed",
- expect.objectContaining({
- analytics_schema_version: 2,
- mode: "canvas",
- block_count: 1,
- has_result: true,
- }),
+ expect.anything(),
);
- const properties = mocks.capture.mock.calls.find(
- ([event]) => event === "live_view_layout_mode_changed",
- )?.[1];
- expect(JSON.stringify(properties)).not.toContain("my-overview");
- expect(JSON.stringify(properties)).not.toContain("daily-summary");
}, 15_000);
it("restores saved Canvas positions and annotations", async () => {
diff --git a/apps/screenpipe-app-tauri/components/settings/brain-overview.tsx b/apps/screenpipe-app-tauri/components/settings/brain-overview.tsx
index 4a5eecd02..afc04a1c9 100644
--- a/apps/screenpipe-app-tauri/components/settings/brain-overview.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/brain-overview.tsx
@@ -17,9 +17,7 @@ import { onboardingFunnel } from "@/lib/analytics/onboarding-funnel";
import {
AlertCircle,
CheckCircle2,
- LayoutDashboard,
Loader2,
- Network,
RefreshCw,
Undo2,
X,
@@ -77,7 +75,6 @@ import {
} from "@/lib/active-ai-preset";
import { Input } from "@/components/ui/input";
import {
- createCanvasDocument,
reconcileCanvasDocument,
toSaveCanvasRequest,
} from "@/lib/live-views/canvas-layout";
@@ -101,7 +98,6 @@ import {
type BrainViewCanvasDocument,
type BrainViewComponent,
type BrainViewDefinition,
- type BrainViewDisplayMode,
type BrainViewSlot,
type BrainViewSlotInput,
type BrainViewTemplateKit,
@@ -641,23 +637,6 @@ export function BrainOverview({
});
}, [canvasDocument, canvasSlotSignature, changeCanvasDocument, view]);
- const changeDisplayMode = (mode: BrainViewDisplayMode) => {
- if (!view || canvasLoading || canvasError) return;
- const current = reconcileCanvasDocument(
- view,
- canvasLatestRef.current ?? createCanvasDocument(view),
- );
- if (current.mode === mode) return;
- const next = { ...current, mode };
- changeCanvasDocument(next, { persist: true });
- posthog.capture("live_view_layout_mode_changed", {
- analytics_schema_version: LIVE_VIEW_ANALYTICS_SCHEMA_VERSION,
- mode,
- block_count: view.slots.length,
- has_result: view.slots.some((slot) => slot.value !== null),
- });
- };
-
const load = useCallback(
async (silent = false, preferredDashboardId?: string | null) => {
if (!silent) setLoading(true);
@@ -2581,7 +2560,6 @@ export function BrainOverview({
dataRefresh?.viewId === view.id &&
(dataRefresh.status === "starting" || dataRefresh.status === "running");
const dashboardBusy = saving || refreshIsActive || generating;
- const displayMode = canvasDocument?.mode ?? "dashboard";
const canvasReady =
!canvasLoading && canvasDocument?.viewId === view.id && !canvasError;
const refreshingSlotIds = new Set(
@@ -2593,12 +2571,16 @@ export function BrainOverview({
);
const onboardingColdStart = showOnboardingActivation && !onboardingHasResult;
return (
- <div className="min-h-0 flex-1 overflow-y-auto pb-8 pr-4 [scrollbar-gutter:stable]">
+ <div className="relative flex min-h-0 flex-1 overflow-hidden">
<div
- data-onboarding-guide-target="dashboard"
- className="mb-5 grid gap-4 border-b border-border pb-4 xl:grid-cols-[minmax(0,1fr)_auto] xl:items-end"
+ data-testid="brain-overview-scroll"
+ className="flex h-full min-h-0 w-full flex-col overflow-hidden pr-2"
>
- <div className="min-w-0">
+ <div
+ data-onboarding-guide-target="dashboard"
+ className="mb-3 flex shrink-0 flex-col gap-2 border-b border-border pb-2 lg:flex-row lg:items-center lg:justify-between"
+ >
+ <div className="flex min-w-0 flex-1 flex-col gap-1 sm:flex-row sm:items-center sm:gap-3">
<LiveViewDashboardSwitcher
views={views}
current={view}
@@ -2629,7 +2611,7 @@ export function BrainOverview({
/>
<p
data-testid="overview-data-status"
- className="mt-2 text-xs text-muted-foreground"
+ className="shrink-0 font-mono text-[9px] text-muted-foreground"
>
{onboardingColdStart
? "This view will appear when Screenpipe has enough real activity for your outcome."
@@ -2637,60 +2619,11 @@ export function BrainOverview({
? `Updated ${new Date(latestDataTimestamp).toLocaleString()}`
: "No data yet"}
</p>
- </div>
- <div
- data-testid="overview-header-controls"
- className="flex w-full flex-wrap items-center gap-2 xl:w-auto xl:justify-end"
- >
- {!onboardingColdStart && (
- <div
- data-testid="overview-display-mode"
- className="inline-flex h-9 flex-1 border border-border sm:flex-none"
- aria-label="Live View layout"
- >
- <Button
- data-testid="overview-mode-dashboard"
- type="button"
- variant="ghost"
- size="sm"
- aria-pressed={displayMode === "dashboard"}
- disabled={
- dashboardBusy || canvasLoading || Boolean(canvasError)
- }
- className={`h-8 rounded-none border-r border-border px-2 text-xs ${
- displayMode === "dashboard"
- ? "bg-foreground text-background"
- : ""
- }`}
- onClick={() => changeDisplayMode("dashboard")}
- >
- <LayoutDashboard className="mr-1.5 h-3.5 w-3.5" /> dashboard
- </Button>
- <Button
- data-testid="overview-mode-canvas"
- type="button"
- variant="ghost"
- size="sm"
- aria-pressed={displayMode === "canvas"}
- disabled={
- dashboardBusy || canvasLoading || Boolean(canvasError)
- }
- className={`h-8 rounded-none px-2 text-xs ${
- displayMode === "canvas"
- ? "bg-foreground text-background"
- : ""
- }`}
- onClick={() => changeDisplayMode("canvas")}
- >
- {canvasLoading ? (
- <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" />
- ) : (
- <Network className="mr-1.5 h-3.5 w-3.5" />
- )}
- canvas
- </Button>
- </div>
- )}
+ </div>
+ <div
+ data-testid="overview-header-controls"
+ className="flex w-full flex-wrap items-center gap-2 lg:w-auto lg:justify-end"
+ >
{view.periodPolicy.type !== "fixed.v1" && (
<Select
value={view.timeRange}
@@ -2733,8 +2666,8 @@ export function BrainOverview({
/>
</Button>
)}
+ </div>
</div>
- </div>
{canvasError && (
<div
data-testid="live-view-canvas-error"
@@ -2742,17 +2675,17 @@ export function BrainOverview({
>
<AlertCircle className="h-3.5 w-3.5 shrink-0" />
<span>
- Canvas could not be loaded. Dashboard mode is still available.
+ Canvas could not be loaded. Reopen Live Views to try again.
</span>
</div>
)}
- {canvasSaving && displayMode === "canvas" && (
+ {canvasSaving && (
<p className="sr-only" role="status">
saving canvas
</p>
)}
{templateGalleryOpen && !onboardingColdStart && (
- <div className="relative mb-5 border border-border p-4 pr-12">
+ <div className="relative mb-5 max-h-[min(50vh,32rem)] shrink-0 overflow-y-auto border border-border p-4 pr-12">
<Button
aria-label="close templates"
variant="ghost"
@@ -2769,18 +2702,6 @@ export function BrainOverview({
/>
</div>
)}
- {!onboardingColdStart && (
- <div className="mb-5">
- <LiveViewAiComposer
- busy={generating}
- compact
- currentViewTitle={view.title}
- selectedPresetId={selectedAiPreset?.id ?? null}
- onSelectedPresetIdChange={selectAiPreset}
- onGenerate={generateFromComposer}
- />
- </div>
- )}
{undoView && (
<div
data-testid="overview-undo-banner"
@@ -2845,12 +2766,12 @@ export function BrainOverview({
!onboardingHasResult ? null : slots.length === 0 ? (
<button
type="button"
- className="flex min-h-48 w-full items-center justify-center border border-dashed border-border text-xs text-muted-foreground hover:text-foreground"
+ className="flex min-h-0 w-full flex-1 items-center justify-center border border-dashed border-border text-xs text-muted-foreground hover:text-foreground"
onClick={beginEdit}
>
add your first Block
</button>
- ) : displayMode === "canvas" && canvasReady && canvasDocument ? (
+ ) : canvasReady && canvasDocument ? (
<LiveViewCanvas
document={canvasDocument}
slots={slots}
@@ -2866,31 +2787,30 @@ export function BrainOverview({
onItemAction={recordItemAction}
onItemHandoff={handoffItem}
/>
- ) : (
+ ) : canvasLoading ? (
<div
- data-testid="brain-overview-grid"
- className="grid grid-cols-12 gap-4"
+ data-testid="live-view-canvas-loading"
+ className="flex min-h-0 flex-1 items-center justify-center border border-border font-mono text-[10px] uppercase tracking-wide text-muted-foreground"
>
- {slots.map((slot) => (
- <OverviewCard
- key={slot.id}
- slot={slot}
- timeRange={view.timeRange}
- refreshing={refreshingSlotIds.has(slot.id)}
- feedback={slot.feedback?.current?.rating ?? null}
- feedbackCorrection={slot.feedback?.current?.correction ?? null}
- aiEditing={aiEditingSlotId === slot.id}
- onFeedback={(rating, correction) =>
- recordCardFeedback(slot, rating, correction)
- }
- onRegenerate={() =>
- void refreshConnectedPipes(view, [slot], "card_regenerated")
- }
- onAiEdit={(prompt) => editSlotWithAi(slot, prompt)}
- onItemAction={(request) => recordItemAction(slot, request)}
- onItemHandoff={(item) => void handoffItem(slot, item)}
+ loading process map
+ </div>
+ ) : null}
+ </div>
+ {!onboardingColdStart && (
+ <div
+ data-testid="overview-floating-composer"
+ className="pointer-events-none absolute inset-x-4 bottom-4 z-40 flex justify-center"
+ >
+ <div className="pointer-events-auto w-full max-w-2xl shadow-lg shadow-black/5">
+ <LiveViewAiComposer
+ busy={generating}
+ compact
+ currentViewTitle={view.title}
+ selectedPresetId={selectedAiPreset?.id ?? null}
+ onSelectedPresetIdChange={selectAiPreset}
+ onGenerate={generateFromComposer}
/>
- ))}
+ </div>
</div>
)}
</div>
diff --git a/apps/screenpipe-app-tauri/components/settings/brain-section.tsx b/apps/screenpipe-app-tauri/components/settings/brain-section.tsx
index 04fe5304e..33792c79e 100644
--- a/apps/screenpipe-app-tauri/components/settings/brain-section.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/brain-section.tsx
@@ -43,6 +43,7 @@ import {
AlertCircle,
FolderOpen,
Eye,
+ LayoutDashboard,
MessageSquare,
MoreVertical,
} from "lucide-react";
@@ -1408,11 +1409,18 @@ export function BrainSection() {
<div data-testid="section-brain" className="h-full overflow-hidden">
<div
data-testid="brain-content"
- className="max-w-6xl mx-auto px-3 pb-6 pt-10 sm:px-6 space-y-4 h-full flex flex-col"
+ className={`mx-auto flex h-full flex-col px-3 pb-6 sm:px-6 ${
+ typeFilter === "overview"
+ ? "max-w-none space-y-2 pt-8"
+ : "max-w-6xl space-y-4 pt-10"
+ }`}
>
- <p className="text-muted-foreground text-sm mb-4">
- what the AI has learned from your activity and what it has generated for you
- </p>
+ {typeFilter !== "overview" && (
+ <p className="mb-4 text-sm text-muted-foreground">
+ what the AI has learned from your activity and what it has generated
+ for you
+ </p>
+ )}
{/* stale memories warning */}
{typeFilter === "memories" && isStale && (
@@ -1434,33 +1442,93 @@ export function BrainSection() {
)}
<div className="flex items-center justify-between gap-3">
- <div className="inline-flex items-center gap-1 border-b border-border">
- {(
- [
- { value: "overview", label: "Live Views", count: liveViewsTabCount ?? undefined },
- { value: "memories", label: "Memories", count: memoriesTabCount ?? undefined },
- { value: "artifacts", label: "Artifacts", count: artifactsTabCount ?? undefined },
- ] as { value: TypeFilter; label: string; count?: number }[]
- ).map(({ value, label, count }) => (
- <button
- key={value}
- data-testid={`brain-filter-${value}`}
- onClick={() => switchTypeFilter(value)}
- className={`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${
- typeFilter === value
- ? "border-foreground text-foreground"
- : "border-transparent text-muted-foreground hover:text-foreground"
- }`}
- >
- {label}
- {count !== undefined && (
- <span className="ml-2 text-xs text-muted-foreground">
- {count.toLocaleString()}
- </span>
- )}
- </button>
- ))}
- </div>
+ {typeFilter === "overview" ? (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <button
+ type="button"
+ data-testid="brain-filter-overview"
+ className="inline-flex h-8 items-center gap-2 border border-border bg-background px-2.5 text-xs font-medium transition-colors hover:bg-foreground hover:text-background"
+ aria-label="switch Brain view"
+ >
+ <LayoutDashboard className="h-3.5 w-3.5" />
+ <span>Live Views</span>
+ {liveViewsTabCount !== null && (
+ <span className="font-mono text-[10px] tabular-nums text-muted-foreground">
+ {liveViewsTabCount.toLocaleString()}
+ </span>
+ )}
+ <ChevronDown className="h-3 w-3" />
+ </button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="start" className="w-56 rounded-none">
+ <DropdownMenuItem
+ className="bg-muted/50"
+ onSelect={() => switchTypeFilter("overview")}
+ >
+ <LayoutDashboard className="mr-2 h-3.5 w-3.5" />
+ <span className="flex-1">Live Views</span>
+ {liveViewsTabCount !== null && (
+ <span className="font-mono text-[10px] tabular-nums text-muted-foreground">
+ {liveViewsTabCount.toLocaleString()}
+ </span>
+ )}
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ data-testid="brain-filter-memories"
+ onSelect={() => switchTypeFilter("memories")}
+ >
+ <Eye className="mr-2 h-3.5 w-3.5" />
+ <span className="flex-1">Memories</span>
+ {memoriesTabCount !== null && (
+ <span className="font-mono text-[10px] tabular-nums text-muted-foreground">
+ {memoriesTabCount.toLocaleString()}
+ </span>
+ )}
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ data-testid="brain-filter-artifacts"
+ onSelect={() => switchTypeFilter("artifacts")}
+ >
+ <FolderOpen className="mr-2 h-3.5 w-3.5" />
+ <span className="flex-1">Artifacts</span>
+ {artifactsTabCount !== null && (
+ <span className="font-mono text-[10px] tabular-nums text-muted-foreground">
+ {artifactsTabCount.toLocaleString()}
+ </span>
+ )}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ ) : (
+ <div className="inline-flex items-center gap-1 border-b border-border">
+ {(
+ [
+ { value: "overview", label: "Live Views", count: liveViewsTabCount ?? undefined },
+ { value: "memories", label: "Memories", count: memoriesTabCount ?? undefined },
+ { value: "artifacts", label: "Artifacts", count: artifactsTabCount ?? undefined },
+ ] as { value: TypeFilter; label: string; count?: number }[]
+ ).map(({ value, label, count }) => (
+ <button
+ key={value}
+ data-testid={`brain-filter-${value}`}
+ onClick={() => switchTypeFilter(value)}
+ className={`border-b-2 px-3 py-2 text-sm font-medium transition-colors ${
+ typeFilter === value
+ ? "border-foreground text-foreground"
+ : "border-transparent text-muted-foreground hover:text-foreground"
+ }`}
+ >
+ {label}
+ {count !== undefined && (
+ <span className="ml-2 text-xs text-muted-foreground">
+ {count.toLocaleString()}
+ </span>
+ )}
+ </button>
+ ))}
+ </div>
+ )}
{showFilterButton && (
<Popover
open={filterOpen}
diff --git a/apps/screenpipe-app-tauri/components/settings/live-view-canvas.tsx b/apps/screenpipe-app-tauri/components/settings/live-view-canvas.tsx
index f5c1504dd..11c1bbe7d 100644
--- a/apps/screenpipe-app-tauri/components/settings/live-view-canvas.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/live-view-canvas.tsx
@@ -32,6 +32,7 @@ import {
import {
ArrowRight,
Hand,
+ LayoutGrid,
Maximize2,
MousePointer2,
Move,
@@ -1094,7 +1095,7 @@ export function LiveViewCanvas({
return (
<section
data-testid="live-view-canvas"
- className="relative h-[min(70vh,720px)] min-h-[480px] w-full overflow-hidden border border-border bg-background"
+ className="relative min-h-0 w-full flex-1 overflow-hidden border border-border bg-background"
aria-label="Live View process canvas"
>
<div
@@ -1204,7 +1205,7 @@ export function LiveViewCanvas({
<div
data-canvas-toolbar
- className="absolute left-3 top-3 z-30 flex max-w-[calc(100%-1.5rem)] flex-wrap items-center border border-foreground bg-background shadow-lg shadow-black/5"
+ className="absolute left-3 top-1/2 z-30 flex -translate-y-1/2 flex-col items-center border border-foreground bg-background shadow-lg shadow-black/5"
>
{TOOL_OPTIONS.map((option) => {
const Icon = option.icon;
@@ -1214,10 +1215,11 @@ export function LiveViewCanvas({
type="button"
data-testid={`canvas-tool-${option.value}`}
variant="ghost"
- size="sm"
+ size="icon"
aria-label={option.label}
aria-pressed={tool === option.value}
- className={`h-8 rounded-none border-r border-border px-2 text-[10px] ${
+ title={option.label}
+ className={`h-9 w-9 rounded-none border-b border-border ${
tool === option.value ? "bg-foreground text-background" : ""
}`}
onClick={() => {
@@ -1225,17 +1227,49 @@ export function LiveViewCanvas({
setArrowSource(null);
}}
>
- <Icon className="mr-1 h-3 w-3" />
- <span className="hidden sm:inline">{option.label}</span>
+ <Icon className="h-3.5 w-3.5" />
+ <span className="sr-only">{option.label}</span>
</Button>
);
})}
+ <Button
+ type="button"
+ data-testid="canvas-arrange"
+ variant="ghost"
+ size="icon"
+ aria-label="arrange canvas"
+ title="arrange canvas"
+ className="h-9 w-9 rounded-none border-b border-border"
+ onClick={arrangeCanvas}
+ >
+ <LayoutGrid className="h-3.5 w-3.5" />
+ <span className="sr-only">arrange canvas</span>
+ </Button>
+ <Button
+ type="button"
+ data-testid="canvas-delete-selection"
+ variant="ghost"
+ size="icon"
+ aria-label="delete selected canvas item"
+ title="delete selected canvas item"
+ className="h-9 w-9 rounded-none"
+ disabled={!selectedCanDelete}
+ onClick={removeSelection}
+ >
+ <Trash2 className="h-3 w-3" />
+ </Button>
+ </div>
+
+ <div
+ data-canvas-toolbar
+ className="absolute bottom-3 left-3 z-30 flex items-center border border-foreground bg-background shadow-lg shadow-black/5"
+ >
<Button
type="button"
variant="ghost"
size="icon"
aria-label="zoom out"
- className="h-8 w-8 rounded-none"
+ className="h-8 w-8 rounded-none border-r border-border"
onClick={() => zoomCanvas(1 / 1.2)}
>
<ZoomOut className="h-3 w-3" />
@@ -1248,7 +1282,7 @@ export function LiveViewCanvas({
variant="ghost"
size="icon"
aria-label="zoom in"
- className="h-8 w-8 rounded-none"
+ className="h-8 w-8 rounded-none border-l border-border"
onClick={() => zoomCanvas(1.2)}
>
<ZoomIn className="h-3 w-3" />
@@ -1264,32 +1298,10 @@ export function LiveViewCanvas({
>
<Maximize2 className="h-3 w-3" />
</Button>
- <Button
- type="button"
- data-testid="canvas-arrange"
- variant="ghost"
- size="sm"
- className="h-8 rounded-none border-l border-border px-2 text-[10px]"
- onClick={arrangeCanvas}
- >
- arrange
- </Button>
- <Button
- type="button"
- data-testid="canvas-delete-selection"
- variant="ghost"
- size="icon"
- aria-label="delete selected canvas item"
- className="h-8 w-8 rounded-none border-l border-border"
- disabled={!selectedCanDelete}
- onClick={removeSelection}
- >
- <Trash2 className="h-3 w-3" />
- </Button>
</div>
{tool === "arrow" && arrowSource && (
- <div className="absolute bottom-3 left-3 z-30 border border-foreground bg-background px-3 py-2 text-xs">
+ <div className="absolute bottom-14 left-3 z-30 border border-foreground bg-background px-3 py-2 text-xs">
choose another Block or note to connect
</div>
)}
diff --git a/apps/screenpipe-app-tauri/components/settings/live-view-dashboard-switcher.tsx b/apps/screenpipe-app-tauri/components/settings/live-view-dashboard-switcher.tsx
index 27f0e21c8..f737c48f6 100644
--- a/apps/screenpipe-app-tauri/components/settings/live-view-dashboard-switcher.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/live-view-dashboard-switcher.tsx
@@ -84,16 +84,12 @@ export function LiveViewDashboardSwitcher({
return (
<>
- <div data-testid="live-view-dashboard-switcher" className="min-w-0">
- <div className="mb-1 flex items-center gap-2">
- <p className="text-[10px] uppercase tracking-wide text-muted-foreground">
- Dashboards
- </p>
- <span className="text-[10px] tabular-nums text-muted-foreground">
- {views.length}/{MAX_DASHBOARDS}
- </span>
- </div>
- <div className="flex min-w-0 items-center gap-2">
+ <div
+ data-testid="live-view-dashboard-switcher"
+ className="flex min-w-0 flex-1 items-center"
+ >
+ <p className="sr-only">Dashboards</p>
+ <div className="flex min-w-0 flex-1 items-center gap-2">
<select
data-testid="overview-dashboard-selector"
aria-label="Dashboard"
@@ -164,6 +160,9 @@ export function LiveViewDashboardSwitcher({
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
+ <span className="hidden shrink-0 font-mono text-[9px] tabular-nums text-muted-foreground 2xl:inline">
+ {views.length}/{MAX_DASHBOARDS}
+ </span>
</div>
</div>
diff --git a/apps/screenpipe-app-tauri/components/settings/live-view-onboarding-guide.tsx b/apps/screenpipe-app-tauri/components/settings/live-view-onboarding-guide.tsx
index 6ffeeb47c..456a57884 100644
--- a/apps/screenpipe-app-tauri/components/settings/live-view-onboarding-guide.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/live-view-onboarding-guide.tsx
@@ -135,7 +135,7 @@ export function LiveViewOnboardingGuide({
return (
<FocusedSpotlight
- targetSelector='[data-testid="brain-overview-grid"]'
+ targetSelector='[data-testid="live-view-canvas"]'
eyebrow="your first result"
step="3 of 3"
title="check it and help it improve"
diff --git a/apps/screenpipe-app-tauri/e2e/specs/brain-overview.spec.ts b/apps/screenpipe-app-tauri/e2e/specs/brain-overview.spec.ts
index c87ed1346..1019b6a7f 100644
--- a/apps/screenpipe-app-tauri/e2e/specs/brain-overview.spec.ts
+++ b/apps/screenpipe-app-tauri/e2e/specs/brain-overview.spec.ts
@@ -586,12 +586,12 @@ Refresh the assigned Live View output targets from source-backed activity.
})
.catch(() => {});
await waitForTestId("section-brain", 15_000);
- await waitForTestId("brain-overview-grid", 15_000);
const dashboardSelector = await waitForTestId(
"overview-dashboard-selector",
15_000,
);
await selectDashboard(SELECTABLE_VIEW_ID);
+ await waitForTestId("live-view-canvas", 15_000);
for (const size of SUPPORTED_WINDOW_SIZES) {
await setCssWindowSize(size.width, size.height);
await browser.pause(150);
@@ -602,8 +602,15 @@ Refresh the assigned Live View output targets from source-backed activity.
const content = document.querySelector<HTMLElement>(
"[data-testid='brain-content']",
);
- if (!section || !content) return null;
+ const overview = document.querySelector<HTMLElement>(
+ "[data-testid='brain-overview-scroll']",
+ );
+ const canvas = document.querySelector<HTMLElement>(
+ "[data-testid='live-view-canvas']",
+ );
+ if (!section || !content || !overview || !canvas) return null;
const sectionRect = section.getBoundingClientRect();
+ const canvasRect = canvas.getBoundingClientRect();
const firstContentTop =
content.firstElementChild?.getBoundingClientRect().top ?? 0;
const visibleControls = Array.from(
@@ -612,13 +619,26 @@ Refresh the assigned Live View output targets from source-backed activity.
),
).filter((element) => {
const rect = element.getBoundingClientRect();
- return rect.width > 0 && rect.height > 0;
+ // Canvas nodes live in a transformed, clipped world and may extend
+ // beyond the page viewport by design. Their own geometry is checked
+ // below; this scan covers page-level controls only.
+ return (
+ !element.closest("[data-testid='live-view-canvas']") &&
+ rect.width > 0 &&
+ rect.height > 0
+ );
});
return {
viewportWidth: document.documentElement.clientWidth,
documentWidth: document.documentElement.scrollWidth,
+ viewportHeight: document.documentElement.clientHeight,
+ documentHeight: document.documentElement.scrollHeight,
sectionLeft: sectionRect.left,
sectionRight: sectionRect.right,
+ sectionBottom: sectionRect.bottom,
+ canvasBottom: canvasRect.bottom,
+ canvasHeight: canvasRect.height,
+ overviewOverflowY: getComputedStyle(overview).overflowY,
firstContentTop,
clippedControls: visibleControls
.filter((element) => {
@@ -646,8 +666,14 @@ Refresh the assigned Live View output targets from source-backed activity.
})) as {
viewportWidth: number;
documentWidth: number;
+ viewportHeight: number;
+ documentHeight: number;
sectionLeft: number;
sectionRight: number;
+ sectionBottom: number;
+ canvasBottom: number;
+ canvasHeight: number;
+ overviewOverflowY: string;
firstContentTop: number;
clippedControls: Array<{
label: string;
@@ -666,6 +692,14 @@ Refresh the assigned Live View output targets from source-backed activity.
expect(layout!.documentWidth).toBeLessThanOrEqual(
layout!.viewportWidth + 1,
);
+ expect(layout!.documentHeight).toBeLessThanOrEqual(
+ layout!.viewportHeight + 1,
+ );
+ expect(layout!.overviewOverflowY).toBe("hidden");
+ expect(layout!.canvasBottom).toBeLessThanOrEqual(
+ layout!.sectionBottom + 1,
+ );
+ expect(layout!.canvasHeight).toBeGreaterThan(200);
expect(layout!.clippedControls).toEqual([]);
if (size.label === "minimum") {
await saveScreenshot("brain-overview-minimum-window");
@@ -688,7 +722,7 @@ Refresh the assigned Live View output targets from source-backed activity.
() => document.body?.innerText || "",
)) as string;
expect(renderedText).toContain("Live Views");
- expect(renderedText).toContain("DASHBOARDS");
+ expect(renderedText.toLowerCase()).toContain("dashboards");
expect(renderedText.toLowerCase()).toContain("customize");
expect(renderedText).toContain("Automation opportunities");
expect(await dashboardSelector.getValue()).toBe(SELECTABLE_VIEW_ID);
@@ -757,9 +791,10 @@ Refresh the assigned Live View output targets from source-backed activity.
await cancelFixedEditor.click();
await selectDashboard(SELECTABLE_VIEW_ID);
- const canvasMode = await $("[data-testid='overview-mode-canvas']");
- await canvasMode.click();
const canvas = await waitForTestId("live-view-canvas", 10_000);
+ expect(
+ await $("[data-testid='overview-display-mode']").isExisting(),
+ ).toBe(false);
await waitForTestId("canvas-block-focus-time", 10_000);
expect(await canvas.getText()).toContain("4.5");
expect(await canvas.getText()).toContain("Automation opportunities");
@@ -897,7 +932,6 @@ Refresh the assigned Live View output targets from source-backed activity.
for (const size of [SUPPORTED_WINDOW_SIZES[0], SUPPORTED_WINDOW_SIZES[5]]) {
await setCssWindowSize(size.width, size.height);
- await canvas.scrollIntoView();
await browser.pause(150);
const canvasLayout = (await browser.execute(() => {
const canvasElement = document.querySelector<HTMLElement>(
@@ -981,11 +1015,6 @@ Refresh the assigned Live View output targets from source-backed activity.
expect(await $("[data-testid^='canvas-arrow-']").isExisting()).toBe(true);
await setCssWindowSize(1440, 900);
- const dashboardMode = await $("[data-testid='overview-mode-dashboard']");
- await dashboardMode.waitForEnabled({ timeout: t(15_000) });
- await dashboardMode.click();
- await waitForTestId("brain-overview-grid", 10_000);
-
await openDashboardMenu();
await waitForTestId("overview-edit", 10_000).then((element) =>
element.click(),
diff --git a/apps/screenpipe-app-tauri/e2e/specs/live-view-item-actions.spec.ts b/apps/screenpipe-app-tauri/e2e/specs/live-view-item-actions.spec.ts
index 0577ad944..927f49623 100644
--- a/apps/screenpipe-app-tauri/e2e/specs/live-view-item-actions.spec.ts
+++ b/apps/screenpipe-app-tauri/e2e/specs/live-view-item-actions.spec.ts
@@ -236,7 +236,7 @@ async function selectDashboard(viewId: string) {
})) as string) === viewId,
{ timeout: t(10_000) },
);
- await waitForTestId("brain-overview-grid", 10_000);
+ await waitForTestId("live-view-canvas", 10_000);
}
async function waitForItemState(itemId: string, expected: string) {
diff --git a/apps/screenpipe-app-tauri/lib/live-views/__tests__/canvas-layout-evals.test.ts b/apps/screenpipe-app-tauri/lib/live-views/__tests__/canvas-layout-evals.test.ts
index c8d4cb256..3c3bfce50 100644
--- a/apps/screenpipe-app-tauri/lib/live-views/__tests__/canvas-layout-evals.test.ts
+++ b/apps/screenpipe-app-tauri/lib/live-views/__tests__/canvas-layout-evals.test.ts
@@ -208,10 +208,24 @@ describe("Live View Canvas layout evals", () => {
const reconciled = reconcileCanvasDocument(target, foreign);
expect(reconciled.viewId).toBe(target.id);
- expect(reconciled.mode).toBe("dashboard");
+ expect(reconciled.mode).toBe("canvas");
expect(reconciled.revision).toBe(0);
});
+ it("migrates the removed dashboard mode to Canvas", () => {
+ const target = view([slot(0)]);
+ const dashboardDocument: BrainViewCanvasDocument = {
+ ...createCanvasDocument(target),
+ revision: 4,
+ mode: "dashboard",
+ };
+
+ const reconciled = reconcileCanvasDocument(target, dashboardDocument);
+
+ expect(reconciled.mode).toBe("canvas");
+ expect(reconciled.revision).toBe(4);
+ });
+
it("anchors a horizontal arrow to the facing edges of its nodes", () => {
const document = createCanvasDocument(view([slot(0), slot(1)]));
document.blocks = [
diff --git a/apps/screenpipe-app-tauri/lib/live-views/canvas-layout.ts b/apps/screenpipe-app-tauri/lib/live-views/canvas-layout.ts
index 32a8564e9..2275152a2 100644
--- a/apps/screenpipe-app-tauri/lib/live-views/canvas-layout.ts
+++ b/apps/screenpipe-app-tauri/lib/live-views/canvas-layout.ts
@@ -103,7 +103,7 @@ export function createCanvasDocument(
schema: "live-view-canvas.v1",
viewId: view.id,
revision: 0,
- mode: "dashboard",
+ mode: "canvas",
viewport: { ...DEFAULT_CANVAS_VIEWPORT },
blocks: createCanvasBlockLayout(view.slots),
notes: [],
@@ -138,13 +138,14 @@ export function reconcileCanvasDocument(
validNodes.has(arrow.toId),
);
if (
+ document.mode === "canvas" &&
blocks.length === document.blocks.length &&
blocks.every((block, index) => block === document.blocks[index]) &&
arrows.length === document.arrows.length
) {
return document;
}
- return { ...document, blocks, arrows };
+ return { ...document, mode: "canvas", blocks, arrows };
}
export function toSaveCanvasRequest(
diff --git a/docs/assets/pr/live-view-focus-mode/canvas-first.png b/docs/assets/pr/live-view-focus-mode/canvas-first.png
new file mode 100644
index 000000000..ec839c5d6
Binary files /dev/null and b/docs/assets/pr/live-view-focus-mode/canvas-first.png differ