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

Commit 7e5cc89

Browse files
committed
add inbox, default skills and mcp visible
1 parent 4a55d36 commit 7e5cc89

6 files changed

Lines changed: 63 additions & 38 deletions

File tree

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
Bell,
33
CreditCard,
4+
EnvelopeSimple,
45
Lightbulb,
56
Lightning,
67
MagnifyingGlass,
@@ -12,20 +13,21 @@ import {
1213
type SidebarNavItem,
1314
} from "@posthog/shared/analytics-events";
1415
import {
16+
CUSTOMIZABLE_NAV_ITEMS,
17+
type CustomizableNavItemId,
1518
isNavItemVisible,
16-
MORE_NAV_ITEMS,
17-
type MoreNavItemId,
1819
} from "@posthog/ui/features/sidebar/constants";
1920
import { useSidebarStore } from "@posthog/ui/features/sidebar/sidebarStore";
2021
import { track } from "@posthog/ui/shell/analytics";
2122
import { Button, Checkbox, Dialog, Flex, Text } from "@radix-ui/themes";
2223
import { SquircleDashed } from "lucide-react";
2324

2425
const ITEM_ICONS: Record<
25-
MoreNavItemId,
26+
CustomizableNavItemId,
2627
React.ComponentType<{ size?: number | string }>
2728
> = {
2829
search: MagnifyingGlass,
30+
inbox: EnvelopeSimple,
2931
agents: Robot,
3032
skills: Lightbulb,
3133
"mcp-servers": Plugs,
@@ -35,8 +37,9 @@ const ITEM_ICONS: Record<
3537
activity: Bell,
3638
};
3739

38-
const ITEM_ANALYTICS_IDS: Record<MoreNavItemId, SidebarNavItem> = {
40+
const ITEM_ANALYTICS_IDS: Record<CustomizableNavItemId, SidebarNavItem> = {
3941
search: "search",
42+
inbox: "inbox",
4043
agents: "agents",
4144
skills: "skills",
4245
"mcp-servers": "mcp_servers",
@@ -68,7 +71,7 @@ export function CustomizeSidebarDialog({
6871
</Dialog.Description>
6972

7073
<Flex direction="column" gap="3" mt="4">
71-
{MORE_NAV_ITEMS.map(({ id, label }) => {
74+
{CUSTOMIZABLE_NAV_ITEMS.map(({ id, label }) => {
7275
const ItemIcon = ITEM_ICONS[id];
7376
const visible = isNavItemVisible(navItemOverrides, id);
7477
return (

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

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import { useCommandCenterStore } from "@posthog/ui/features/command-center/comma
99
import { useFeatureFlag } from "@posthog/ui/features/feature-flags/useFeatureFlag";
1010
import { useInboxAllReports } from "@posthog/ui/features/inbox/hooks/useInboxAllReports";
1111
import {
12+
CUSTOMIZABLE_NAV_ITEM_IDS,
13+
CUSTOMIZABLE_NAV_ITEMS,
14+
type CustomizableNavItemId,
1215
isNavItemVisible,
13-
MORE_NAV_ITEM_IDS,
14-
MORE_NAV_ITEMS,
15-
type MoreNavItemId,
1616
} from "@posthog/ui/features/sidebar/constants";
1717
import { useSidebarStore } from "@posthog/ui/features/sidebar/sidebarStore";
1818
import { useTasks } from "@posthog/ui/features/tasks/useTasks";
@@ -163,8 +163,10 @@ export function SidebarNavSection({
163163
};
164164

165165
const navItemOverrides = useSidebarStore((s) => s.navItemOverrides);
166-
const hidden = new Set<MoreNavItemId>(
167-
MORE_NAV_ITEM_IDS.filter((id) => !isNavItemVisible(navItemOverrides, id)),
166+
const hidden = new Set<CustomizableNavItemId>(
167+
CUSTOMIZABLE_NAV_ITEM_IDS.filter(
168+
(id) => !isNavItemVisible(navItemOverrides, id),
169+
),
168170
);
169171
const [moreExpanded, setMoreExpanded] = useState(false);
170172
const [customizeOpen, setCustomizeOpen] = useState(false);
@@ -175,8 +177,9 @@ export function SidebarNavSection({
175177
// More row so the current page stays visible in the nav. Search, Usage and
176178
// Contexts never take over: Search opens the command menu in place, Usage
177179
// leaves for the settings chrome and Contexts is a toggle, not a page.
178-
const moreItemActive: Record<MoreNavItemId, boolean> = {
180+
const moreItemActive: Record<CustomizableNavItemId, boolean> = {
179181
search: false,
182+
inbox: isInboxActive,
180183
agents: isAgentsActive,
181184
skills: isSkillsActive,
182185
"mcp-servers": isMcpServersActive,
@@ -185,7 +188,7 @@ export function SidebarNavSection({
185188
contexts: false,
186189
activity: isActivityActive,
187190
};
188-
const activeHiddenItem = MORE_NAV_ITEMS.find(
191+
const activeHiddenItem = CUSTOMIZABLE_NAV_ITEMS.find(
189192
({ id }) => hidden.has(id) && moreItemActive[id],
190193
);
191194
const takeoverLabel =
@@ -253,13 +256,15 @@ export function SidebarNavSection({
253256
</Box>
254257
)}
255258

256-
<Box>
257-
<InboxItem
258-
isActive={isInboxActive}
259-
onClick={withNavTrack("inbox", navigateToInbox)}
260-
pullRequestCount={inboxPullRequestCount}
261-
/>
262-
</Box>
259+
{!hidden.has("inbox") && (
260+
<Box>
261+
<InboxItem
262+
isActive={isInboxActive}
263+
onClick={withNavTrack("inbox", navigateToInbox)}
264+
pullRequestCount={inboxPullRequestCount}
265+
/>
266+
</Box>
267+
)}
263268

264269
{!hidden.has("agents") && (
265270
<Box>
@@ -343,6 +348,14 @@ export function SidebarNavSection({
343348
onClick={withNavTrack("search", openCommandMenu, true)}
344349
/>
345350
)}
351+
{hidden.has("inbox") && (
352+
<InboxItem
353+
depth={1}
354+
isActive={isInboxActive}
355+
onClick={withNavTrack("inbox", navigateToInbox, true)}
356+
pullRequestCount={inboxPullRequestCount}
357+
/>
358+
)}
346359
{hidden.has("agents") && (
347360
<AgentsItem
348361
depth={1}

‎packages/ui/src/features/sidebar/components/items/InboxItem.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ interface InboxItemProps {
1010
isActive: boolean;
1111
onClick: () => void;
1212
pullRequestCount?: number;
13+
depth?: number;
1314
}
1415

1516
export function InboxItem({
1617
isActive,
1718
onClick,
1819
pullRequestCount = 0,
20+
depth = 0,
1921
}: InboxItemProps) {
2022
return (
2123
<Tooltip
@@ -28,7 +30,7 @@ export function InboxItem({
2830
>
2931
<div>
3032
<SidebarItem
31-
depth={0}
33+
depth={depth}
3234
icon={
3335
<EnvelopeSimple size={16} weight={isActive ? "fill" : "regular"} />
3436
}

‎packages/ui/src/features/sidebar/constants.ts‎

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
11
export const SIDEBAR_MIN_WIDTH = 240;
22

3-
export const MORE_NAV_ITEMS = [
3+
export const CUSTOMIZABLE_NAV_ITEMS = [
44
{ id: "search", label: "Search", defaultVisible: false },
5+
{ id: "inbox", label: "Inbox", defaultVisible: true },
56
{ id: "agents", label: "Agents", defaultVisible: true },
6-
{ id: "skills", label: "Skills", defaultVisible: false },
7-
{ id: "mcp-servers", label: "MCP servers", defaultVisible: false },
7+
{ id: "skills", label: "Skills", defaultVisible: true },
8+
{ id: "mcp-servers", label: "MCP servers", defaultVisible: true },
89
{ id: "usage", label: "Usage", defaultVisible: false },
910
{ id: "command-center", label: "Command Center", defaultVisible: true },
1011
{ id: "contexts", label: "Contexts", defaultVisible: true },
1112
{ id: "activity", label: "Activity", defaultVisible: true },
1213
] as const;
1314

14-
export type MoreNavItemId = (typeof MORE_NAV_ITEMS)[number]["id"];
15+
export type CustomizableNavItemId =
16+
(typeof CUSTOMIZABLE_NAV_ITEMS)[number]["id"];
1517

16-
export const MORE_NAV_ITEM_IDS = MORE_NAV_ITEMS.map((item) => item.id);
18+
export const CUSTOMIZABLE_NAV_ITEM_IDS = CUSTOMIZABLE_NAV_ITEMS.map(
19+
(item) => item.id,
20+
);
1721

18-
export type NavItemOverrides = Partial<Record<MoreNavItemId, boolean>>;
22+
export type NavItemOverrides = Partial<Record<CustomizableNavItemId, boolean>>;
1923

20-
const DEFAULT_VISIBILITY: Record<MoreNavItemId, boolean> = Object.fromEntries(
21-
MORE_NAV_ITEMS.map((item) => [item.id, item.defaultVisible]),
22-
) as Record<MoreNavItemId, boolean>;
24+
const DEFAULT_VISIBILITY: Record<CustomizableNavItemId, boolean> =
25+
Object.fromEntries(
26+
CUSTOMIZABLE_NAV_ITEMS.map((item) => [item.id, item.defaultVisible]),
27+
) as Record<CustomizableNavItemId, boolean>;
2328

2429
export function isNavItemVisible(
2530
overrides: NavItemOverrides,
26-
id: MoreNavItemId,
31+
id: CustomizableNavItemId,
2732
): boolean {
2833
return overrides[id] ?? DEFAULT_VISIBILITY[id];
2934
}
@@ -35,7 +40,7 @@ export function sanitizeNavItemOverrides(value: unknown): NavItemOverrides {
3540
return {};
3641
}
3742
const overrides: NavItemOverrides = {};
38-
for (const id of MORE_NAV_ITEM_IDS) {
43+
for (const id of CUSTOMIZABLE_NAV_ITEM_IDS) {
3944
const entry = (value as Record<string, unknown>)[id];
4045
if (typeof entry === "boolean") overrides[id] = entry;
4146
}

‎packages/ui/src/features/sidebar/sidebarStore.test.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { beforeEach, describe, expect, it } from "vitest";
2-
import { isNavItemVisible, MORE_NAV_ITEMS } from "./constants";
2+
import { CUSTOMIZABLE_NAV_ITEMS, isNavItemVisible } from "./constants";
33
import { useSidebarStore } from "./sidebarStore";
44

55
describe("sidebarStore navItemOverrides", () => {
@@ -8,13 +8,15 @@ describe("sidebarStore navItemOverrides", () => {
88
});
99

1010
it.each(
11-
MORE_NAV_ITEMS.map((item) => [item.id, item.defaultVisible] as const),
11+
CUSTOMIZABLE_NAV_ITEMS.map(
12+
(item) => [item.id, item.defaultVisible] as const,
13+
),
1214
)("%s is visible=%s by default", (id, defaultVisible) => {
1315
const overrides = useSidebarStore.getState().navItemOverrides;
1416
expect(isNavItemVisible(overrides, id)).toBe(defaultVisible);
1517
});
1618

17-
it.each(MORE_NAV_ITEMS.map((item) => item.id))(
19+
it.each(CUSTOMIZABLE_NAV_ITEMS.map((item) => item.id))(
1820
"setNavItemVisible(%s) overrides in both directions",
1921
(id) => {
2022
useSidebarStore.getState().setNavItemVisible(id, true);
@@ -33,7 +35,7 @@ describe("sidebarStore navItemOverrides", () => {
3335
useSidebarStore.getState().setNavItemVisible("agents", false);
3436

3537
const overrides = useSidebarStore.getState().navItemOverrides;
36-
for (const item of MORE_NAV_ITEMS) {
38+
for (const item of CUSTOMIZABLE_NAV_ITEMS) {
3739
if (item.id === "agents") continue;
3840
expect(isNavItemVisible(overrides, item.id)).toBe(item.defaultVisible);
3941
}

‎packages/ui/src/features/sidebar/sidebarStore.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { WorkspaceMode } from "@posthog/shared";
33
import { create } from "zustand";
44
import { persist } from "zustand/middleware";
55
import {
6-
type MoreNavItemId,
6+
type CustomizableNavItemId,
77
type NavItemOverrides,
88
SIDEBAR_MIN_WIDTH,
99
sanitizeNavItemOverrides,
@@ -27,7 +27,7 @@ interface SidebarStoreState {
2727
// the Bluebird chrome ships with channels hidden until the user opts in.
2828
channelsEnabled: boolean;
2929
// Per-item visibility overrides from the Customize sidebar dialog. Items
30-
// absent from the map follow their MORE_NAV_ITEMS defaultVisible, so newly
30+
// absent from the map follow their CUSTOMIZABLE_NAV_ITEMS defaultVisible, so newly
3131
// shipped moreable items keep their intended default for existing users.
3232
navItemOverrides: NavItemOverrides;
3333
}
@@ -50,7 +50,7 @@ interface SidebarStoreActions {
5050
setShowInternal: (showInternal: boolean) => void;
5151
toggleTaskType: (mode: WorkspaceMode) => void;
5252
setChannelsEnabled: (channelsEnabled: boolean) => void;
53-
setNavItemVisible: (item: MoreNavItemId, visible: boolean) => void;
53+
setNavItemVisible: (item: CustomizableNavItemId, visible: boolean) => void;
5454
}
5555

5656
type SidebarStore = SidebarStoreState & SidebarStoreActions;

0 commit comments

Comments
 (0)