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

compact the Live Views switcher

Louis Beaumont9c57336ffcd5
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 2366e66d0..f4e182623 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
@@ -713,6 +713,18 @@ describe("BrainOverview", () => {
expect(mocks.saveBrainView).not.toHaveBeenCalled();
});
+ it("places section navigation beside the dashboard selector", async () => {
+ render(
+ <BrainOverview
+ navigation={<button data-testid="section-navigation">views</button>}
+ />,
+ );
+
+ const row = await screen.findByTestId("overview-dashboard-row");
+ expect(within(row).getByTestId("section-navigation")).toBeTruthy();
+ expect(within(row).getByTestId("overview-dashboard-selector")).toBeTruthy();
+ });
+
it("opens AI creation first and keeps blank manual creation available", async () => {
mocks.listBrainViews.mockResolvedValue({
status: "ok",
diff --git a/apps/screenpipe-app-tauri/components/settings/__tests__/brain-section.filter.test.tsx b/apps/screenpipe-app-tauri/components/settings/__tests__/brain-section.filter.test.tsx
index 1749376a7..38d142953 100644
--- a/apps/screenpipe-app-tauri/components/settings/__tests__/brain-section.filter.test.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/__tests__/brain-section.filter.test.tsx
@@ -134,7 +134,14 @@ vi.mock("@/components/settings/compact-markdown", () => ({
}));
vi.mock("@/components/settings/brain-overview", () => ({
- BrainOverview: () => <div data-testid="brain-overview-stub" />,
+ BrainOverview: ({ navigation }: { navigation?: React.ReactNode }) => (
+ <div data-testid="brain-overview-stub">
+ <div data-testid="overview-dashboard-row">
+ {navigation}
+ <span>Time &amp; focus</span>
+ </div>
+ </div>
+ ),
}));
vi.mock("@/components/ui/use-toast", () => ({
@@ -221,7 +228,10 @@ describe("BrainSection type filter", () => {
render(<BrainSection />);
await waitFor(() => {
- expect(screen.getByTestId("brain-view-switcher")).toHaveTextContent("Memories8");
+ expect(screen.getByTestId("brain-view-switcher")).toHaveAttribute(
+ "aria-label",
+ "switch Brain view, current: Memories",
+ );
});
openBrainViewMenu();
@@ -234,7 +244,10 @@ describe("BrainSection type filter", () => {
render(<BrainSection />);
await waitFor(() => expect(memoryRows().length).toBe(8));
expect(artifactRows().length).toBe(0);
- expect(screen.getByTestId("brain-view-switcher")).toHaveTextContent("Memories8");
+ expect(screen.getByTestId("brain-view-switcher")).toHaveAttribute(
+ "aria-label",
+ "switch Brain view, current: Memories",
+ );
expect(analyticsMocks.capture).toHaveBeenCalledWith("brain_viewed", {
tab: "memories",
});
@@ -246,16 +259,31 @@ describe("BrainSection type filter", () => {
selectBrainView("artifacts");
await waitFor(() => expect(artifactRows().length).toBe(5));
- expect(screen.getByTestId("brain-view-switcher")).toHaveTextContent("Artifacts5");
+ expect(screen.getByTestId("brain-view-switcher")).toHaveAttribute(
+ "aria-label",
+ "switch Brain view, current: Artifacts",
+ );
selectBrainView("overview");
await waitFor(() =>
- expect(screen.getByTestId("brain-view-switcher")).toHaveTextContent("Live Views3"),
+ expect(screen.getByTestId("brain-view-switcher")).toHaveAttribute(
+ "aria-label",
+ "switch Brain view, current: Live Views",
+ ),
+ );
+ const dashboardRow = screen.getByTestId("overview-dashboard-row");
+ const overviewSwitcher = within(dashboardRow).getByTestId(
+ "brain-view-switcher",
);
+ expect(overviewSwitcher).not.toHaveTextContent("Live Views");
+ expect(overviewSwitcher.querySelector("svg")).not.toBeNull();
selectBrainView("memories");
await waitFor(() => expect(memoryRows().length).toBe(8));
- expect(screen.getByTestId("brain-view-switcher")).toHaveTextContent("Memories8");
+ expect(screen.getByTestId("brain-view-switcher")).toHaveAttribute(
+ "aria-label",
+ "switch Brain view, current: Memories",
+ );
});
it("keeps the stale warning specific to memories", async () => {
diff --git a/apps/screenpipe-app-tauri/components/settings/brain-overview.tsx b/apps/screenpipe-app-tauri/components/settings/brain-overview.tsx
index 56c595d3b..6a94ec85d 100644
--- a/apps/screenpipe-app-tauri/components/settings/brain-overview.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/brain-overview.tsx
@@ -399,8 +399,10 @@ function uniqueDashboardTitle(title: string, views: ViewDefinition[]): string {
}
export function BrainOverview({
+ navigation,
onViewCountChange,
}: {
+ navigation?: React.ReactNode;
onViewCountChange?: (count: number) => void;
} = {}) {
const { toast } = useToast();
@@ -2608,7 +2610,11 @@ export function BrainOverview({
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">
+ <div
+ data-testid="overview-dashboard-row"
+ className="flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1"
+ >
+ {navigation}
<LiveViewDashboardSwitcher
views={views}
current={view}
@@ -2639,7 +2645,7 @@ export function BrainOverview({
/>
<p
data-testid="overview-data-status"
- className="shrink-0 font-mono text-[9px] text-muted-foreground"
+ className="basis-full pl-12 font-mono text-[9px] text-muted-foreground sm:basis-auto sm:pl-0"
>
{onboardingColdStart
? "This view will appear when Screenpipe has enough real activity for your outcome."
diff --git a/apps/screenpipe-app-tauri/components/settings/brain-section.tsx b/apps/screenpipe-app-tauri/components/settings/brain-section.tsx
index b4f0a1a51..5271f14e2 100644
--- a/apps/screenpipe-app-tauri/components/settings/brain-section.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/brain-section.tsx
@@ -1428,6 +1428,44 @@ export function BrainSection() {
brainViewOptions.find(({ value }) => value === typeFilter) ??
brainViewOptions[0];
const ActiveBrainViewIcon = activeBrainView.Icon;
+ const brainViewSwitcher = (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <button
+ type="button"
+ data-testid="brain-view-switcher"
+ className="inline-flex h-9 w-9 shrink-0 items-center justify-center border border-border bg-background transition-colors hover:bg-foreground hover:text-background"
+ aria-label={`switch Brain view, current: ${activeBrainView.label}`}
+ title={`switch Brain view, current: ${activeBrainView.label}`}
+ >
+ <ActiveBrainViewIcon className="h-3.5 w-3.5" />
+ </button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ align="start"
+ className="w-56 rounded-none"
+ data-testid="brain-view-menu"
+ >
+ {brainViewOptions.map(({ value, label, count, Icon }) => (
+ <DropdownMenuItem
+ key={value}
+ data-testid={`brain-filter-${value}`}
+ className={typeFilter === value ? "bg-muted/50" : undefined}
+ aria-current={typeFilter === value ? "page" : undefined}
+ onSelect={() => switchTypeFilter(value)}
+ >
+ <Icon className="mr-2 h-3.5 w-3.5" />
+ <span className="flex-1">{label}</span>
+ {count !== null && (
+ <span className="font-mono text-[10px] tabular-nums text-muted-foreground">
+ {count.toLocaleString()}
+ </span>
+ )}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ );
return (
<div data-testid="section-brain" className="h-full overflow-hidden">
@@ -1465,49 +1503,14 @@ export function BrainSection() {
</div>
)}
- <div className="flex items-center justify-between gap-3">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <button
- type="button"
- data-testid="brain-view-switcher"
- 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, current: ${activeBrainView.label}`}
- >
- <ActiveBrainViewIcon className="h-3.5 w-3.5" />
- <span>{activeBrainView.label}</span>
- {activeBrainView.count !== null && (
- <span className="font-mono text-[10px] tabular-nums text-muted-foreground">
- {activeBrainView.count.toLocaleString()}
- </span>
- )}
- <ChevronDown className="h-3 w-3" />
- </button>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- align="start"
- className="w-56 rounded-none"
- data-testid="brain-view-menu"
- >
- {brainViewOptions.map(({ value, label, count, Icon }) => (
- <DropdownMenuItem
- key={value}
- data-testid={`brain-filter-${value}`}
- className={typeFilter === value ? "bg-muted/50" : undefined}
- aria-current={typeFilter === value ? "page" : undefined}
- onSelect={() => switchTypeFilter(value)}
- >
- <Icon className="mr-2 h-3.5 w-3.5" />
- <span className="flex-1">{label}</span>
- {count !== null && (
- <span className="font-mono text-[10px] tabular-nums text-muted-foreground">
- {count.toLocaleString()}
- </span>
- )}
- </DropdownMenuItem>
- ))}
- </DropdownMenuContent>
- </DropdownMenu>
+ <div
+ className={
+ typeFilter === "overview"
+ ? "hidden"
+ : "flex items-center justify-between gap-3"
+ }
+ >
+ {typeFilter !== "overview" && brainViewSwitcher}
{showFilterButton && (
<Popover
open={filterOpen}
@@ -1604,7 +1607,10 @@ export function BrainSection() {
</div>
{typeFilter === "overview" ? (
- <BrainOverview onViewCountChange={setLiveViewsTabCount} />
+ <BrainOverview
+ navigation={brainViewSwitcher}
+ onViewCountChange={setLiveViewsTabCount}
+ />
) : (
<>