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

fix(app): move Live View freshness into time range tooltip

Louis Beaumontc06f3eab2ca7
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 4302bcc05..f4c892dcc 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
@@ -850,14 +850,14 @@ describe("BrainOverview", () => {
const header = controls.parentElement;
expect(header?.className).toContain("grid");
expect(header?.className).toContain("lg:grid-cols-[minmax(0,1fr)_auto]");
- const freshness = screen.getByTestId("overview-data-status");
- expect(freshness.parentElement).toBe(header);
- expect(freshness.className).toContain("lg:col-span-2");
- expect(freshness.className).toContain("truncate");
- expect(header?.lastElementChild).toBe(freshness);
+ expect(screen.queryByTestId("overview-data-status")).toBeNull();
expect(screen.getByTestId("overview-time-range").className).toContain(
"h-9",
);
+ expect(screen.getByTestId("overview-time-range")).toHaveAttribute(
+ "title",
+ expect.stringMatching(/^Latest update: /),
+ );
expect(screen.getByTestId("overview-refresh-data").className).toContain(
"w-9",
);
@@ -939,9 +939,7 @@ describe("BrainOverview", () => {
await screen.findByTestId("overview-dashboard-selector");
expect(screen.queryByTestId("overview-fixed-period")).toBeNull();
expect(screen.queryByTestId("overview-time-range")).toBeNull();
- expect(screen.getByTestId("overview-data-status")).toHaveTextContent(
- /^1 of 1 block ready · updated /,
- );
+ expect(screen.queryByTestId("overview-data-status")).toBeNull();
await openDashboardMenu();
fireEvent.click(await screen.findByTestId("overview-edit"));
@@ -1030,12 +1028,12 @@ describe("BrainOverview", () => {
fireEvent.change(selector, { target: { value: otherView.id } });
await waitFor(() => expect(selector.value).toBe(otherView.id));
- expect(screen.getByTestId("overview-data-status").textContent).toBe(
- "No data yet",
+ expect(screen.getByTestId("overview-time-range")).not.toHaveAttribute(
+ "title",
);
});
- it("shows block readiness and the oldest/latest update instead of one misleading dashboard timestamp", async () => {
+ it("keeps only the latest update in the time-range tooltip", async () => {
const oldValue = populatedView.slots[0].value!;
mocks.listBrainViews.mockResolvedValue({
status: "ok",
@@ -1066,43 +1064,13 @@ describe("BrainOverview", () => {
});
render(<BrainOverview />);
- const status = await screen.findByTestId("overview-data-status");
- expect(status).toHaveTextContent(/^2 of 3 blocks ready · oldest /);
- expect(status).toHaveTextContent(/ · latest /);
- expect(status).not.toHaveTextContent(/^Updated /);
- });
-
- it("treats blocks published within one minute as one coherent update", async () => {
- const firstValue = populatedView.slots[0].value!;
- mocks.listBrainViews.mockResolvedValue({
- status: "ok",
- data: [
- {
- ...populatedView,
- slots: [
- populatedView.slots[0],
- {
- ...populatedView.slots[0],
- id: "same-refresh",
- order: 1,
- value: {
- ...firstValue,
- artifactOutputId: 89,
- updatedAt: "2026-07-23T17:00:30Z",
- },
- },
- ],
- },
- ],
- });
- render(<BrainOverview />);
-
- expect(await screen.findByTestId("overview-data-status")).toHaveTextContent(
- /^2 of 2 blocks ready · updated /,
- );
- expect(screen.getByTestId("overview-data-status")).not.toHaveTextContent(
- "oldest",
+ const timeRange = await screen.findByTestId("overview-time-range");
+ expect(timeRange).toHaveAttribute(
+ "title",
+ expect.stringMatching(/^Latest update: /),
);
+ expect(timeRange.getAttribute("title")).not.toContain("oldest");
+ expect(screen.queryByTestId("overview-data-status")).toBeNull();
});
it("keeps vertical scrolling on the dashboard while dense tables can scroll sideways", async () => {
diff --git a/apps/screenpipe-app-tauri/components/settings/brain-overview.tsx b/apps/screenpipe-app-tauri/components/settings/brain-overview.tsx
index b4a5734ca..7915a5d61 100644
--- a/apps/screenpipe-app-tauri/components/settings/brain-overview.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/brain-overview.tsx
@@ -180,8 +180,6 @@ type AiBlockProposal = {
const STARTER_DASHBOARD_ID = "my-dashboard";
const STARTER_DASHBOARD_TITLE = "My dashboard";
const LIVE_VIEW_ANALYTICS_SCHEMA_VERSION = 2;
-const LIVE_VIEW_COHERENT_UPDATE_WINDOW_MS = 60_000;
-
const LIVE_VIEW_FRESHNESS_FORMATTER = new Intl.DateTimeFormat(undefined, {
month: "short",
day: "numeric",
@@ -189,23 +187,15 @@ const LIVE_VIEW_FRESHNESS_FORMATTER = new Intl.DateTimeFormat(undefined, {
minute: "2-digit",
});
-function liveViewDataStatus(slots: BrainViewSlot[]): string {
+function liveViewLatestUpdate(slots: BrainViewSlot[]): string | null {
const timestamps = slots.flatMap((slot) => {
const timestamp = slot.value?.updatedAt
? Date.parse(slot.value.updatedAt)
: Number.NaN;
return Number.isFinite(timestamp) ? [timestamp] : [];
});
- if (timestamps.length === 0) return "No data yet";
-
- const blockLabel = slots.length === 1 ? "block" : "blocks";
- const readiness = `${timestamps.length} of ${slots.length} ${blockLabel} ready`;
- const oldest = Math.min(...timestamps);
- const latest = Math.max(...timestamps);
- if (latest - oldest <= LIVE_VIEW_COHERENT_UPDATE_WINDOW_MS) {
- return `${readiness} · updated ${LIVE_VIEW_FRESHNESS_FORMATTER.format(latest)}`;
- }
- return `${readiness} · oldest ${LIVE_VIEW_FRESHNESS_FORMATTER.format(oldest)} · latest ${LIVE_VIEW_FRESHNESS_FORMATTER.format(latest)}`;
+ if (timestamps.length === 0) return null;
+ return `Latest update: ${LIVE_VIEW_FRESHNESS_FORMATTER.format(Math.max(...timestamps))}`;
}
function analyticsErrorType(error: unknown): string {
@@ -2711,7 +2701,7 @@ export function BrainOverview({
: canvasDocument;
const boundSlotCount = slots.filter((slot) => slot.binding).length;
const periodRanges = allowedLiveViewTimeRanges(view.periodPolicy);
- const dataStatus = liveViewDataStatus(slots);
+ const latestUpdate = liveViewLatestUpdate(slots);
const refreshIsActive =
dataRefresh?.viewId === view.id &&
(dataRefresh.status === "starting" || dataRefresh.status === "running");
@@ -2789,7 +2779,12 @@ export function BrainOverview({
>
<SelectTrigger
data-testid="overview-time-range"
- aria-label="Live View time range"
+ aria-label={
+ latestUpdate
+ ? `Live View time range. ${latestUpdate}`
+ : "Live View time range"
+ }
+ title={latestUpdate ?? undefined}
className="h-9 min-w-36 w-auto flex-1 text-xs sm:flex-none"
>
<SelectValue />
@@ -2822,14 +2817,6 @@ export function BrainOverview({
</Button>
)}
</div>
- <p
- data-testid="overview-data-status"
- className="min-w-0 truncate pl-12 font-mono text-[9px] text-muted-foreground lg:col-span-2"
- >
- {onboardingColdStart
- ? "This view will appear when Screenpipe has enough real activity for your outcome."
- : dataStatus}
- </p>
</div>
{canvasError && (
<div
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 95409b579..9d19722fc 100644
--- a/apps/screenpipe-app-tauri/e2e/specs/brain-overview.spec.ts
+++ b/apps/screenpipe-app-tauri/e2e/specs/brain-overview.spec.ts
@@ -911,12 +911,13 @@ describe("Brain Live Views", function () {
await waitForTestId("canvas-block-tracked-work", 10_000);
await setCssWindowSize(1440, 900);
- const statusText = (
- await waitForTestId("overview-data-status", 10_000)
- ).getText();
- expect((await statusText).toLowerCase()).toContain("2 of 2 blocks ready");
- expect((await statusText).toLowerCase()).toContain("updated");
- expect((await statusText).toLowerCase()).not.toMatch(/^updated /);
+ const timeRange = await waitForTestId("overview-time-range", 10_000);
+ expect((await timeRange.getAttribute("title"))?.toLowerCase()).toContain(
+ "latest update:",
+ );
+ expect(await $("[data-testid='overview-data-status']").isExisting()).toBe(
+ false,
+ );
const cardText = (
await waitForTestId("overview-card-tracked-work", 10_000)
@@ -1193,9 +1194,13 @@ Refresh the assigned Live View output targets from source-backed activity.
);
await selectDashboard(SELECTABLE_VIEW_ID);
await waitForTestId("live-view-canvas", 15_000);
- const freshnessStatus = await waitForTestId("overview-data-status", 10_000);
- expect((await freshnessStatus.getText()).toLowerCase()).toContain("oldest");
- expect((await freshnessStatus.getText()).toLowerCase()).toContain("latest");
+ const timeRangeFreshness = await waitForTestId(
+ "overview-time-range",
+ 10_000,
+ );
+ expect(
+ (await timeRangeFreshness.getAttribute("title"))?.toLowerCase(),
+ ).toContain("latest update:");
for (const size of SUPPORTED_WINDOW_SIZES) {
await setCssWindowSize(size.width, size.height);
await browser.pause(150);
@@ -1215,9 +1220,6 @@ Refresh the assigned Live View output targets from source-backed activity.
const dashboardSwitcher = document.querySelector<HTMLElement>(
"[data-testid='live-view-dashboard-switcher']",
);
- const freshness = document.querySelector<HTMLElement>(
- "[data-testid='overview-data-status']",
- );
const headerControls = document.querySelector<HTMLElement>(
"[data-testid='overview-header-controls']",
);
@@ -1227,7 +1229,6 @@ Refresh the assigned Live View output targets from source-backed activity.
!overview ||
!canvas ||
!dashboardSwitcher ||
- !freshness ||
!headerControls
)
return null;
@@ -1235,9 +1236,6 @@ Refresh the assigned Live View output targets from source-backed activity.
const canvasRect = canvas.getBoundingClientRect();
const dashboardSwitcherRect = dashboardSwitcher.getBoundingClientRect();
const headerControlsRect = headerControls.getBoundingClientRect();
- const freshnessTextRange = document.createRange();
- freshnessTextRange.selectNodeContents(freshness);
- const freshnessTextRect = freshnessTextRange.getBoundingClientRect();
const overlaps = (left: DOMRect, right: DOMRect) =>
left.left < right.right &&
left.right > right.left &&
@@ -1271,21 +1269,10 @@ Refresh the assigned Live View output targets from source-backed activity.
sectionBottom: sectionRect.bottom,
canvasBottom: canvasRect.bottom,
canvasHeight: canvasRect.height,
- freshnessTextOverlapsDashboard: overlaps(
- freshnessTextRect,
- dashboardSwitcherRect,
- ),
- freshnessTextOverlapsControls: overlaps(
- freshnessTextRect,
+ headerControlsOverlapDashboard: overlaps(
headerControlsRect,
+ dashboardSwitcherRect,
),
- freshnessBelowHeaderControls:
- freshnessTextRect.top >=
- Math.max(dashboardSwitcherRect.bottom, headerControlsRect.bottom) -
- 1,
- freshnessTextInsideSection:
- freshnessTextRect.left >= sectionRect.left - 1 &&
- freshnessTextRect.right <= sectionRect.right + 1,
overviewOverflowY: getComputedStyle(overview).overflowY,
firstContentTop,
clippedControls: visibleControls
@@ -1322,10 +1309,7 @@ Refresh the assigned Live View output targets from source-backed activity.
sectionBottom: number;
canvasBottom: number;
canvasHeight: number;
- freshnessTextOverlapsDashboard: boolean;
- freshnessTextOverlapsControls: boolean;
- freshnessBelowHeaderControls: boolean;
- freshnessTextInsideSection: boolean;
+ headerControlsOverlapDashboard: boolean;
overviewOverflowY: string;
firstContentTop: number;
clippedControls: Array<{
@@ -1360,10 +1344,7 @@ Refresh the assigned Live View output targets from source-backed activity.
layout!.sectionBottom + 1,
);
expect(layout!.canvasHeight).toBeGreaterThan(200);
- expect(layout!.freshnessTextOverlapsDashboard).toBe(false);
- expect(layout!.freshnessTextOverlapsControls).toBe(false);
- expect(layout!.freshnessBelowHeaderControls).toBe(true);
- expect(layout!.freshnessTextInsideSection).toBe(true);
+ expect(layout!.headerControlsOverlapDashboard).toBe(false);
expect(layout!.clippedControls).toEqual([]);
}
await setCssWindowSize(1440, 900);
@@ -1424,11 +1405,9 @@ Refresh the assigned Live View output targets from source-backed activity.
expect(await $("[data-testid='overview-time-range']").isExisting()).toBe(
false,
);
- const fixedDashboardText = (await browser.execute(
- () => document.body?.innerText || "",
- )) as string;
- expect(fixedDashboardText.toLowerCase()).toContain("blocks ready");
- expect(fixedDashboardText.toLowerCase()).toContain("updated");
+ expect(await $("[data-testid='overview-data-status']").isExisting()).toBe(
+ false,
+ );
const fixedScreenshot = await saveScreenshot(
"brain-overview-fixed-range-hidden",
);