Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

Commit e1b133b

Browse files
committed
dedupe sidebar nav rendering, remove usage item
1 parent 7e5cc89 commit e1b133b

7 files changed

Lines changed: 219 additions & 244 deletions

File tree

‎packages/shared/src/analytics-events.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ export type SidebarNavItem =
245245
| "agents"
246246
| "skills"
247247
| "mcp_servers"
248-
| "usage"
249248
| "command_center"
250249
| "contexts"
251250
| "activity"

‎packages/ui/src/features/sidebar/components/CustomizeSidebarDialog.tsx‎

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
import {
22
Bell,
3-
CreditCard,
43
EnvelopeSimple,
54
Lightbulb,
65
Lightning,
76
MagnifyingGlass,
87
Plugs,
98
Robot,
109
} from "@phosphor-icons/react";
11-
import {
12-
ANALYTICS_EVENTS,
13-
type SidebarNavItem,
14-
} from "@posthog/shared/analytics-events";
10+
import { ANALYTICS_EVENTS } from "@posthog/shared/analytics-events";
1511
import {
1612
CUSTOMIZABLE_NAV_ITEMS,
1713
type CustomizableNavItemId,
@@ -31,24 +27,11 @@ const ITEM_ICONS: Record<
3127
agents: Robot,
3228
skills: Lightbulb,
3329
"mcp-servers": Plugs,
34-
usage: CreditCard,
3530
"command-center": Lightning,
3631
contexts: SquircleDashed,
3732
activity: Bell,
3833
};
3934

40-
const ITEM_ANALYTICS_IDS: Record<CustomizableNavItemId, SidebarNavItem> = {
41-
search: "search",
42-
inbox: "inbox",
43-
agents: "agents",
44-
skills: "skills",
45-
"mcp-servers": "mcp_servers",
46-
usage: "usage",
47-
"command-center": "command_center",
48-
contexts: "contexts",
49-
activity: "activity",
50-
};
51-
5235
interface CustomizeSidebarDialogProps {
5336
open: boolean;
5437
onOpenChange: (open: boolean) => void;
@@ -71,7 +54,7 @@ export function CustomizeSidebarDialog({
7154
</Dialog.Description>
7255

7356
<Flex direction="column" gap="3" mt="4">
74-
{CUSTOMIZABLE_NAV_ITEMS.map(({ id, label }) => {
57+
{CUSTOMIZABLE_NAV_ITEMS.map(({ id, label, analyticsId }) => {
7558
const ItemIcon = ITEM_ICONS[id];
7659
const visible = isNavItemVisible(navItemOverrides, id);
7760
return (
@@ -83,7 +66,7 @@ export function CustomizeSidebarDialog({
8366
const nextVisible = checked === true;
8467
setNavItemVisible(id, nextVisible);
8568
track(ANALYTICS_EVENTS.SIDEBAR_CUSTOMIZED, {
86-
item: ITEM_ANALYTICS_IDS[id],
69+
item: analyticsId,
8770
visible: nextVisible,
8871
});
8972
}}
@@ -98,7 +81,9 @@ export function CustomizeSidebarDialog({
9881

9982
<Flex mt="4" justify="end">
10083
<Dialog.Close>
101-
<Button variant="solid">Done</Button>
84+
<Button size="1" variant="solid">
85+
Done
86+
</Button>
10287
</Dialog.Close>
10388
</Flex>
10489
</Dialog.Content>

‎packages/ui/src/features/sidebar/components/SidebarItem.tsx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import { useCallback } from "react";
1111

1212
const INDENT_SIZE = 8;
1313

14+
export function getSidebarItemPaddingLeft(depth: number): string {
15+
return `${depth * INDENT_SIZE + 8 + (depth > 0 ? 4 : 0)}px`;
16+
}
17+
1418
interface SidebarItemProps {
1519
depth: number;
1620
icon?: React.ReactNode;
@@ -93,7 +97,7 @@ export function SidebarItem({
9397
draggable={draggable}
9498
onDragStart={onDragStart}
9599
style={{
96-
paddingLeft: `${depth * INDENT_SIZE + 8 + (depth > 0 ? 4 : 0)}px`,
100+
paddingLeft: getSidebarItemPaddingLeft(depth),
97101
paddingRight: "8px",
98102
}}
99103
onClick={onClick}

0 commit comments

Comments
 (0)