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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix: hide Library from the default sidebar (#7158)
Louis Beaumont04eb3652263c
diff --git a/.github/pr-assets/library-hidden-default/after-dark.png b/.github/pr-assets/library-hidden-default/after-dark.pngnew file mode 100644index 000000000..685d88457Binary files /dev/null and b/.github/pr-assets/library-hidden-default/after-dark.png differdiff --git a/.github/pr-assets/library-hidden-default/after-light.png b/.github/pr-assets/library-hidden-default/after-light.pngnew file mode 100644index 000000000..7cafa2134Binary files /dev/null and b/.github/pr-assets/library-hidden-default/after-light.png differdiff --git a/.github/pr-assets/library-hidden-default/before-dark.png b/.github/pr-assets/library-hidden-default/before-dark.pngnew file mode 100644index 000000000..24b8577c3Binary files /dev/null and b/.github/pr-assets/library-hidden-default/before-dark.png differdiff --git a/.github/pr-assets/library-hidden-default/before-light.png b/.github/pr-assets/library-hidden-default/before-light.pngnew file mode 100644index 000000000..e7e8cb2e4Binary files /dev/null and b/.github/pr-assets/library-hidden-default/before-light.png differdiff --git a/.github/pr-assets/library-hidden-default/library-open-light.png b/.github/pr-assets/library-hidden-default/library-open-light.pngnew file mode 100644index 000000000..c5c50d9dfBinary files /dev/null and b/.github/pr-assets/library-hidden-default/library-open-light.png differdiff --git a/.github/pr-assets/library-hidden-default/library-restored-dark.png b/.github/pr-assets/library-hidden-default/library-restored-dark.pngnew file mode 100644index 000000000..b76c52dd1Binary files /dev/null and b/.github/pr-assets/library-hidden-default/library-restored-dark.png differdiff --git a/.github/pr-assets/library-hidden-default/library-restored-light.png b/.github/pr-assets/library-hidden-default/library-restored-light.pngnew file mode 100644index 000000000..335f2843aBinary files /dev/null and b/.github/pr-assets/library-hidden-default/library-restored-light.png differdiff --git a/.github/pr-assets/library-hidden-default/show-library-menu-dark.png b/.github/pr-assets/library-hidden-default/show-library-menu-dark.pngnew file mode 100644index 000000000..1fd2273c4Binary files /dev/null and b/.github/pr-assets/library-hidden-default/show-library-menu-dark.png differdiff --git a/.github/pr-assets/library-hidden-default/show-library-menu-light.png b/.github/pr-assets/library-hidden-default/show-library-menu-light.pngnew file mode 100644index 000000000..e41b407a7Binary files /dev/null and b/.github/pr-assets/library-hidden-default/show-library-menu-light.png differdiff --git a/apps/screenpipe-app-tauri/components/__tests__/sidebar-nav-list.test.tsx b/apps/screenpipe-app-tauri/components/__tests__/sidebar-nav-list.test.tsxindex 758e704cc..0aaaa508c 100644--- a/apps/screenpipe-app-tauri/components/__tests__/sidebar-nav-list.test.tsx+++ b/apps/screenpipe-app-tauri/components/__tests__/sidebar-nav-list.test.tsx@@ -182,7 +182,18 @@ describe("SidebarNavList", () => {expect(handlers.onSetHidden).toHaveBeenCalledWith("meetings", false);});- it("adds no sidebar-options chrome before the layout changes", () => {+ it("offers Show Library from the default layout without a no-op reset", () => {+ const handlers = renderCustomizationMenu({+ hiddenItems: [{ id: "brain", label: "Library" }],+ canReset: false,+ });+ openDropdown("sidebar-options");+ expect(screen.queryByTestId("sidebar-options-reset")).toBeNull();+ fireEvent.click(screen.getByText("Show Library"));+ expect(handlers.onSetHidden).toHaveBeenCalledWith("brain", false);+ });++ it("adds no sidebar-options chrome when nothing can be restored or reset", () => {renderCustomizationMenu({ hiddenItems: [], canReset: false });expect(screen.queryByTestId("sidebar-options")).toBeNull();});diff --git a/apps/screenpipe-app-tauri/components/sidebar-nav-list.tsx b/apps/screenpipe-app-tauri/components/sidebar-nav-list.tsxindex a8ca11257..dbc0b6ede 100644--- a/apps/screenpipe-app-tauri/components/sidebar-nav-list.tsx+++ b/apps/screenpipe-app-tauri/components/sidebar-nav-list.tsx@@ -337,7 +337,7 @@ export function SidebarCustomizationMenu({onSetHidden,onReset,}: SidebarCustomizationMenuProps) {- if (!canReset) return null;+ if (!canReset && hiddenItems.length === 0) return null;return (<DropdownMenu><DropdownMenuTrigger asChild>@@ -369,15 +369,19 @@ export function SidebarCustomizationMenu({Show {hidden.label}</DropdownMenuItem>))}- {hiddenItems.length > 0 && <DropdownMenuSeparator />}- <DropdownMenuItem- className={ITEM_CLS}- data-testid="sidebar-options-reset"- onSelect={onReset}- >- <RotateCcw />- Reset sidebar- </DropdownMenuItem>+ {canReset && (+ <>+ {hiddenItems.length > 0 && <DropdownMenuSeparator />}+ <DropdownMenuItem+ className={ITEM_CLS}+ data-testid="sidebar-options-reset"+ onSelect={onReset}+ >+ <RotateCcw />+ Reset sidebar+ </DropdownMenuItem>+ </>+ )}</DropdownMenuContent></DropdownMenu>);diff --git a/apps/screenpipe-app-tauri/lib/utils/__tests__/sidebar-nav-layout.test.ts b/apps/screenpipe-app-tauri/lib/utils/__tests__/sidebar-nav-layout.test.tsindex 6429fba33..1125bc5c8 100644--- a/apps/screenpipe-app-tauri/lib/utils/__tests__/sidebar-nav-layout.test.ts+++ b/apps/screenpipe-app-tauri/lib/utils/__tests__/sidebar-nav-layout.test.ts@@ -22,10 +22,16 @@ describe("normalizeSidebarNavLayout", () => {for (const junk of [undefined, null, 42, "layout", [], { order: 3 }]) {const layout = normalizeSidebarNavLayout(junk);expect(layout.order).toEqual(ALL);- expect(layout.hidden).toEqual([]);+ expect(layout.hidden).toEqual(["brain"]);}});+ it("preserves an explicitly saved visible Library on upgrade", () => {+ const layout = normalizeSidebarNavLayout({ order: ALL, hidden: [] });+ expect(layout.hidden).toEqual([]);+ expect(resolveVisibleSidebarNavIds(layout, ALL)).toContain("brain");+ });+it("drops ids that no longer exist", () => {const layout = normalizeSidebarNavLayout({order: ["timeline", "ghost", "home"],@@ -72,9 +78,9 @@ describe("normalizeSidebarNavLayout", () => {});describe("resolveVisibleSidebarNavIds", () => {- it("shows every row by default, meetings included", () => {+ it("hides Library by default and keeps the other rows visible", () => {const visible = resolveVisibleSidebarNavIds(DEFAULT_SIDEBAR_NAV_LAYOUT, ALL);- expect(visible).toEqual(ALL);+ expect(visible).toEqual(ALL.filter((id) => id !== "brain"));});it("lets enterprise policy win over the user layout", () => {@@ -90,7 +96,7 @@ describe("resolveVisibleSidebarNavIds", () => {});it("reports the hidden-but-restorable ids", () => {- expect(resolveHiddenSidebarNavIds(DEFAULT_SIDEBAR_NAV_LAYOUT, ALL)).toEqual([]);+ expect(resolveHiddenSidebarNavIds(DEFAULT_SIDEBAR_NAV_LAYOUT, ALL)).toEqual(["brain"]);const meetingsHidden = normalizeSidebarNavLayout({order: ALL,hidden: ["meetings"],@@ -107,7 +113,7 @@ describe("reordering", () => {it("moves an item to an index among the visible rows", () => {const next = moveSidebarNavItem(DEFAULT_SIDEBAR_NAV_LAYOUT, ALL, "connections", 0);expect(resolveVisibleSidebarNavIds(next, ALL)).toEqual([- "connections", "home", "meetings", "timeline", "activity", "brain", "pipes",+ "connections", "home", "meetings", "timeline", "activity", "pipes",]);});@@ -149,6 +155,16 @@ describe("reordering", () => {});describe("hide and show", () => {+ it("restores Library in place and preserves the choice on reload", () => {+ const shown = setSidebarNavItemHidden(DEFAULT_SIDEBAR_NAV_LAYOUT, ALL, "brain", false);+ const reloaded = normalizeSidebarNavLayout(JSON.parse(JSON.stringify(shown)));+ expect(resolveVisibleSidebarNavIds(reloaded, ALL)).toEqual(ALL);+ expect(resolveHiddenSidebarNavIds(reloaded, ALL)).toEqual([]);+ expect(isSidebarNavLayoutDefault(reloaded)).toBe(false);+ const hidden = setSidebarNavItemHidden(reloaded, ALL, "brain", true);+ expect(isSidebarNavLayoutDefault(hidden)).toBe(true);+ });+it("shows meetings in the sidebar again after hiding it", () => {const meetingsHidden = normalizeSidebarNavLayout({order: ALL,diff --git a/apps/screenpipe-app-tauri/lib/utils/sidebar-nav-layout.ts b/apps/screenpipe-app-tauri/lib/utils/sidebar-nav-layout.tsindex cd7189809..1fe028a04 100644--- a/apps/screenpipe-app-tauri/lib/utils/sidebar-nav-layout.ts+++ b/apps/screenpipe-app-tauri/lib/utils/sidebar-nav-layout.ts@@ -41,13 +41,13 @@ const PREVIOUS_DEFAULT_SIDEBAR_NAV_ORDER = [export type SidebarNavLayout = {/** Ids in render order. May omit ids (they fall back to canonical position). */order: SidebarNavId[];- /** Ids kept out of the sidebar. Nothing is hidden by default. */+ /** Ids kept out of the sidebar. Library is hidden by default. */hidden: SidebarNavId[];};export const DEFAULT_SIDEBAR_NAV_LAYOUT: SidebarNavLayout = {order: [...SIDEBAR_NAV_ORDER],- hidden: [],+ hidden: ["brain"],};/** At least one row must stay in the sidebar — an empty nav is a dead end. */