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(sidebar): reorder primary navigation

Louis Beaumonte25caf0118f5
diff --git a/apps/screenpipe-app-tauri/app/(main)/home/page.tsx b/apps/screenpipe-app-tauri/app/(main)/home/page.tsx
index 8876445f5..74472e13b 100644
--- a/apps/screenpipe-app-tauri/app/(main)/home/page.tsx
+++ b/apps/screenpipe-app-tauri/app/(main)/home/page.tsx
@@ -997,10 +997,10 @@ function HomeContent() {
// Each click allocates a new session id (empty rows are not reused — that
// felt like opening an old recent).
home: { label: "Chat", icon: <Plus className="h-3.5 w-3.5" /> },
- brain: { label: "Brain", icon: <Brain className="h-3.5 w-3.5" /> },
meetings: { label: "Meetings", icon: <CalendarClock className="h-3.5 w-3.5" /> },
- pipes: { label: "Scheduled", icon: <TimerReset className="h-3.5 w-3.5" /> },
timeline: { label: "Timeline", icon: <MonitorPlay className="h-3.5 w-3.5" /> },
+ brain: { label: "Brain", icon: <Brain className="h-3.5 w-3.5" /> },
+ pipes: { label: "Scheduled", icon: <TimerReset className="h-3.5 w-3.5" /> },
connections: { label: "Connections", icon: <Plug className="h-3.5 w-3.5" /> },
};
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.ts
index e7986e259..bf24f3d9a 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
@@ -44,13 +44,22 @@ describe("normalizeSidebarNavLayout", () => {
expect(layout.order.slice(0, 2)).toEqual(["timeline", "home"]);
expect(layout.order).toContain("meetings");
expect(layout.order).toContain("connections");
- // meetings sits after brain (its canonical predecessor), not appended last.
+ // meetings sits after Chat (its canonical predecessor), not appended last.
expect(layout.order.indexOf("meetings")).toBe(
- layout.order.indexOf("brain") + 1,
+ layout.order.indexOf("home") + 1,
);
expect(layout.order).toHaveLength(ALL.length);
});
+ it("moves the previous untouched default to the new shipped order", () => {
+ const layout = normalizeSidebarNavLayout({
+ order: ["home", "brain", "meetings", "pipes", "timeline", "connections"],
+ hidden: ["connections"],
+ });
+ expect(layout.order).toEqual(ALL);
+ expect(layout.hidden).toEqual(["connections"]);
+ });
+
it("never duplicates an id", () => {
const layout = normalizeSidebarNavLayout({
order: ["home", "home", "brain"],
@@ -97,7 +106,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", "brain", "meetings", "pipes", "timeline",
+ "connections", "home", "meetings", "timeline", "brain", "pipes",
]);
});
@@ -122,7 +131,7 @@ describe("reordering", () => {
it("shifts up and down and no-ops at the ends", () => {
const down = shiftSidebarNavItem(DEFAULT_SIDEBAR_NAV_LAYOUT, ALL, "home", 1);
- expect(resolveVisibleSidebarNavIds(down, ALL).slice(0, 2)).toEqual(["brain", "home"]);
+ expect(resolveVisibleSidebarNavIds(down, ALL).slice(0, 2)).toEqual(["meetings", "home"]);
const stuck = shiftSidebarNavItem(DEFAULT_SIDEBAR_NAV_LAYOUT, ALL, "home", -1);
expect(stuck).toBe(DEFAULT_SIDEBAR_NAV_LAYOUT);
});
@@ -146,8 +155,8 @@ describe("hide and show", () => {
});
const next = setSidebarNavItemHidden(meetingsHidden, ALL, "meetings", false);
expect(resolveVisibleSidebarNavIds(next, ALL)).toContain("meetings");
- // and it lands in its canonical neighbourhood, right after brain.
- expect(resolveVisibleSidebarNavIds(next, ALL).indexOf("meetings")).toBe(2);
+ // and it lands in its canonical neighbourhood, right after Chat.
+ expect(resolveVisibleSidebarNavIds(next, ALL).indexOf("meetings")).toBe(1);
});
it("hides a row", () => {
diff --git a/apps/screenpipe-app-tauri/lib/utils/sidebar-nav-layout.ts b/apps/screenpipe-app-tauri/lib/utils/sidebar-nav-layout.ts
index ef17277d1..b24305203 100644
--- a/apps/screenpipe-app-tauri/lib/utils/sidebar-nav-layout.ts
+++ b/apps/screenpipe-app-tauri/lib/utils/sidebar-nav-layout.ts
@@ -19,15 +19,24 @@
/** Canonical order — also the fallback for ids a stored layout never mentioned. */
export const SIDEBAR_NAV_ORDER = [
"home",
- "brain",
"meetings",
- "pipes",
"timeline",
+ "brain",
+ "pipes",
"connections",
] as const;
export type SidebarNavId = (typeof SIDEBAR_NAV_ORDER)[number];
+const PREVIOUS_DEFAULT_SIDEBAR_NAV_ORDER = [
+ "home",
+ "brain",
+ "meetings",
+ "pipes",
+ "timeline",
+ "connections",
+] as const satisfies readonly SidebarNavId[];
+
export type SidebarNavLayout = {
/** Ids in render order. May omit ids (they fall back to canonical position). */
order: SidebarNavId[];
@@ -79,10 +88,20 @@ export function normalizeSidebarNavLayout(
return { order: [...SIDEBAR_NAV_ORDER], hidden };
}
+ // Move installs that still have the previous shipped default to the new
+ // default. Any other stored order remains user-owned and untouched.
+ const hadPreviousDefaultOrder =
+ storedOrder.length === PREVIOUS_DEFAULT_SIDEBAR_NAV_ORDER.length &&
+ storedOrder.every(
+ (id, index) => id === PREVIOUS_DEFAULT_SIDEBAR_NAV_ORDER[index],
+ );
+
// Splice missing ids back at their canonical position: walk the canonical
// list and, for each id the user never ordered, insert it after the last
// canonical predecessor that the stored order does contain.
- const order = [...storedOrder];
+ const order = hadPreviousDefaultOrder
+ ? [...SIDEBAR_NAV_ORDER]
+ : [...storedOrder];
for (const id of SIDEBAR_NAV_ORDER) {
if (order.includes(id)) continue;
const canonicalIndex = SIDEBAR_NAV_ORDER.indexOf(id);