:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(desktop): move the spaces destinations into a nav rail (#87050)
Adam Leithb55fc445f7ea
diff --git a/products/desktop/packages/shared/src/analytics-events.ts b/products/desktop/packages/shared/src/analytics-events.tsindex bf0a30d1b133..b933c221b5aa 100644--- a/products/desktop/packages/shared/src/analytics-events.ts+++ b/products/desktop/packages/shared/src/analytics-events.ts@@ -264,6 +264,7 @@ export interface CommandMenuActionProperties {export type SidebarNavItem =| "home"+ | "spaces"| "new_task"| "search"| "inbox"diff --git a/products/desktop/packages/ui/src/features/canvas/components/ActivityDetailPane.tsx b/products/desktop/packages/ui/src/features/canvas/components/ActivityDetailPane.tsxnew file mode 100644index 000000000000..ed4cfe7ad644--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/ActivityDetailPane.tsx@@ -0,0 +1,53 @@+import { BellIcon } from "@phosphor-icons/react";+import {+ Empty,+ EmptyDescription,+ EmptyHeader,+ EmptyMedia,+ EmptyTitle,+} from "@posthog/quill";+import { useChannels } from "@posthog/ui/features/canvas/hooks/useChannels";+import { useActivityDetailStore } from "@posthog/ui/features/canvas/stores/activityDetailStore";+import { TaskDetail } from "@posthog/ui/features/task-detail/components/TaskDetail";+import { useResolvedTask } from "@posthog/ui/features/tasks/useResolvedTask";+import { TaskDetailSkeleton } from "@posthog/ui/router/routeSkeletons";++/** What the Activity destination shows beside its feed. */+export function ActivityDetailPane() {+ const selected = useActivityDetailStore((s) => s.selected);+ const task = useResolvedTask(selected?.taskId);+ const { channels } = useChannels();++ if (!selected) {+ return (+ <div className="flex h-full items-center justify-center">+ <Empty className="border-0">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BellIcon />+ </EmptyMedia>+ <EmptyTitle>Nothing selected</EmptyTitle>+ <EmptyDescription>+ Pick something from the feed to read it here.+ </EmptyDescription>+ </EmptyHeader>+ </Empty>+ </div>+ );+ }++ if (!task) return <TaskDetailSkeleton />;++ const { channelId } = selected;+ const channelName = channels.find((c) => c.id === channelId)?.name;++ return (+ <div className="h-full min-w-0">+ <TaskDetail+ task={task}+ channelName={channelName ?? "Space"}+ channelId={channelId ?? undefined}+ />+ </div>+ );+}diff --git a/products/desktop/packages/ui/src/features/canvas/components/ActivityHoverCard.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/ActivityFeedList.test.tsxsimilarity index 93%rename from products/desktop/packages/ui/src/features/canvas/components/ActivityHoverCard.test.tsxrename to products/desktop/packages/ui/src/features/canvas/components/ActivityFeedList.test.tsxindex 8de7958ae177..44a455c3ac49 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ActivityHoverCard.test.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ActivityFeedList.test.tsx@@ -12,6 +12,7 @@ const mocks = vi.hoisted(() => ({}));vi.mock("@posthog/quill", () => ({+ cn: (...args: unknown[]) => args.filter(Boolean).join(" "),Button: ({ children }: { children: ReactNode }) => (<button type="button">{children}</button>),@@ -90,9 +91,9 @@ vi.mock("@posthog/ui/primitives/hooks/useInView", () => ({vi.mock("@posthog/ui/shell/analytics", () => ({ track: vi.fn() }));import { useActivityFilterStore } from "@posthog/ui/features/canvas/stores/activityFilterStore";-import { ActivityHoverCard } from "./ActivityHoverCard";+import { ActivityFeedList } from "./ActivityFeedList";-describe("ActivityHoverCard", () => {+describe("ActivityFeedList", () => {beforeEach(() => {vi.clearAllMocks();mocks.hasNextPage = true;@@ -102,14 +103,14 @@ describe("ActivityHoverCard", () => {});it("loads the next page when the bottom sentinel is visible", async () => {- render(<ActivityHoverCard onClose={vi.fn()} />);+ render(<ActivityFeedList />);await waitFor(() => expect(mocks.fetchNextPage).toHaveBeenCalledOnce());});it("does not load when there is no next page", async () => {mocks.hasNextPage = false;- render(<ActivityHoverCard onClose={vi.fn()} />);+ render(<ActivityFeedList />);await waitFor(() => expect(mocks.fetchNextPage).not.toHaveBeenCalled());});@@ -126,7 +127,7 @@ describe("ActivityHoverCard", () => {} as TaskActivityItem,];- render(<ActivityHoverCard onClose={vi.fn()} />);+ render(<ActivityFeedList />);fireEvent.click(screen.getByText("Activity row"));expect(mocks.markRead).toHaveBeenCalledWith([@@ -156,7 +157,7 @@ describe("ActivityHoverCard", () => {} as TaskActivityItem,];- render(<ActivityHoverCard onClose={vi.fn()} />);+ render(<ActivityFeedList />);expect(screen.getAllByText("Activity row")).toHaveLength(2);fireEvent.click(screen.getByRole("switch"));diff --git a/products/desktop/packages/ui/src/features/canvas/components/ActivityFeedList.tsx b/products/desktop/packages/ui/src/features/canvas/components/ActivityFeedList.tsxnew file mode 100644index 000000000000..a3cb84c8a51d--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/ActivityFeedList.tsx@@ -0,0 +1,158 @@+import { BellIcon, ChecksIcon } from "@phosphor-icons/react";+import type { TaskActivityItem } from "@posthog/core/canvas/taskActivity";+import {+ Button,+ cn,+ Empty,+ EmptyDescription,+ EmptyHeader,+ EmptyMedia,+ EmptyTitle,+ Spinner,+} from "@posthog/quill";+import { ANALYTICS_EVENTS } from "@posthog/shared/analytics-events";+import { useOptionalAuthenticatedClient } from "@posthog/ui/features/auth/authClient";+import { useCurrentUser } from "@posthog/ui/features/auth/useCurrentUser";+import { ActivityUnreadsToggle } from "@posthog/ui/features/canvas/components/ActivityUnreadsToggle";+import { ActivityRow } from "@posthog/ui/features/canvas/components/ActivityView";+import { openActivityItem } from "@posthog/ui/features/canvas/components/openActivityItem";+import { useBlockedTaskIds } from "@posthog/ui/features/canvas/hooks/useBlockedSessionCount";+import { useMarkTaskActivityRead } from "@posthog/ui/features/canvas/hooks/useMarkTaskActivityRead";+import { useTaskActivity } from "@posthog/ui/features/canvas/hooks/useTaskActivity";+import { useActivityFilterStore } from "@posthog/ui/features/canvas/stores/activityFilterStore";+import { useInView } from "@posthog/ui/primitives/hooks/useInView";+import { track } from "@posthog/ui/shell/analytics";+import { useEffect, useState } from "react";+import {+ activityReadPayload,+ getUnreadActivityItems,+ markLoadedReadLabel,+} from "./activityFeed";++interface ActivityFeedListProps {+ onActivate?: (item: TaskActivityItem) => void;+ onOpened?: () => void;+ selectedId?: string;+ className?: string;+}++/** The feed's header and scrolling list, drawn by both the rail's pane and the+ * code layout's hover card. */+export function ActivityFeedList({+ onActivate = openActivityItem,+ onOpened,+ selectedId,+ className,+}: ActivityFeedListProps) {+ const client = useOptionalAuthenticatedClient();+ const { data: currentUser } = useCurrentUser({ client });+ const {+ items,+ unreadCount,+ isLoading,+ hasNextPage,+ isFetchingNextPage,+ fetchNextPage,+ } = useTaskActivity();+ // Selected once for the feed, not once per row.+ const blockedTaskIds = useBlockedTaskIds();+ const [scrollRoot, setScrollRoot] = useState<HTMLDivElement | null>(null);+ const [loadMoreRef, loadMoreInView] = useInView<HTMLDivElement>({+ root: scrollRoot,+ rootMargin: "100px 0px",+ });+ const unreadsOnly = useActivityFilterStore((state) => state.unreadsOnly);+ const unreadItems = getUnreadActivityItems(items);+ const shownItems = unreadsOnly ? unreadItems : items;+ const { mutate: markTasksRead, isPending: isMarkingRead } =+ useMarkTaskActivityRead();+ useEffect(() => {+ track(ANALYTICS_EVENTS.CHANNEL_ACTION, {+ action_type: "view_activity",+ surface: "activity_panel",+ });+ }, []);+ useEffect(() => {+ if (loadMoreInView && hasNextPage) {+ void fetchNextPage();+ }+ }, [fetchNextPage, hasNextPage, loadMoreInView]);++ const markRead = (item: (typeof items)[number]) => {+ markTasksRead(activityReadPayload([item]));+ };++ const markAllRead = () => {+ markTasksRead(activityReadPayload(unreadItems));+ };++ return (+ <div className={cn("flex min-h-0 flex-col", className)}>+ <div className="flex h-10 shrink-0 items-center gap-2 border-border border-b pr-2 pl-3">+ <span className="font-bold text-base">Activity</span>+ <div className="ml-auto flex shrink-0 items-center gap-1">+ {unreadItems.length > 0 && (+ <Button+ variant="default"+ size="sm"+ loading={isMarkingRead}+ disabled={isMarkingRead}+ onClick={markAllRead}+ >+ <ChecksIcon size={14} />+ {markLoadedReadLabel(unreadItems.length, unreadCount)}+ </Button>+ )}+ <ActivityUnreadsToggle />+ </div>+ </div>+ <div ref={setScrollRoot} className="min-h-0 flex-1 overflow-y-auto p-1.5">+ {isLoading && shownItems.length === 0 ? (+ <div className="flex justify-center py-10">+ <Spinner />+ </div>+ ) : shownItems.length === 0 ? (+ <Empty className="border-0 py-8">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BellIcon />+ </EmptyMedia>+ <EmptyTitle>+ {unreadsOnly ? "No unread activity" : "No recent activity"}+ </EmptyTitle>+ <EmptyDescription>+ {unreadsOnly+ ? "You're all caught up."+ : "New task updates will appear here."}+ </EmptyDescription>+ </EmptyHeader>+ </Empty>+ ) : (+ <div className="flex flex-col gap-px">+ {shownItems.map((item) => (+ <ActivityRow+ key={item.id}+ item={item}+ channelId={item.channelId}+ onOpen={markRead}+ onMarkRead={markRead}+ currentUser={currentUser}+ blockedTaskIds={blockedTaskIds}+ surface="activity_panel"+ onActivate={(activated) => {+ onActivate(activated);+ onOpened?.();+ }}+ isSelected={item.id === selectedId}+ compact+ />+ ))}+ </div>+ )}+ <div ref={loadMoreRef} className="flex h-8 justify-center py-2">+ {hasNextPage && isFetchingNextPage && <Spinner />}+ </div>+ </div>+ </div>+ );+}diff --git a/products/desktop/packages/ui/src/features/canvas/components/ActivityHoverCard.tsx b/products/desktop/packages/ui/src/features/canvas/components/ActivityHoverCard.tsxindex 992af0fbc9c7..f0520a84aa47 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ActivityHoverCard.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ActivityHoverCard.tsx@@ -1,31 +1,5 @@-import { BellIcon, ChecksIcon } from "@phosphor-icons/react";-import {- Button,- Empty,- EmptyDescription,- EmptyHeader,- EmptyMedia,- EmptyTitle,- PopoverContent,- Spinner,-} from "@posthog/quill";-import { ANALYTICS_EVENTS } from "@posthog/shared/analytics-events";-import { useOptionalAuthenticatedClient } from "@posthog/ui/features/auth/authClient";-import { useCurrentUser } from "@posthog/ui/features/auth/useCurrentUser";-import { ActivityUnreadsToggle } from "@posthog/ui/features/canvas/components/ActivityUnreadsToggle";-import { ActivityRow } from "@posthog/ui/features/canvas/components/ActivityView";-import { useBlockedTaskIds } from "@posthog/ui/features/canvas/hooks/useBlockedSessionCount";-import { useMarkTaskActivityRead } from "@posthog/ui/features/canvas/hooks/useMarkTaskActivityRead";-import { useTaskActivity } from "@posthog/ui/features/canvas/hooks/useTaskActivity";-import { useActivityFilterStore } from "@posthog/ui/features/canvas/stores/activityFilterStore";-import { useInView } from "@posthog/ui/primitives/hooks/useInView";-import { track } from "@posthog/ui/shell/analytics";-import { useEffect, useState } from "react";-import {- activityReadPayload,- getUnreadActivityItems,- markLoadedReadLabel,-} from "./activityFeed";+import { PopoverContent } from "@posthog/quill";+import { ActivityFeedList } from "@posthog/ui/features/canvas/components/ActivityFeedList";interface ActivityHoverCardProps {onClose: () => void;@@ -36,117 +10,14 @@ export function ActivityHoverCard({onClose,side = "right",}: ActivityHoverCardProps) {- const client = useOptionalAuthenticatedClient();- const { data: currentUser } = useCurrentUser({ client });- const {- items,- unreadCount,- isLoading,- hasNextPage,- isFetchingNextPage,- fetchNextPage,- } = useTaskActivity();- // Selected once for the feed, not once per row.- const blockedTaskIds = useBlockedTaskIds();- const [scrollRoot, setScrollRoot] = useState<HTMLDivElement | null>(null);- const [loadMoreRef, loadMoreInView] = useInView<HTMLDivElement>({- root: scrollRoot,- rootMargin: "100px 0px",- });- const unreadsOnly = useActivityFilterStore((state) => state.unreadsOnly);- const visibleItems = items;- const unreadItems = getUnreadActivityItems(visibleItems);- const shownItems = unreadsOnly ? unreadItems : visibleItems;- const { mutate: markTasksRead, isPending: isMarkingRead } =- useMarkTaskActivityRead();- useEffect(() => {- track(ANALYTICS_EVENTS.CHANNEL_ACTION, {- action_type: "view_activity",- surface: "activity_panel",- });- }, []);- useEffect(() => {- if (loadMoreInView && hasNextPage) {- void fetchNextPage();- }- }, [fetchNextPage, hasNextPage, loadMoreInView]);-- const markRead = (item: (typeof items)[number]) => {- markTasksRead(activityReadPayload([item]));- };-- const markAllRead = () => {- markTasksRead(activityReadPayload(unreadItems));- };-return (<PopoverContentside={side}align="start"sideOffset={8}- className="w-[380px] gap-0 overflow-hidden p-0"+ className="max-h-[520px] w-[380px] gap-0 overflow-hidden p-0">- <div className="flex min-h-12 items-center gap-2 border-border border-b px-3">- <span className="font-semibold text-sm">Activity</span>- <div className="ml-auto flex shrink-0 items-center gap-2">- {unreadItems.length > 0 && (- <Button- variant="default"- size="sm"- loading={isMarkingRead}- disabled={isMarkingRead}- onClick={markAllRead}- >- <ChecksIcon size={14} />- {markLoadedReadLabel(unreadItems.length, unreadCount)}- </Button>- )}- <ActivityUnreadsToggle />- </div>- </div>- <div ref={setScrollRoot} className="max-h-[480px] overflow-y-auto p-1.5">- {isLoading && shownItems.length === 0 ? (- <div className="flex justify-center py-10">- <Spinner />- </div>- ) : shownItems.length === 0 ? (- <Empty className="border-0 py-8">- <EmptyHeader>- <EmptyMedia variant="icon">- <BellIcon />- </EmptyMedia>- <EmptyTitle>- {unreadsOnly ? "No unread activity" : "No recent activity"}- </EmptyTitle>- <EmptyDescription>- {unreadsOnly- ? "You're all caught up."- : "New task updates will appear here."}- </EmptyDescription>- </EmptyHeader>- </Empty>- ) : (- <div className="flex flex-col gap-0.5">- {shownItems.map((item) => (- <ActivityRow- key={item.id}- item={item}- channelId={item.channelId}- onOpen={markRead}- onMarkRead={markRead}- currentUser={currentUser}- blockedTaskIds={blockedTaskIds}- surface="activity_panel"- onNavigate={onClose}- compact- />- ))}- </div>- )}- <div ref={loadMoreRef} className="flex h-8 justify-center py-2">- {hasNextPage && isFetchingNextPage && <Spinner />}- </div>- </div>+ <ActivityFeedList onOpened={onClose} className="max-h-[520px]" /></PopoverContent>);}diff --git a/products/desktop/packages/ui/src/features/canvas/components/ActivityView.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/ActivityView.test.tsxindex 9f8993ea0b8f..9f6b7e4924f2 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ActivityView.test.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ActivityView.test.tsx@@ -18,6 +18,7 @@ vi.mock("@posthog/ui/shell/analytics", () => ({ track: vi.fn() }));import { useCommentNavigationStore } from "@posthog/ui/features/sessions/commentNavigationStore";import { ActivityRow } from "./ActivityView";import { activityHeadline } from "./activityHeadline";+import { openActivityItem } from "./openActivityItem";function item(overrides: Partial<TaskActivityItem>): TaskActivityItem {return {@@ -137,6 +138,7 @@ describe("activityHeadline", () => {channelId="channel-1"onOpen={vi.fn()}onMarkRead={vi.fn()}+ onActivate={openActivityItem}blockedTaskIds={NO_BLOCKED_TASKS}/>,);diff --git a/products/desktop/packages/ui/src/features/canvas/components/ActivityView.tsx b/products/desktop/packages/ui/src/features/canvas/components/ActivityView.tsxindex 291226cbc582..d7ba26031b3f 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ActivityView.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ActivityView.tsx@@ -26,13 +26,12 @@ import { UserAvatar } from "@posthog/ui/features/auth/UserAvatar";import { useCurrentUser } from "@posthog/ui/features/auth/useCurrentUser";import { ActivityUnreadsToggle } from "@posthog/ui/features/canvas/components/ActivityUnreadsToggle";import { MentionText } from "@posthog/ui/features/canvas/components/MentionText";+import { openActivityItem } from "@posthog/ui/features/canvas/components/openActivityItem";import { useBlockedTaskIds } from "@posthog/ui/features/canvas/hooks/useBlockedSessionCount";import { useChannelsLayout } from "@posthog/ui/features/canvas/hooks/useChannelsLayout";import { useMarkTaskActivityRead } from "@posthog/ui/features/canvas/hooks/useMarkTaskActivityRead";import { useTaskActivity } from "@posthog/ui/features/canvas/hooks/useTaskActivity";import { useActivityFilterStore } from "@posthog/ui/features/canvas/stores/activityFilterStore";-import { useCanvasChatPanelStore } from "@posthog/ui/features/canvas/stores/canvasChatPanelStore";-import { useThreadPanelStore } from "@posthog/ui/features/canvas/stores/threadPanelStore";import { copyChannelLink } from "@posthog/ui/features/canvas/utils/copyChannelLink";import { useCommentNavigationStore } from "@posthog/ui/features/sessions/commentNavigationStore";import { DOT_TONE_VAR } from "@posthog/ui/features/sidebar/components/items/taskStatusVocabulary";@@ -45,11 +44,6 @@ import {PageHeaderTitle,PageHeaderTitleRow,} from "@posthog/ui/primitives/PageHeader";-import {- navigateToChannelDashboard,- navigateToChannelTask,- navigateToTaskDetail,-} from "@posthog/ui/router/navigationBridge";import { track } from "@posthog/ui/shell/analytics";import { Text } from "@radix-ui/themes";import { useCallback, useEffect, useMemo } from "react";@@ -68,7 +62,8 @@ export function ActivityRow({currentUser,blockedTaskIds,surface = "activity",- onNavigate,+ onActivate,+ isSelected = false,compact = false,}: {item: TaskActivityItem;@@ -84,7 +79,9 @@ export function ActivityRow({*/blockedTaskIds: ReadonlySet<string>;surface?: "activity" | "activity_panel";- onNavigate?: () => void;+ /** Where the row goes is the feed's business, not the row's. */+ onActivate: (item: TaskActivityItem) => void;+ isSelected?: boolean;compact?: boolean;}) {const isAgentActivity =@@ -114,30 +111,16 @@ export function ActivityRow({.getState().requestCommentFocus(item.taskId, item.commentTarget, item.commentId);}- onNavigate?.();- if (channelId && item.commentTarget?.scope === "desktop_canvas") {- useCanvasChatPanelStore.getState().openComments();- navigateToChannelDashboard(channelId, item.commentTarget.itemId);- return;- }- // The channel thread route is the deep-link target; unfiled tasks fall- // back to the plain task view.- if (channelId) {- if (item.commentId) {- useThreadPanelStore.getState().setCollapsed(false);- }- navigateToChannelTask(channelId, item.taskId);- } else {- navigateToTaskDetail(item.taskId);- }+ onActivate(item);};return (<div className="group relative">- <button+ <Buttontype="button"onClick={openTask}- className={`flex w-full gap-2 rounded-md px-2 text-left transition-colors hover:bg-fill-hover ${compact ? "py-1.5 pr-14" : "py-2"} ${item.isUnread ? "bg-fill-secondary" : ""}`}+ left+ className={`h-auto w-full text-left ${compact ? "py-1.5 pr-10" : "py-2"} ${isSelected ? "bg-fill-selected" : item.isUnread ? "bg-primary/10 outline outline-primary/20 hover:bg-primary/15" : ""}`}><span className="relative mt-0.5 shrink-0">{isAgentActivity ? (@@ -182,9 +165,9 @@ export function ActivityRow({</Text>)}</span>- <Text size="1" className="block truncate text-muted-foreground">+ <span className="block truncate text-muted-foreground text-xs">{item.taskTitle}- </Text>+ </span>{item.snippet && !compact && (<MentionTextcontent={item.snippet}@@ -193,11 +176,11 @@ export function ActivityRow({/>)}</span>- </button>+ </Button>{compact && (<Textsize="1"- className="pointer-events-none absolute top-1.5 right-2 text-muted-foreground"+ className="pointer-events-none absolute top-1.5 right-2 text-muted-foreground text-xs">{formatRelativeTimeShort(item.activityAt)}</Text>@@ -345,6 +328,7 @@ export function ActivityView() {channelId={item.channelId}onOpen={markRead}onMarkRead={markRead}+ onActivate={openActivityItem}currentUser={currentUser}blockedTaskIds={blockedTaskIds}/>diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelBackRow.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelBackRow.tsxindex 4427fbf88e1d..ea148d6ba5e9 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelBackRow.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelBackRow.tsx@@ -1,4 +1,4 @@-import { CaretLeftIcon, StarIcon } from "@phosphor-icons/react";+import { StarIcon, XIcon } from "@phosphor-icons/react";import {Button,cn,@@ -42,7 +42,7 @@ function RowStar({ channel }: { channel: Channel }) {}}// Parks in the row's reserved well: 8px padding + 3px gap = 11px from the// right edge.- className="-translate-y-1/2 absolute top-1/2 right-[3px] text-muted-foreground"+ className="-translate-y-1/2 absolute top-1/2 right-2 text-muted-foreground"><StarIcon size={14} weight={isStarred ? "fill" : "regular"} /></Button>@@ -69,7 +69,7 @@ export function ChannelBackRow({ channelId }: { channelId: string }) {});return (- <div className="relative mx-2 mt-1">+ <div className="relative h-10 border-border border-b px-1.5 pt-1.5 pb-2"><Tooltip><TooltipTriggerrender={@@ -97,9 +97,13 @@ export function ChannelBackRow({ channelId }: { channelId: string }) {showStar && "pr-8",)}>- <CaretLeftIcon- size={12}- className="shrink-0 text-muted-foreground"+ {/* The way out of a space, in the brand's own colour: a muted+ caret read as decoration on a header rather than the control+ it is, and people could not find their way back to the list. */}+ <XIcon+ size={14}+ weight="bold"+ className="shrink-0 text-primary"/>{/* Only #me still has a glyph under the layout, and its well isdrawn only when there's something in it — an empty 16px column@@ -141,7 +145,7 @@ export function ChannelBackRow({ channelId }: { channelId: string }) {</Button>}/>- <TooltipContent side="bottom">Go back</TooltipContent>+ <TooltipContent side="bottom">Back to spaces</TooltipContent></Tooltip>{/* #me can't be starred, so its well stays empty — a greyed-out star readas a control you were being denied. The well itself is unconditionaldiff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelNav.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelNav.test.tsxdeleted file mode 100644index ac9ca806104a..000000000000--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelNav.test.tsx+++ /dev/null@@ -1,159 +0,0 @@-import { render, screen, waitFor } from "@testing-library/react";-import userEvent from "@testing-library/user-event";-import { beforeEach, describe, expect, it, vi } from "vitest";--const mocks = vi.hoisted(() => ({- view: { type: "task-input" },-}));--vi.mock("@posthog/ui/features/canvas/hooks/useTaskActivity", () => ({- useTaskActivity: () => ({ unreadCount: 1 }),-}));-vi.mock(- "@posthog/ui/features/command-center/useCommandCenterActiveCount",- () => ({ useCommandCenterActiveCount: () => 0 }),-);-vi.mock("@posthog/ui/features/feature-flags/useFeatureFlag", () => ({- useFeatureFlag: () => false,-}));-vi.mock("@posthog/ui/features/inbox/hooks/useInboxAllReports", () => ({- useInboxAllReports: () => ({ counts: { pulls: 0 } }),-}));-vi.mock("@posthog/ui/router/useAppView", () => ({- useAppView: () => mocks.view,-}));-vi.mock("@posthog/ui/router/navigationBridge", () => ({- navigateToActivity: vi.fn(),- navigateToHome: vi.fn(),- navigateToInbox: vi.fn(),- navigateToLoops: vi.fn(),- navigateToWebsiteCommandCenter: vi.fn(),-}));-vi.mock("@posthog/ui/shell/analytics", () => ({ track: vi.fn() }));-vi.mock("./ActivityHoverCard", () => ({- ActivityHoverCard: () => <div>Recent activity card</div>,-}));--import { useSidebarStore } from "@posthog/ui/features/sidebar/sidebarStore";-import { ChannelNav } from "./ChannelNav";--const navLabels = (container: HTMLElement) =>- [...container.querySelectorAll("button")].map((button) =>- button.getAttribute("aria-label"),- );--describe("ChannelNav", () => {- beforeEach(() => {- mocks.view = { type: "task-input" };- useSidebarStore.setState({ navItemOverrides: {}, navItemOrder: [] });- });-- it("keeps Inbox available in the channels navigation", () => {- render(<ChannelNav />);-- expect(screen.getByLabelText("Inbox")).toBeEnabled();- });-- it("drops an item hidden in the sidebar settings", () => {- useSidebarStore.setState({ navItemOverrides: { "command-center": false } });-- render(<ChannelNav />);-- expect(screen.queryByLabelText("Command Center")).not.toBeInTheDocument();- expect(screen.getByLabelText("Inbox")).toBeInTheDocument();- });-- it("follows the order stored by the sidebar settings, after Home", () => {- useSidebarStore.setState({ navItemOrder: ["configure", "inbox"] });-- const { container } = render(<ChannelNav />);-- expect(navLabels(container)).toEqual([- "Home",- "Settings",- "Inbox",- "Activity",- "Command Center",- ]);- });-- it("opens recent activity from the bell after the hover delay", async () => {- const user = userEvent.setup();- render(<ChannelNav />);-- await user.hover(screen.getByLabelText("Activity"));- expect(screen.queryByText("Recent activity card")).not.toBeInTheDocument();-- expect(- await screen.findByText("Recent activity card", {}, { timeout: 1_000 }),- ).toBeInTheDocument();- });-- it("closes promptly after the pointer leaves", async () => {- const user = userEvent.setup();- render(<ChannelNav />);- const activity = screen.getByLabelText("Activity");-- await user.hover(activity);- await screen.findByText("Recent activity card", {}, { timeout: 1_000 });- await user.unhover(activity);-- await waitFor(() =>- expect(- screen.queryByText("Recent activity card"),- ).not.toBeInTheDocument(),- );- });-- it("does not open the hover card on the Activity page", async () => {- mocks.view = { type: "activity" };- const user = userEvent.setup();- render(<ChannelNav />);-- const activity = screen.getByLabelText("Activity");- expect(activity).toBeEnabled();- expect(activity).not.toHaveAttribute("aria-haspopup");- await user.hover(activity);-- await new Promise((resolve) => setTimeout(resolve, 400));- expect(screen.queryByText("Recent activity card")).not.toBeInTheDocument();- });-- it("leaves no popover state on the bell after it navigates to Activity", async () => {- const user = userEvent.setup();- const { rerender } = render(<ChannelNav />);- const bell = () => screen.getByLabelText("Activity");-- await user.hover(bell());- await screen.findByText("Recent activity card", {}, { timeout: 1_000 });- await user.click(bell());- mocks.view = { type: "activity" };- rerender(<ChannelNav />);-- expect(screen.queryByText("Recent activity card")).not.toBeInTheDocument();- expect(bell()).not.toHaveAttribute("data-popup-open");- expect(bell()).not.toHaveAttribute("data-pressed");- });-- it("neither resurfaces nor wedges the hover card once the bell has navigated", async () => {- const user = userEvent.setup();- const { rerender } = render(<ChannelNav />);- const bell = () => screen.getByLabelText("Activity");-- await user.hover(bell());- await user.click(bell());- mocks.view = { type: "activity" };- rerender(<ChannelNav />);- await user.unhover(bell());-- mocks.view = { type: "task-detail" };- rerender(<ChannelNav />);- await new Promise((resolve) => setTimeout(resolve, 400));- expect(screen.queryByText("Recent activity card")).not.toBeInTheDocument();-- await user.hover(bell());- expect(- await screen.findByText("Recent activity card", {}, { timeout: 1_000 }),- ).toBeInTheDocument();- });-});diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelNav.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelNav.tsxdeleted file mode 100644index 76f55b9463df..000000000000--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelNav.tsx+++ /dev/null@@ -1,311 +0,0 @@-import {- BellIcon,- EnvelopeSimple,- GearSix,- HouseSimple,- Lightning,-} from "@phosphor-icons/react";-import {- Button,- cn,- Kbd,- Popover,- PopoverTrigger,- Tooltip,- TooltipContent,- TooltipProvider,- TooltipTrigger,-} from "@posthog/quill";-import { LOOPS_FLAG } from "@posthog/shared";-import {- ANALYTICS_EVENTS,- type SidebarNavItem,-} from "@posthog/shared/analytics-events";-import { useTaskActivity } from "@posthog/ui/features/canvas/hooks/useTaskActivity";-import {- formatHotkey,- SHORTCUTS,-} from "@posthog/ui/features/command/keyboard-shortcuts";-import { useCommandCenterActiveCount } from "@posthog/ui/features/command-center/useCommandCenterActiveCount";-import { useFeatureFlag } from "@posthog/ui/features/feature-flags/useFeatureFlag";-import { useInboxAllReports } from "@posthog/ui/features/inbox/hooks/useInboxAllReports";-import { openSettings } from "@posthog/ui/features/settings/hooks/useOpenSettings";-import {- type CustomizableNavItemId,- isNavItemVisible,- orderedNavItems,-} from "@posthog/ui/features/sidebar/constants";-import { useSidebarStore } from "@posthog/ui/features/sidebar/sidebarStore";-import { CountBadge } from "@posthog/ui/primitives/CountBadge";-import { LoopIcon } from "@posthog/ui/primitives/LoopIcon";-import {- navigateToActivity,- navigateToHome,- navigateToInbox,- navigateToLoops,- navigateToWebsiteCommandCenter,-} from "@posthog/ui/router/navigationBridge";-import { useAppView } from "@posthog/ui/router/useAppView";-import { track } from "@posthog/ui/shell/analytics";-import {- type ComponentPropsWithRef,- Fragment,- type ReactElement,- type ReactNode,- useState,-} from "react";-import { ActivityHoverCard } from "./ActivityHoverCard";--const INBOX_REFETCH_INTERVAL_MS = 60_000;--const ICON_BADGE_CLASS =- "-top-1 -right-1 absolute h-3.5 min-w-3.5 w-auto px-1 font-semibold text-[9px] ring-2 ring-chrome";--function NavIcon({- icon,- label,- shortcut,- isActive,- onClick,- badge,-}: {- icon: ReactNode;- label: string;- shortcut?: string;- isActive: boolean;- onClick: () => void;- badge?: ReactNode;-}) {- return (- <Tooltip>- {/* quill's Button, with the sidebar's selected-row treatment — the same- `data-selected` pairing the channel rows use, so the nav and the list- below it read as one control set in either theme. `relative` is for- the count badge, which pins to the button's corner. */}- <TooltipTrigger- render={- <Button- variant="default"- size="icon"- aria-label={label}- data-selected={isActive || undefined}- onClick={onClick}- className="group relative shrink-0 text-muted-foreground data-selected:bg-fill-selected data-selected:text-foreground"- >- {icon}- {badge}- </Button>- }- />- <TooltipContent side="bottom">- {label}- {shortcut && <Kbd className="ml-1.5">{shortcut}</Kbd>}- </TooltipContent>- </Tooltip>- );-}--interface NavButtonProps extends ComponentPropsWithRef<"button"> {- icon: ReactNode;- label: string;- isActive: boolean;- badge?: ReactNode;-}--// Same quill Button as NavIcon above — this variant only exists because the-// Activity entry is a Popover trigger, so it needs to forward the trigger's-// props and ref. Hand-rolling the button here left it a size larger than its-// neighbours.-function NavButton({- icon,- label,- isActive,- onClick,- badge,- className,- ref,- ...buttonProps-}: NavButtonProps) {- return (- <Button- {...buttonProps}- ref={ref}- type="button"- variant="default"- size="icon"- aria-label={label}- data-selected={isActive || undefined}- onClick={onClick}- className={cn(- "relative shrink-0 text-muted-foreground data-selected:bg-fill-selected data-selected:text-foreground",- className,- )}- >- {icon}- {badge}- </Button>- );-}--function ActivityHoverPopover({ trigger }: { trigger: ReactElement }) {- const [open, setOpen] = useState(false);-- return (- <Popover open={open} onOpenChange={setOpen}>- <PopoverTrigger- openOnHover- delay={300}- closeDelay={100}- onClick={(event) => event.preventBaseUIHandler()}- render={trigger}- />- {open && (- <ActivityHoverCard side="bottom" onClose={() => setOpen(false)} />- )}- </Popover>- );-}--function ActivityNavItem({- isActive,- unreadCount,- onNavigate,-}: {- isActive: boolean;- unreadCount: number;- onNavigate: () => void;-}) {- const bell = (- <NavButton- icon={<BellIcon size={16} weight={isActive ? "fill" : "regular"} />}- label="Activity"- isActive={isActive}- onClick={onNavigate}- badge={<CountBadge count={unreadCount} className={ICON_BADGE_CLASS} />}- />- );-- if (isActive) return bell;- return <ActivityHoverPopover trigger={bell} />;-}--export function ChannelNav() {- const view = useAppView();- const loopsEnabled = useFeatureFlag(LOOPS_FLAG, import.meta.env.DEV);-- const { counts } = useInboxAllReports({- ignoreFilters: true,- refetchIntervalMs: INBOX_REFETCH_INTERVAL_MS,- });- const { unreadCount: unseenActivity } = useTaskActivity();- const commandCenterCount = useCommandCenterActiveCount();- const navItemOverrides = useSidebarStore((s) => s.navItemOverrides);- const navItemOrder = useSidebarStore((s) => s.navItemOrder);-- const withTrack = (item: SidebarNavItem, action: () => void) => () => {- track(ANALYTICS_EVENTS.SIDEBAR_NAV_ITEM_CLICKED, {- item,- in_more: false,- layout: "channels",- });- action();- };-- const isHome = view.type === "home";- const isInbox = view.type === "inbox";- const isActivity = view.type === "activity";- const isCommandCenter = view.type === "command-center";- const isLoops = view.type === "loops";-- // Bluebird is already on wherever this nav renders, so Activity needs no- // second gate here — unlike the code layout's SidebarNavSection.- const navItemAvailable: Record<CustomizableNavItemId, boolean> = {- inbox: true,- activity: true,- "command-center": true,- loops: loopsEnabled,- configure: true,- };-- const renderNavItem: Record<CustomizableNavItemId, () => ReactNode> = {- inbox: () => (- <NavIcon- icon={- <EnvelopeSimple size={16} weight={isInbox ? "fill" : "regular"} />- }- label="Inbox"- shortcut={formatHotkey(SHORTCUTS.INBOX)}- isActive={isInbox}- onClick={withTrack("inbox", navigateToInbox)}- badge={<CountBadge count={counts.pulls} className={ICON_BADGE_CLASS} />}- />- ),- activity: () => (- <ActivityNavItem- isActive={isActivity}- unreadCount={unseenActivity}- onNavigate={withTrack("activity", navigateToActivity)}- />- ),- "command-center": () => (- <NavIcon- icon={- <Lightning size={16} weight={isCommandCenter ? "fill" : "regular"} />- }- label="Command Center"- isActive={isCommandCenter}- onClick={withTrack("command_center", navigateToWebsiteCommandCenter)}- badge={- <CountBadge- count={commandCenterCount}- tone="neutral"- className={ICON_BADGE_CLASS}- />- }- />- ),- loops: () => (- <NavIcon- icon={<LoopIcon size={16} weight={isLoops ? "fill" : "regular"} />}- label="Loops"- isActive={isLoops}- onClick={withTrack("loops", navigateToLoops)}- />- ),- configure: () => (- <NavIcon- icon={<GearSix size={16} />}- label="Settings"- isActive={false}- onClick={withTrack("configure", () => openSettings())}- />- ),- };-- const items = orderedNavItems(navItemOrder).filter(- ({ id }) => navItemAvailable[id] && isNavItemVisible(navItemOverrides, id),- );-- return (- // One provider for the row: once any tooltip is up, moving to its- // neighbour reveals that one immediately instead of serving the warm-up- // delay again. Per-tooltip providers (the old primitive mounted its own)- // cannot do that — the skip window is provider state, and isolated- // providers never share it.- <TooltipProvider delay={400}>- <div className="flex shrink-0 gap-2 p-2">- {/* Home is the space's own root rather than one of the customizable- destinations, so it stays first and is never hidden. */}- <NavIcon- icon={<HouseSimple size={16} weight={isHome ? "fill" : "regular"} />}- label="Home"- isActive={isHome}- onClick={withTrack("home", navigateToHome)}- />- {items.map(({ id }) => (- <Fragment key={id}>{renderNavItem[id]()}</Fragment>- ))}- </div>- </TooltipProvider>- );-}diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelRouteSync.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelRouteSync.tsxnew file mode 100644index 000000000000..094c084104a6--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelRouteSync.tsx@@ -0,0 +1,65 @@+import { useChannelsLayout } from "@posthog/ui/features/canvas/hooks/useChannelsLayout";+import { useCurrentChannel } from "@posthog/ui/features/canvas/hooks/useCurrentChannel";+import {+ clearKeepListForRoute,+ shouldKeepListForRoute,+ showChannelPane,+} from "@posthog/ui/features/canvas/stores/channelPaneStore";+import { useCurrentChannelStore } from "@posthog/ui/features/canvas/stores/currentChannelStore";+import { useParams } from "@tanstack/react-router";+import { useEffect, useRef } from "react";++/**+ * Renders nothing — owns which space the app is scoped to. Lives outside the+ * sidebar because the rail can take that column away, and the scoping still+ * has to happen.+ */+export function ChannelRouteSync() {+ const channelsLayout = useChannelsLayout();+ const routeChannelId = useParams({ strict: false }).channelId;+ const setCurrentChannel = useCurrentChannelStore((s) => s.setCurrentChannel);+ const { currentChannelId, channels } = useCurrentChannel({+ enabled: channelsLayout,+ });++ useEffect(() => {+ if (!channelsLayout) return;+ // A route with no channel ends the navigation the latch was armed for. Left+ // set, it would hold a later deep link to that channel on the list.+ if (!routeChannelId) {+ clearKeepListForRoute();+ return;+ }+ setCurrentChannel(routeChannelId);+ // Landing on a channel — a deep link, a mention, ⌘1-9 — is a request to see+ // it, so the slider follows the route even if the list was being browsed.+ // Unless the navigation said otherwise: opening a session from the list's+ // tree loads it without taking the tree off the screen.+ if (!shouldKeepListForRoute(routeChannelId)) showChannelPane();+ }, [channelsLayout, routeChannelId, setCurrentChannel]);++ const autoScopedRef = useRef(false);+ useEffect(() => {+ if (!channelsLayout) {+ autoScopedRef.current = false;+ return;+ }+ // A route-scoped channel wins over the default. Both effects run from the+ // same render on a cold deep link, so without this guard the route effect+ // writes its channel and this later effect immediately overwrites it with+ // #me using the stale `currentChannelId` captured by that render.+ if (routeChannelId || autoScopedRef.current || currentChannelId) return;+ const me = channels.find((c) => c.channelType === "personal");+ if (!me) return;+ autoScopedRef.current = true;+ setCurrentChannel(me.id);+ }, [+ channelsLayout,+ channels,+ currentChannelId,+ routeChannelId,+ setCurrentChannel,+ ]);++ return null;+}diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelSidebar.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelSidebar.tsxindex 86e4ff16ebc3..970906fff7ba 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelSidebar.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelSidebar.tsx@@ -676,7 +676,7 @@ export function ChannelSidebar({ channelId }: { channelId: string }) {);return (- <div className="flex h-full min-h-0 flex-col border-border border-t pt-1">+ <div className="flex h-full min-h-0 flex-col"><ChannelBackRow channelId={channelId} /><div className="flex flex-col gap-px px-2 pt-2">diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelsList.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelsList.tsxindex 9ec23f52b7e2..483dce23d48c 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelsList.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelsList.tsx@@ -1941,7 +1941,7 @@ export function ChannelsList() {const body = (<Flex direction="column" className="h-full min-h-0">{channelsLayout && (- <Box className="shrink-0 px-2 pt-1">+ <Box className="shrink-0 px-2 pt-2"><AutocompleteInputref={searchRef}placeholder="Search spaces…"diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.test.tsxindex fa9b13f7712b..84021bc3c453 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.test.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.test.tsx@@ -49,8 +49,8 @@ vi.mock("@posthog/ui/router/navigationBridge", () => ({// The sidebar's children each mount their own query stack; this suite is about// the shell's own decisions, so they're stubbed out.-vi.mock("@posthog/ui/features/canvas/components/ChannelNav", () => ({- ChannelNav: () => null,+vi.mock("@posthog/ui/features/canvas/components/ActivityFeedList", () => ({+ ActivityFeedList: () => <div data-testid="activity-feed" />,}));vi.mock("@posthog/ui/features/canvas/components/ChannelSidebar", () => ({ChannelSidebar: ({ channelId }: { channelId: string }) => (@@ -94,11 +94,14 @@ import {} from "@posthog/ui/features/canvas/stores/channelPaneStore";import { useCurrentChannelStore } from "@posthog/ui/features/canvas/stores/currentChannelStore";import { useSidebarStore } from "@posthog/ui/features/sidebar/sidebarStore";+import { ChannelRouteSync } from "./ChannelRouteSync";import { ChannelsSidebar } from "./ChannelsSidebar";+// The same pair the shell mounts: the column's contents follow the scoped space.function renderSidebar() {return render(<Theme>+ <ChannelRouteSync /><ChannelsSidebar /></Theme>,);@@ -198,6 +201,7 @@ describe("ChannelsSidebar", () => {mocks.routeChannelId = ME.id;rerender(<Theme>+ <ChannelRouteSync /><ChannelsSidebar /></Theme>,);@@ -227,6 +231,7 @@ describe("ChannelsSidebar", () => {mocks.routeChannelId = undefined;rerender(<Theme>+ <ChannelRouteSync /><ChannelsSidebar /></Theme>,);@@ -234,6 +239,7 @@ describe("ChannelsSidebar", () => {mocks.routeChannelId = ENG.id;rerender(<Theme>+ <ChannelRouteSync /><ChannelsSidebar /></Theme>,);@@ -383,6 +389,7 @@ describe("ChannelsSidebar", () => {mocks.channelsLayout = false;rerender(<Theme>+ <ChannelRouteSync /><ChannelsSidebar /></Theme>,);@@ -391,6 +398,7 @@ describe("ChannelsSidebar", () => {mocks.channelsLayout = true;rerender(<Theme>+ <ChannelRouteSync /><ChannelsSidebar /></Theme>,);@@ -453,12 +461,14 @@ describe("ChannelsSidebar", () => {mocks.channelsLayout = false;rerender(<Theme>+ <ChannelRouteSync /><ChannelsSidebar /></Theme>,);mocks.channelsLayout = true;rerender(<Theme>+ <ChannelRouteSync /><ChannelsSidebar /></Theme>,);diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.tsxindex 7fa6dcc685c4..b2c73ef97124 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.tsx@@ -2,8 +2,8 @@ import { ArchiveIcon } from "@phosphor-icons/react";import { cn, Separator } from "@posthog/quill";import { PROJECT_BLUEBIRD_FLAG } from "@posthog/shared";import { useArchivedTaskIds } from "@posthog/ui/features/archive/useArchivedTaskIds";+import { ActivityFeedList } from "@posthog/ui/features/canvas/components/ActivityFeedList";import { ChannelItemPreviewCardProvider } from "@posthog/ui/features/canvas/components/ChannelItemHoverCard";-import { ChannelNav } from "@posthog/ui/features/canvas/components/ChannelNav";import { ChannelSidebar } from "@posthog/ui/features/canvas/components/ChannelSidebar";import { ChannelsFab } from "@posthog/ui/features/canvas/components/ChannelsFab";import { ChannelsList } from "@posthog/ui/features/canvas/components/ChannelsList";@@ -12,15 +12,17 @@ import { useChannelPaneSwipe } from "@posthog/ui/features/canvas/hooks/useChanneimport { useChannelsLayout } from "@posthog/ui/features/canvas/hooks/useChannelsLayout";import { useCurrentChannel } from "@posthog/ui/features/canvas/hooks/useCurrentChannel";import { useMarkChannelSeen } from "@posthog/ui/features/canvas/hooks/useMarkChannelSeen";+import { useRailSurface } from "@posthog/ui/features/canvas/hooks/useRailSurface";import { useTrackChannelsSpaceViewed } from "@posthog/ui/features/canvas/hooks/useTrackChannelsSpaceViewed";import {- clearKeepListForRoute,- shouldKeepListForRoute,+ selectActivityItem,+ useActivityDetailStore,+} from "@posthog/ui/features/canvas/stores/activityDetailStore";+import {showChannelList,showChannelPane,useChannelPaneStore,} from "@posthog/ui/features/canvas/stores/channelPaneStore";-import { useCurrentChannelStore } from "@posthog/ui/features/canvas/stores/currentChannelStore";import { useFeatureFlag } from "@posthog/ui/features/feature-flags/useFeatureFlag";import { useOnboardingStore } from "@posthog/ui/features/onboarding/onboardingStore";import { NavResizeTooltip } from "@posthog/ui/features/sidebar/components/NavResizeTooltip";@@ -29,7 +31,10 @@ import { SidebarMenu } from "@posthog/ui/features/sidebar/components/SidebarMenuimport { SidebarNavSection } from "@posthog/ui/features/sidebar/components/SidebarNavSection";import { TasksHeader } from "@posthog/ui/features/sidebar/components/TasksHeader";import { UpdateBanner } from "@posthog/ui/features/sidebar/components/UpdateBanner";-import { CHANNELS_SIDEBAR_MIN_WIDTH } from "@posthog/ui/features/sidebar/constants";+import {+ CHANNELS_SIDEBAR_MIN_WIDTH,+ NAV_RAIL_WIDTH,+} from "@posthog/ui/features/sidebar/constants";import {beginSidebarPeek,cancelSidebarPeek,@@ -42,7 +47,6 @@ import { ErrorBoundary } from "@posthog/ui/primitives/ErrorBoundary";import { useSidebarEdgeHoverPeek } from "@posthog/ui/primitives/hooks/useSidebarEdgeHoverPeek";import { ResizableSidebar } from "@posthog/ui/primitives/ResizableSidebar";import { navigateToArchived } from "@posthog/ui/router/navigationBridge";-import { useParams } from "@tanstack/react-router";import { useDeferredValue, useEffect, useRef } from "react";/**@@ -132,12 +136,15 @@ export function ChannelsSidebar() {setOpenAuto(hasCompletedOnboarding || Object.keys(workspaces).length > 0);}, [workspacesFetched, workspaces, hasCompletedOnboarding, setOpenAuto]);+ const channelsLayout = useChannelsLayout();const peek = useSidebarPeekStore((s) => s.peek);useSidebarEdgeHoverPeek({enabled: !open && !isResizing,peeked: peek,side: "left",width,+ // Hovering a rail button is not a request to slide the sidebar out.+ offset: channelsLayout ? NAV_RAIL_WIDTH : 0,onReveal: beginSidebarPeek,onClose: () => endSidebarPeek(),});@@ -157,7 +164,6 @@ export function ChannelsSidebar() {);const channelsEnabled =useSidebarStore((s) => s.channelsEnabled) && bluebirdEnabled;- const channelsLayout = useChannelsLayout();const channelsWorld = channelsLayout || channelsEnabled;const bodyChannelsWorld = useDeferredValue(channelsWorld);// Under the layout the row moves into the account menu (ProjectSwitcher),@@ -177,57 +183,17 @@ export function ChannelsSidebar() {const archivedTaskIds = useArchivedTaskIds();- const params = useParams({ strict: false });- const routeChannelId = params.channelId;- const setCurrentChannel = useCurrentChannelStore((s) => s.setCurrentChannel);- const { currentChannelId, channels } = useCurrentChannel({- enabled: channelsLayout,- });- useEffect(() => {- if (!channelsLayout) return;- // A route with no channel ends the navigation the latch was armed for. Left- // set, it would hold a later deep link to that channel on the list.- if (!routeChannelId) {- clearKeepListForRoute();- return;- }- setCurrentChannel(routeChannelId);- // Landing on a channel — a deep link, a mention, ⌘1-9 — is a request to see- // it, so the slider follows the route even if the list was being browsed.- // Unless the navigation said otherwise: opening a session from the list's- // tree loads it without taking the tree off the screen.- if (!shouldKeepListForRoute(routeChannelId)) showChannelPane();- }, [channelsLayout, routeChannelId, setCurrentChannel]);+ // Scoping lives in ChannelRouteSync: this column is not always drawn.+ const { currentChannelId } = useCurrentChannel({ enabled: channelsLayout });// Browsing the list is view state, not navigation: you stay in the channel// (route and main pane unchanged) while you look around. With no channel to// slide to there's only the list.+ const { showsActivityDetail } = useRailSurface();+ const selectedActivityId = useActivityDetailStore((s) => s.selected?.id);const pane = useChannelPaneStore((s) => s.pane);const showList = pane === "list" || currentChannelId == null;- const autoScopedRef = useRef(false);- useEffect(() => {- if (!channelsLayout) {- autoScopedRef.current = false;- return;- }- // A route-scoped channel wins over the default. Both effects run from the- // same render on a cold deep link, so without this guard the route effect- // writes its channel and this later effect immediately overwrites it with- // #me using the stale `currentChannelId` captured by that render.- if (routeChannelId || autoScopedRef.current || currentChannelId) return;- const me = channels.find((c) => c.channelType === "personal");- if (!me) return;- autoScopedRef.current = true;- setCurrentChannel(me.id);- }, [- channelsLayout,- channels,- currentChannelId,- routeChannelId,- setCurrentChannel,- ]);-return (<ResizableSidebaropen={open}@@ -243,11 +209,20 @@ export function ChannelsSidebar() {onPeekLeave={() => endSidebarPeek()}onPeekDismiss={cancelSidebarPeek}resizeTooltip={<NavResizeTooltip />}+ drawEdge={!channelsLayout}>{/* One preview card for every row in here — the channel's own list andthe space tree both draw their rows as triggers on it. */}<ChannelItemPreviewCardProvider>- <div className="flex h-full flex-col bg-chrome">+ <div+ className={cn(+ "flex h-full flex-col bg-chrome",+ // This column starts the framed inset, so it owns the whole+ // outline: a second owner of any edge doubles that line.+ channelsLayout &&+ "rounded-tl-lg border-border border-t border-r border-l",+ )}+ >{!channelsLayout && (<><SidebarNavSection />@@ -256,21 +231,19 @@ export function ChannelsSidebar() {)}{channelsLayout ? (- <>- {/* Which project you're in is the outermost thing about this- window, so under the layout it sits above the nav row rather- than in the footer. Its menu opens downward, which is the- right direction from the top of a sidebar. */}- <div className="shrink-0 px-2 pb-1">- <ProjectSwitcher />- </div>- <ChannelNav />+ showsActivityDetail ? (+ <ActivityFeedList+ className="min-h-0 flex-1"+ selectedId={selectedActivityId}+ onActivate={selectActivityItem}+ />+ ) : (<ChannelPaneschannelId={currentChannelId}showList={showList}sidebarVisible={open || peek}/>- </>+ )) : bodyChannelsWorld ? (<><Separator />diff --git a/products/desktop/packages/ui/src/features/canvas/components/NavRail.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/NavRail.test.tsxnew file mode 100644index 000000000000..e496a5df8411--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/NavRail.test.tsx@@ -0,0 +1,244 @@+import { act, render, screen } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import { beforeEach, describe, expect, it, vi } from "vitest";++const mocks = vi.hoisted(() => ({+ view: { type: "home" } as { type: string },+ pathname: "/website/home",+ navigateToActivity: vi.fn(),+ navigateToHome: vi.fn(),+ navigateToInbox: vi.fn(),+}));++vi.mock("@tanstack/react-router", () => ({+ useRouterState: ({+ select,+ }: {+ select: (s: { location: { pathname: string } }) => unknown;+ }) => select({ location: { pathname: mocks.pathname } }),+}));++vi.mock("@posthog/ui/features/canvas/hooks/useTaskActivity", () => ({+ useTaskActivity: () => ({ unreadCount: 1 }),+}));+vi.mock(+ "@posthog/ui/features/command-center/useCommandCenterActiveCount",+ () => ({ useCommandCenterActiveCount: () => 0 }),+);+vi.mock("@posthog/ui/features/feature-flags/useFeatureFlag", () => ({+ useFeatureFlag: () => false,+}));+vi.mock("@posthog/ui/features/inbox/hooks/useInboxAllReports", () => ({+ useInboxAllReports: () => ({ counts: { pulls: 0 } }),+}));+vi.mock("@posthog/ui/features/sidebar/components/ProjectSwitcher", () => ({+ ProjectSwitcher: () => null,+}));+vi.mock("@posthog/ui/router/useAppView", () => ({+ useAppView: () => mocks.view,+}));+vi.mock("@posthog/ui/router/navigationBridge", () => ({+ navigateToActivity: (...args: unknown[]) => mocks.navigateToActivity(...args),+ navigateToHome: (...args: unknown[]) => mocks.navigateToHome(...args),+ navigateToInbox: (...args: unknown[]) => mocks.navigateToInbox(...args),+ navigateToLoops: vi.fn(),+ navigateToWebsiteCommandCenter: vi.fn(),+}));+vi.mock("@posthog/ui/shell/analytics", () => ({ track: vi.fn() }));+vi.mock("@posthog/ui/features/canvas/components/ActivityHoverCard", () => ({+ ActivityHoverCard: () => <div>Recent activity card</div>,+}));++import { useChannelPaneStore } from "@posthog/ui/features/canvas/stores/channelPaneStore";+import { useCurrentChannelStore } from "@posthog/ui/features/canvas/stores/currentChannelStore";+import { useNavRailStore } from "@posthog/ui/features/canvas/stores/navRailStore";+import { useSidebarStore } from "@posthog/ui/features/sidebar/sidebarStore";+import { NavRail } from "./NavRail";++describe("NavRail", () => {+ beforeEach(() => {+ vi.clearAllMocks();+ mocks.view = { type: "home" };+ mocks.pathname = "/website/home";+ useNavRailStore.setState({ pane: "spaces" });+ useSidebarStore.setState({ navItemOverrides: {}, navItemOrder: [] });+ useCurrentChannelStore.setState({ currentChannelId: null });+ useChannelPaneStore.setState({ pane: "channel" });+ });++ it("hands the sidebar column to Activity without leaving the current screen", async () => {+ const user = userEvent.setup();+ render(<NavRail />);++ await user.click(screen.getByLabelText("Activity"));++ expect(useNavRailStore.getState().pane).toBe("activity");+ expect(mocks.navigateToActivity).not.toHaveBeenCalled();+ expect(mocks.navigateToHome).not.toHaveBeenCalled();+ expect(mocks.navigateToInbox).not.toHaveBeenCalled();+ });++ it("moves into the space tree when Activity is picked from outside it", async () => {+ const user = userEvent.setup();+ mocks.pathname = "/code/inbox";+ mocks.view = { type: "inbox" };+ render(<NavRail />);++ await user.click(screen.getByLabelText("Activity"));++ expect(useNavRailStore.getState().pane).toBe("activity");+ expect(mocks.navigateToActivity).toHaveBeenCalledOnce();+ });++ it("shows the space tree without routing to a space", async () => {+ const user = userEvent.setup();+ mocks.view = { type: "activity" };+ render(<NavRail />);++ await user.click(screen.getByLabelText("Spaces"));++ expect(useNavRailStore.getState().pane).toBe("spaces");+ expect(mocks.navigateToHome).not.toHaveBeenCalled();+ });++ it("slides back to the list when a space is already open", async () => {+ const user = userEvent.setup();+ useChannelPaneStore.setState({ pane: "channel" });+ render(<NavRail />);++ await user.click(screen.getByLabelText("Spaces"));++ expect(useChannelPaneStore.getState().pane).toBe("list");+ });++ it("keeps a route-free pick from snapping back to the route behind it", async () => {+ const user = userEvent.setup();+ const { rerender } = render(<NavRail />);++ await user.click(screen.getByLabelText("Spaces"));+ rerender(<NavRail />);++ expect(useNavRailStore.getState().pane).toBe("spaces");+ });++ it("follows the route when the route is what moved", () => {+ mocks.view = { type: "activity" };+ render(<NavRail />);++ expect(useNavRailStore.getState().pane).toBe("activity");+ expect(screen.getByLabelText("Activity")).toHaveAttribute(+ "data-selected",+ "true",+ );+ });++ it("peeks at the feed on hover while Activity is somewhere else", async () => {+ const user = userEvent.setup();+ render(<NavRail />);++ await user.hover(screen.getByLabelText("Activity"));++ expect(+ await screen.findByText("Recent activity card", {}, { timeout: 1_000 }),+ ).toBeInTheDocument();+ });++ it("drops the peek once Activity is the destination", async () => {+ const user = userEvent.setup();+ mocks.view = { type: "activity" };+ render(<NavRail />);++ const bell = screen.getByLabelText("Activity");+ expect(bell).not.toHaveAttribute("aria-haspopup");+ await user.hover(bell);++ await new Promise((resolve) => setTimeout(resolve, 400));+ expect(screen.queryByText("Recent activity card")).not.toBeInTheDocument();+ });++ it("drops an item hidden in the sidebar settings", () => {+ useSidebarStore.setState({ navItemOverrides: { "command-center": false } });+ render(<NavRail />);++ expect(screen.queryByLabelText("Command Center")).not.toBeInTheDocument();+ expect(screen.getByLabelText("Inbox")).toBeInTheDocument();+ });++ it("keeps the column's own destinations when everything else is hidden", () => {+ useSidebarStore.setState({+ navItemOverrides: {+ inbox: false,+ activity: false,+ "command-center": false,+ loops: false,+ configure: false,+ },+ });+ render(<NavRail />);++ expect(screen.getByLabelText("Home")).toBeInTheDocument();+ expect(screen.getByLabelText("Spaces")).toBeInTheDocument();+ expect(screen.queryByLabelText("Settings")).not.toBeInTheDocument();+ });++ it("follows a stored order without moving the pinned destinations", () => {+ useSidebarStore.setState({+ navItemOrder: ["command-center", "inbox", "activity"],+ });+ const { container } = render(<NavRail />);++ const labels = [...container.querySelectorAll("button")].map((button) =>+ button.getAttribute("aria-label"),+ );+ expect(labels.slice(0, 5)).toEqual([+ "Home",+ "Spaces",+ "Command Center",+ "Inbox",+ "Activity",+ ]);+ });++ // Two routes can share a destination, so the pane it derives does not change+ // between them. Moving from one to the other still has to leave Activity.+ it("leaves Activity when the route moves inside the space it was over", async () => {+ const user = userEvent.setup();+ mocks.pathname = "/website/chan-1/tasks/task-a";+ mocks.view = { type: "task-detail" };+ const { rerender } = render(<NavRail />);++ await user.click(screen.getByLabelText("Activity"));+ expect(useNavRailStore.getState().pane).toBe("activity");++ mocks.pathname = "/website/chan-1/tasks/task-b";+ rerender(<NavRail />);++ expect(useNavRailStore.getState().pane).toBe("spaces");+ });++ it("lights the last square of the Spaces mark while a space is open", () => {+ useCurrentChannelStore.setState({ currentChannelId: "chan-1" });+ useChannelPaneStore.setState({ pane: "channel" });+ const { container, rerender } = render(<NavRail />);+ const lit = () =>+ container.querySelectorAll('rect[fill="var(--primary)"]').length;++ expect(lit()).toBe(1);++ act(() => useChannelPaneStore.setState({ pane: "list" }));+ rerender(<NavRail />);++ expect(lit()).toBe(0);+ });++ it("counts a channel or task as part of Spaces", () => {+ mocks.view = { type: "task-detail" };+ render(<NavRail />);++ expect(screen.getByLabelText("Spaces")).toHaveAttribute(+ "data-selected",+ "true",+ );+ expect(screen.getByLabelText("Home")).not.toHaveAttribute("data-selected");+ });+});diff --git a/products/desktop/packages/ui/src/features/canvas/components/NavRail.tsx b/products/desktop/packages/ui/src/features/canvas/components/NavRail.tsxnew file mode 100644index 000000000000..7bb4c237e99f--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/NavRail.tsx@@ -0,0 +1,293 @@+import { BellIcon, GearSix } from "@phosphor-icons/react";+import {+ Button,+ cn,+ Kbd,+ Popover,+ PopoverTrigger,+ Tooltip,+ TooltipContent,+ TooltipProvider,+ TooltipTrigger,+} from "@posthog/quill";+import { LOOPS_FLAG } from "@posthog/shared";+import { ANALYTICS_EVENTS } from "@posthog/shared/analytics-events";+import { ActivityHoverCard } from "@posthog/ui/features/canvas/components/ActivityHoverCard";+import {+ paneForView,+ type RailCounts,+ type RailDestination,+ visibleRailDestinations,+} from "@posthog/ui/features/canvas/components/railDestinations";+import { useTaskActivity } from "@posthog/ui/features/canvas/hooks/useTaskActivity";+import { useNavRailStore } from "@posthog/ui/features/canvas/stores/navRailStore";+import { useCommandCenterActiveCount } from "@posthog/ui/features/command-center/useCommandCenterActiveCount";+import { useFeatureFlag } from "@posthog/ui/features/feature-flags/useFeatureFlag";+import { useInboxAllReports } from "@posthog/ui/features/inbox/hooks/useInboxAllReports";+import { openSettings } from "@posthog/ui/features/settings/hooks/useOpenSettings";+import { ProjectSwitcher } from "@posthog/ui/features/sidebar/components/ProjectSwitcher";+import {+ isNavItemVisible,+ NAV_RAIL_WIDTH,+} from "@posthog/ui/features/sidebar/constants";+import { useSidebarStore } from "@posthog/ui/features/sidebar/sidebarStore";+import { CountBadge } from "@posthog/ui/primitives/CountBadge";+import { useAppView } from "@posthog/ui/router/useAppView";+import { track } from "@posthog/ui/shell/analytics";+import { useRouterState } from "@tanstack/react-router";+import {+ type ComponentPropsWithRef,+ type ReactElement,+ type ReactNode,+ useEffect,+ useRef,+ useState,+} from "react";++const INBOX_REFETCH_INTERVAL_MS = 60_000;++const ICON_BADGE_CLASS =+ "-top-1 -right-1 absolute h-3.5 min-w-3.5 w-auto px-1 font-semibold text-[9px] ring-2 ring-chrome";++function NavIcon({+ icon,+ label,+ shortcut,+ isActive,+ onClick,+ badge,+}: {+ icon: ReactNode;+ label: string;+ shortcut?: string;+ isActive: boolean;+ onClick: () => void;+ badge?: ReactNode;+}) {+ return (+ <Tooltip>+ <TooltipTrigger+ render={+ <Button+ variant="default"+ size="icon"+ aria-label={label}+ data-selected={isActive || undefined}+ onClick={onClick}+ className="group relative shrink-0 text-muted-foreground data-selected:bg-fill-selected data-selected:text-foreground"+ >+ {icon}+ {badge}+ </Button>+ }+ />+ <TooltipContent side="right">+ {label}+ {shortcut && <Kbd className="ml-1.5">{shortcut}</Kbd>}+ </TooltipContent>+ </Tooltip>+ );+}++interface NavButtonProps extends ComponentPropsWithRef<"button"> {+ icon: ReactNode;+ label: string;+ isActive: boolean;+ badge?: ReactNode;+}++function NavButton({+ icon,+ label,+ isActive,+ onClick,+ badge,+ className,+ ref,+ ...buttonProps+}: NavButtonProps) {+ return (+ <Button+ {...buttonProps}+ ref={ref}+ type="button"+ variant="default"+ size="icon"+ aria-label={label}+ data-selected={isActive || undefined}+ onClick={onClick}+ className={cn(+ "relative shrink-0 text-muted-foreground data-selected:bg-fill-selected data-selected:text-foreground",+ className,+ )}+ >+ {icon}+ {badge}+ </Button>+ );+}++function ActivityHoverPopover({ trigger }: { trigger: ReactElement }) {+ const [open, setOpen] = useState(false);++ return (+ <Popover open={open} onOpenChange={setOpen}>+ <PopoverTrigger+ openOnHover+ delay={300}+ closeDelay={100}+ onClick={(event) => event.preventBaseUIHandler()}+ render={trigger}+ />+ {open && (+ <ActivityHoverCard side="right" onClose={() => setOpen(false)} />+ )}+ </Popover>+ );+}++// No peek once Activity is the destination: the feed is already beside you.+function ActivityNavItem({+ isActive,+ badge,+ onClick,+}: {+ isActive: boolean;+ badge: ReactNode;+ onClick: () => void;+}) {+ const bell = (+ <NavButton+ icon={<BellIcon size={16} weight={isActive ? "fill" : "regular"} />}+ label="Activity"+ isActive={isActive}+ onClick={onClick}+ badge={badge}+ />+ );++ if (isActive) return bell;+ return <ActivityHoverPopover trigger={bell} />;+}++/**+ * The app's leftmost column. Sits outside the resizable sidebar, so collapsing+ * that sidebar leaves the destinations reachable.+ */+export function NavRail() {+ const view = useAppView();+ const loopsEnabled = useFeatureFlag(LOOPS_FLAG, import.meta.env.DEV);++ const { counts: inboxCounts } = useInboxAllReports({+ ignoreFilters: true,+ refetchIntervalMs: INBOX_REFETCH_INTERVAL_MS,+ });+ const { unreadCount: unseenActivity } = useTaskActivity();+ const commandCenterCount = useCommandCenterActiveCount();+ const counts: RailCounts = {+ inbox: inboxCounts.pulls,+ activity: unseenActivity,+ commandCenter: commandCenterCount,+ };+ const railPane = useNavRailStore((s) => s.pane);+ const setRailPane = useNavRailStore((s) => s.setPane);+ const pathname = useRouterState({ select: (s) => s.location.pathname });+ const inWebsiteTree = pathname.startsWith("/website");+ const navItemOverrides = useSidebarStore((s) => s.navItemOverrides);+ const navItemOrder = useSidebarStore((s) => s.navItemOrder);+ const destinations = visibleRailDestinations({+ overrides: navItemOverrides,+ order: navItemOrder,+ loops: loopsEnabled,+ });+ const settingsVisible = isNavItemVisible(navItemOverrides, "configure");++ const pick =+ ({ pane, analyticsId, onPick }: RailDestination) =>+ () => {+ track(ANALYTICS_EVENTS.SIDEBAR_NAV_ITEM_CLICKED, {+ item: analyticsId,+ in_more: false,+ layout: "channels",+ });+ setRailPane(pane);+ onPick?.({ inWebsiteTree });+ };++ // Keyed on the path, not on the pane it derives: two routes can share a+ // destination, and a move between them still has to pull the rail off+ // Activity. Not keyed on every render either, or picking Spaces or Activity+ // would snap straight back to the screen behind them.+ const routePane = paneForView(view.type);+ const lastPathRef = useRef<string | null>(null);+ useEffect(() => {+ if (lastPathRef.current === pathname) return;+ lastPathRef.current = pathname;+ setRailPane(routePane);+ }, [pathname, routePane, setRailPane]);++ return (+ // One provider for the whole rail: the tooltip skip window is provider+ // state, so isolated providers never share it.+ <TooltipProvider delay={400}>+ <div+ className="flex h-full shrink-0 flex-col items-center gap-1.5 bg-chrome py-2"+ style={{ width: NAV_RAIL_WIDTH }}+ >+ {destinations.map((destination) => {+ const { pane, label, Icon, count, countTone } = destination;+ const isActive = railPane === pane;+ const badge = (+ <CountBadge+ count={count?.(counts) ?? 0}+ tone={countTone}+ className={ICON_BADGE_CLASS}+ />+ );+ const onClick = pick(destination);++ if (pane === "activity") {+ return (+ <ActivityNavItem+ key={pane}+ isActive={isActive}+ badge={badge}+ onClick={onClick}+ />+ );+ }+ return (+ <NavIcon+ key={pane}+ icon={<Icon size={16} weight={isActive ? "fill" : "regular"} />}+ label={label}+ shortcut={destination.shortcut}+ isActive={isActive}+ onClick={onClick}+ badge={badge}+ />+ );+ })}+ <div className="mt-auto flex flex-col items-center gap-1.5">+ {settingsVisible && (+ <NavIcon+ icon={<GearSix size={16} />}+ label="Settings"+ isActive={false}+ onClick={() => {+ track(ANALYTICS_EVENTS.SIDEBAR_NAV_ITEM_CLICKED, {+ item: "configure",+ in_more: false,+ layout: "channels",+ });+ openSettings();+ }}+ />+ )}+ <div className="my-0.5 w-5 shrink-0 border-border border-t" />+ <ProjectSwitcher appearance="icon" />+ </div>+ </div>+ </TooltipProvider>+ );+}diff --git a/products/desktop/packages/ui/src/features/canvas/components/SpaceHeaderRow.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/SpaceHeaderRow.test.tsxnew file mode 100644index 000000000000..6246270623d7--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/SpaceHeaderRow.test.tsx@@ -0,0 +1,133 @@+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { render } from "@testing-library/react";+import { useMemo } from "react";+import { describe, expect, it, vi } from "vitest";++vi.mock("@posthog/ui/features/canvas/hooks/useChannelsLayout", () => ({+ useChannelsLayout: () => true,+}));+vi.mock("@posthog/host-router/react", () => ({+ useHostTRPC: () => ({+ dashboards: { saveContext: { mutationKey: () => ["save-context"] } },+ channelTasks: {+ list: {+ queryOptions: () => ({ queryKey: ["ct"], queryFn: async () => [] }),+ },+ },+ workspace: {+ getAllTaskTimestamps: {+ queryKey: () => ["ts"],+ queryOptions: () => ({ queryKey: ["ts"], queryFn: async () => ({}) }),+ },+ },+ }),+ useHostTRPCClient: () => ({+ workspace: {+ markViewed: { mutate: vi.fn() },+ markActivity: { mutate: vi.fn() },+ },+ }),+}));+vi.mock("@posthog/ui/shell/analytics", () => ({ track: vi.fn() }));+vi.mock("@tanstack/react-router", () => ({+ Outlet: () => null,+ useNavigate: () => vi.fn(),+ useParams: () => ({}),+ useRouterState: ({+ select,+ }: {+ select: (s: { location: { pathname: string } }) => string;+ }) => select({ location: { pathname: "/website/home" } }),+}));+vi.mock(+ "@posthog/ui/features/task-detail/components/TaskHeaderActions",+ () => ({+ TaskHeaderActions: () => <div />,+ }),+);+vi.mock("@posthog/ui/features/tasks/useTasks", () => ({+ useTasks: () => ({+ data: [{ id: "task-1", title: "T", updated_at: "2026-01-01T00:00:00Z" }],+ }),+}));+vi.mock("@posthog/ui/features/canvas/hooks/useChannelTasks", () => ({+ useChannelTasks: () => ({ tasks: [], isLoading: false }),+}));+vi.mock("@posthog/ui/features/canvas/hooks/useChannels", () => ({+ useChannels: () => ({ channels: [{ id: "chan-1", name: "space" }] }),+}));+vi.mock("@posthog/ui/features/canvas/hooks/useChannelStars", () => ({+ useChannelStarMutations: () => ({ star: vi.fn(), unstar: vi.fn() }),+}));+vi.mock("@posthog/ui/features/canvas/hooks/useDashboards", () => ({+ useDashboard: () => ({ dashboard: null }),+ useCanvasVersions: () => ({ versions: [] }),+ useDashboardMutations: () => ({}),+}));+vi.mock("@posthog/ui/features/sessions/components/useComments", () => ({+ useCommentsQuery: () => ({ data: [] }),+}));+vi.mock("@posthog/ui/features/canvas/stores/dashboardEditStore", () => ({+ useDashboardEditStore: () => vi.fn(),+ useIsDashboardEditing: () => false,+}));+vi.mock("@posthog/ui/features/canvas/components/NewCanvasMenu", () => ({+ NewCanvasMenu: () => null,+}));+vi.mock("@posthog/ui/features/canvas/freeform/CanvasFrameHost", () => ({+ CanvasFrameHost: () => null,+}));+vi.mock("@posthog/ui/features/navigation/components/RightPanel", () => ({+ RightPanel: () => null,+}));+vi.mock("@posthog/ui/features/sidebar/useTaskViewed", () => ({+ useTaskViewed: () => ({ markAsViewed: vi.fn() }),+}));+vi.mock("@posthog/ui/router/routeSkeletons", () => ({+ TaskDetailSkeleton: () => <div>skeleton</div>,+}));++// Stands in for the real task view, which cannot be imported here. The task+// identity is deliberately unstable, the way a live query's is mid-refetch.+let taskDetailRenders = 0;+vi.mock("@posthog/ui/features/task-detail/components/TaskDetail", () => ({+ TaskDetail: ({+ task,+ channelName,+ }: {+ task: { title: string };+ channelName?: string;+ }) => {+ taskDetailRenders += 1;+ const content = useMemo(+ () => <span>{`${channelName} / ${task.title}`}</span>,+ [channelName, task],+ );+ useSetHeaderContent(content);+ return <div>detail</div>;+ },+}));++import { useActivityDetailStore } from "@posthog/ui/features/canvas/stores/activityDetailStore";+import { useNavRailStore } from "@posthog/ui/features/canvas/stores/navRailStore";+import { useSetHeaderContent } from "@posthog/ui/hooks/useSetHeaderContent";+import { WebsiteLayout } from "./WebsiteLayout";++describe("SpaceHeaderRow", () => {+ it("keeps the header store off the layout that renders its writer", () => {+ useNavRailStore.setState({ pane: "activity" });+ useActivityDetailStore.setState({+ selected: { id: "a1", taskId: "task-1", channelId: "chan-1" } as never,+ });+ const client = new QueryClient({+ defaultOptions: { queries: { retry: false } },+ });+ render(+ <QueryClientProvider client={client}>+ <WebsiteLayout />+ </QueryClientProvider>,+ );+ // A layout that subscribes to the header store blows the update depth here.+ expect(taskDetailRenders).toBeLessThan(20);+ });+});diff --git a/products/desktop/packages/ui/src/features/canvas/components/SpaceHeaderRow.tsx b/products/desktop/packages/ui/src/features/canvas/components/SpaceHeaderRow.tsxnew file mode 100644index 000000000000..bec7e3770fb6--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/SpaceHeaderRow.tsx@@ -0,0 +1,25 @@+import type { Task } from "@posthog/shared/domain-types";+import { TaskHeaderActions } from "@posthog/ui/features/task-detail/components/TaskHeaderActions";+import { useHeaderStore } from "@posthog/ui/shell/headerStore";++/**+ * The title row above the content pane. Subscribes to the header store itself:+ * the layout renders the screen that writes that store, so subscribing up there+ * makes every title write re-render the writer.+ */+export function SpaceHeaderRow({ task }: { task?: Task }) {+ const content = useHeaderStore((s) => s.content);+ if (!content && !task) return null;++ return (+ <div className="flex h-10 shrink-0 items-center gap-2 border-border border-b pr-2 pl-1">+ <div className="flex h-full min-w-0 flex-1 items-center justify-between overflow-hidden">+ {content}+ </div>+ {/* Rendered without a wrapper: the actions cap themselves at half the+ bar, and a wrapper that hugs their content resolves that percentage+ against itself, which clips them. */}+ {task && <TaskHeaderActions task={task} />}+ </div>+ );+}diff --git a/products/desktop/packages/ui/src/features/canvas/components/SpacesIcon.tsx b/products/desktop/packages/ui/src/features/canvas/components/SpacesIcon.tsxnew file mode 100644index 000000000000..a8fde0613822--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/SpacesIcon.tsx@@ -0,0 +1,59 @@+import type { IconProps } from "@phosphor-icons/react";+import { useChannelPaneStore } from "@posthog/ui/features/canvas/stores/channelPaneStore";+import { useCurrentChannelStore } from "@posthog/ui/features/canvas/stores/currentChannelStore";++const SQUARES = [+ { x: 40, y: 40 },+ { x: 136, y: 40 },+ { x: 40, y: 136 },+ { x: 136, y: 136 },+] as const;++/**+ * The rail's Spaces mark: four squares, with the last one lit while you are+ * inside a space rather than browsing the tree.+ */+export function SpacesIcon({ size = 16, weight, ...props }: IconProps) {+ const pane = useChannelPaneStore((s) => s.pane);+ const currentChannelId = useCurrentChannelStore((s) => s.currentChannelId);+ const inSpace = pane === "channel" && currentChannelId != null;+ const filled = weight === "fill";++ return (+ <svg+ viewBox="0 0 256 256"+ width={size}+ height={size}+ fill="none"+ role="presentation"+ {...props}+ >+ {SQUARES.map(({ x, y }, index) => {+ const lit = inSpace && index === SQUARES.length - 1;+ const color = lit ? "var(--primary)" : "currentColor";+ return filled || lit ? (+ <rect+ key={`${x}-${y}`}+ x={x}+ y={y}+ width={80}+ height={80}+ rx={20}+ fill={color}+ />+ ) : (+ <rect+ key={`${x}-${y}`}+ x={x + 8}+ y={y + 8}+ width={64}+ height={64}+ rx={12}+ stroke={color}+ strokeWidth={16}+ />+ );+ })}+ </svg>+ );+}diff --git a/products/desktop/packages/ui/src/features/canvas/components/WebsiteLayout.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/WebsiteLayout.test.tsxindex 5dd5e0e8815b..b6d7a57fbf60 100644--- a/products/desktop/packages/ui/src/features/canvas/components/WebsiteLayout.test.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/WebsiteLayout.test.tsx@@ -93,6 +93,9 @@ vi.mock("@posthog/ui/features/canvas/stores/dashboardEditStore", () => ({sel({ setEditing: vi.fn() }),useIsDashboardEditing: () => false,}));+vi.mock("@posthog/ui/features/canvas/components/ActivityDetailPane", () => ({+ ActivityDetailPane: () => <div data-testid="activity-detail" />,+}));vi.mock("@posthog/ui/features/canvas/components/NewCanvasMenu", () => ({NewCanvasMenu: () => null,}));diff --git a/products/desktop/packages/ui/src/features/canvas/components/WebsiteLayout.tsx b/products/desktop/packages/ui/src/features/canvas/components/WebsiteLayout.tsxindex d5bda519908c..08c53e908035 100644--- a/products/desktop/packages/ui/src/features/canvas/components/WebsiteLayout.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/WebsiteLayout.tsx@@ -24,9 +24,11 @@ import {DropdownMenuTrigger,} from "@posthog/quill";import { ANALYTICS_EVENTS } from "@posthog/shared/analytics-events";+import { ActivityDetailPane } from "@posthog/ui/features/canvas/components/ActivityDetailPane";import { ChannelBreadcrumb } from "@posthog/ui/features/canvas/components/ChannelBreadcrumb";import { iconForTemplate } from "@posthog/ui/features/canvas/components/canvasTemplateIcon";import { NewCanvasMenu } from "@posthog/ui/features/canvas/components/NewCanvasMenu";+import { SpaceHeaderRow } from "@posthog/ui/features/canvas/components/SpaceHeaderRow";import { deleteCanvasWithUndo } from "@posthog/ui/features/canvas/deleteCanvasWithUndo";import { CanvasFrameHost } from "@posthog/ui/features/canvas/freeform/CanvasFrameHost";import { canvasCommentTaskId } from "@posthog/ui/features/canvas/freeform/canvasCommentTask";@@ -40,6 +42,7 @@ import {useDashboard,useDashboardMutations,} from "@posthog/ui/features/canvas/hooks/useDashboards";+import { useRailSurface } from "@posthog/ui/features/canvas/hooks/useRailSurface";import { useCanvasChatPanelStore } from "@posthog/ui/features/canvas/stores/canvasChatPanelStore";import {useDashboardEditStore,@@ -52,17 +55,16 @@ import {SWITCHER_WIDTH_PX,useRightPanelOpen,} from "@posthog/ui/features/navigation/rightPanelSide";+import { useActiveSession } from "@posthog/ui/features/navigation/useActiveSession";import { buildCommentThreads } from "@posthog/ui/features/sessions/components/commentViewTypes";import { useCommentsQuery } from "@posthog/ui/features/sessions/components/useComments";import {MentionAvailabilityProvider,PRIVATE_SPACE_MENTIONS_DISABLED,} from "@posthog/ui/features/sessions/mentionAvailability";-import { TaskHeaderActions } from "@posthog/ui/features/task-detail/components/TaskHeaderActions";import { useTasks } from "@posthog/ui/features/tasks/useTasks";import { toast } from "@posthog/ui/primitives/toast";import { track } from "@posthog/ui/shell/analytics";-import { useHeaderStore } from "@posthog/ui/shell/headerStore";import { Flex } from "@radix-ui/themes";import { useIsMutating, useQueryClient } from "@tanstack/react-query";import {@@ -352,27 +354,26 @@ export function WebsiteLayout() {const pathname = useRouterState({ select: (s) => s.location.pathname });const params = useParams({ strict: false });- // App pages mirrored into the Channels space (Home, Skills, MCP servers,- // Command Center) are channel-less and push their title into the shared- // header store. With no code HeaderRow here, surface that title in this bar so- // the mirrored pages read the same as in Code.- const headerContent = useHeaderStore((s) => s.content);-const channelId = params.channelId;const dashboardId = params.dashboardId;- const taskId = params.taskId;++ // Activity reads a task into this pane without routing, so the session is+ // not always the one in the URL.+ const { showsActivityDetail } = useRailSurface();+ const { taskId, channelId: taskChannelId } = useActiveSession();+const rightPanelOpen = useRightPanelOpen(taskId);const base = channelId ? `/website/${channelId}` : "/website";const { data: tasks } = useTasks();- const { tasks: filedTasks } = useChannelTasks(channelId);+ const { tasks: filedTasks } = useChannelTasks(taskChannelId);const channelTask = filedTasks.some((record) => record.taskId === taskId)? tasks?.find((task) => task.id === taskId): undefined;const { channels } = useChannels();const mentionsDisabledReason =- channels.find((channel) => channel.id === channelId)?.channelType ===+ channels.find((channel) => channel.id === taskChannelId)?.channelType ==="personal"? PRIVATE_SPACE_MENTIONS_DISABLED: null;@@ -402,17 +403,7 @@ export function WebsiteLayout() {Hidden when the canvas toolbar is showing (grid / a single canvas),and skipped entirely when there is neither a title nor a session'sactions to carry. */}- {!showToolbar && (headerContent || channelTask) && (- <div className="flex h-10 shrink-0 items-center gap-2 border-gray-6 border-b pr-2 pl-1">- <div className="flex h-full min-w-0 flex-1 items-center justify-between overflow-hidden">- {headerContent}- </div>- {/* Rendered without a wrapper: the actions cap themselves at half the- bar, and a wrapper that hugs their content resolves that- percentage against itself, which clips them. */}- {channelTask && <TaskHeaderActions task={channelTask} />}- </div>- )}+ {!showToolbar && <SpaceHeaderRow task={channelTask} />}{/* Single canvas toolbar: the "# channel / canvas" breadcrumb (left) andcanvas actions (Edit / New canvas) on the right.@@ -465,7 +456,7 @@ export function WebsiteLayout() {it. */}<div className="isolate min-w-0 flex-1 overflow-hidden"><MentionAvailabilityProvider disabledReason={mentionsDisabledReason}>- <Outlet />+ {showsActivityDetail ? <ActivityDetailPane /> : <Outlet />}</MentionAvailabilityProvider></div>{/* One panel at a time at the right of the content: the session'sdiff --git a/products/desktop/packages/ui/src/features/canvas/components/openActivityItem.ts b/products/desktop/packages/ui/src/features/canvas/components/openActivityItem.tsnew file mode 100644index 000000000000..00975b7213cb--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/openActivityItem.ts@@ -0,0 +1,30 @@+import type { TaskActivityItem } from "@posthog/core/canvas/taskActivity";+import { useCanvasChatPanelStore } from "@posthog/ui/features/canvas/stores/canvasChatPanelStore";+import { useThreadPanelStore } from "@posthog/ui/features/canvas/stores/threadPanelStore";+import {+ navigateToChannelDashboard,+ navigateToChannelTask,+ navigateToTaskDetail,+} from "@posthog/ui/router/navigationBridge";++/** Where a feed row goes on a surface that navigates. The rail's docked feed+ * reads its row in place instead, so the row hands activation out. */+export function openActivityItem(item: TaskActivityItem): void {+ const { channelId } = item;++ if (channelId && item.commentTarget?.scope === "desktop_canvas") {+ useCanvasChatPanelStore.getState().openComments();+ navigateToChannelDashboard(channelId, item.commentTarget.itemId);+ return;+ }+ // The channel thread route is the deep-link target; unfiled tasks fall back+ // to the plain task view.+ if (channelId) {+ if (item.commentId) {+ useThreadPanelStore.getState().setCollapsed(false);+ }+ navigateToChannelTask(channelId, item.taskId);+ return;+ }+ navigateToTaskDetail(item.taskId);+}diff --git a/products/desktop/packages/ui/src/features/canvas/components/railDestinations.ts b/products/desktop/packages/ui/src/features/canvas/components/railDestinations.tsnew file mode 100644index 000000000000..4c1e86efb5b8--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/railDestinations.ts@@ -0,0 +1,164 @@+import {+ BellIcon,+ EnvelopeSimple,+ HouseSimple,+ type IconProps,+ Lightning,+} from "@phosphor-icons/react";+import type { SidebarNavItem } from "@posthog/shared/analytics-events";+import { SpacesIcon } from "@posthog/ui/features/canvas/components/SpacesIcon";+import { showChannelList } from "@posthog/ui/features/canvas/stores/channelPaneStore";+import type { NavRailPane } from "@posthog/ui/features/canvas/stores/navRailStore";+import {+ formatHotkey,+ SHORTCUTS,+} from "@posthog/ui/features/command/keyboard-shortcuts";+import {+ type CustomizableNavItemId,+ isNavItemVisible,+ type NavItemOverrides,+} from "@posthog/ui/features/sidebar/constants";+import type { CountBadgeTone } from "@posthog/ui/primitives/CountBadge";+import { LoopIcon } from "@posthog/ui/primitives/LoopIcon";+import {+ navigateToActivity,+ navigateToHome,+ navigateToInbox,+ navigateToLoops,+ navigateToWebsiteCommandCenter,+} from "@posthog/ui/router/navigationBridge";+import type { AppViewType } from "@posthog/ui/router/useAppView";+import type { ComponentType } from "react";++export interface RailCounts {+ inbox: number;+ activity: number;+ commandCenter: number;+}++export interface RailDestination {+ pane: NavRailPane;+ label: string;+ analyticsId: SidebarNavItem;+ Icon: ComponentType<IconProps>;+ viewTypes: readonly AppViewType[];+ onPick?: (ctx: { inWebsiteTree: boolean }) => void;+ customizableId?: CustomizableNavItemId;+ shortcut?: string;+ count?: (counts: RailCounts) => number;+ countTone?: CountBadgeTone;+ enabled?: (flags: { loops: boolean }) => boolean;+}++export const RAIL_DESTINATIONS: readonly RailDestination[] = [+ {+ pane: "home",+ label: "Home",+ analyticsId: "home",+ Icon: HouseSimple,+ viewTypes: ["home"],+ onPick: navigateToHome,+ },+ {+ pane: "spaces",+ label: "Spaces",+ analyticsId: "spaces",+ Icon: SpacesIcon,+ viewTypes: [],+ onPick: showChannelList,+ },+ {+ pane: "activity",+ customizableId: "activity",+ label: "Activity",+ analyticsId: "activity",+ Icon: BellIcon,+ viewTypes: ["activity"],+ onPick: ({ inWebsiteTree }) => {+ if (!inWebsiteTree) navigateToActivity();+ },+ count: (counts) => counts.activity,+ },+ {+ pane: "inbox",+ customizableId: "inbox",+ label: "Inbox",+ analyticsId: "inbox",+ Icon: EnvelopeSimple,+ viewTypes: ["inbox"],+ onPick: navigateToInbox,+ shortcut: formatHotkey(SHORTCUTS.INBOX),+ count: (counts) => counts.inbox,+ },+ {+ pane: "command-center",+ customizableId: "command-center",+ label: "Command Center",+ analyticsId: "command_center",+ Icon: Lightning,+ viewTypes: ["command-center"],+ onPick: navigateToWebsiteCommandCenter,+ count: (counts) => counts.commandCenter,+ countTone: "neutral",+ },+ {+ pane: "loops",+ customizableId: "loops",+ label: "Loops",+ analyticsId: "loops",+ Icon: LoopIcon,+ viewTypes: ["loops"],+ onPick: () => navigateToLoops(),+ enabled: (flags) => flags.loops,+ },+];++const PANE_BY_VIEW_TYPE = new Map<AppViewType, NavRailPane>(+ RAIL_DESTINATIONS.flatMap((destination) =>+ destination.viewTypes.map((viewType) => [viewType, destination.pane]),+ ),+);++/** Which destination a route belongs to. Unclaimed routes belong to Spaces. */+export function paneForView(viewType: AppViewType): NavRailPane {+ return PANE_BY_VIEW_TYPE.get(viewType) ?? "spaces";+}++// Deliberately not the shared `orderedNavItems`: its adjacency rule pins+// Activity below Inbox, and the rail puts Activity first.+export function visibleRailDestinations({+ overrides,+ order,+ loops,+}: {+ overrides: NavItemOverrides;+ order: readonly CustomizableNavItemId[];+ loops: boolean;+}): readonly RailDestination[] {+ const shown = RAIL_DESTINATIONS.filter(+ ({ customizableId, enabled }) =>+ (enabled?.({ loops }) ?? true) &&+ (!customizableId || isNavItemVisible(overrides, customizableId)),+ );+ if (order.length === 0) return shown;++ const rank = new Map(order.map((id, index) => [id, index]));+ const positions = shown+ .map((_, index) => index)+ .filter((index) => {+ const id = shown[index].customizableId;+ return id !== undefined && rank.has(id);+ });+ const reordered = positions+ .map((index) => shown[index])+ .sort(+ (a, b) =>+ (rank.get(a.customizableId as CustomizableNavItemId) ?? 0) -+ (rank.get(b.customizableId as CustomizableNavItemId) ?? 0),+ );+ const result = [...shown];+ positions.forEach((position, i) => {+ result[position] = reordered[i];+ });+ return result;+}diff --git a/products/desktop/packages/ui/src/features/canvas/grid/WebsiteHome.tsx b/products/desktop/packages/ui/src/features/canvas/grid/WebsiteHome.tsxindex 6c992b83f77e..6e2131747826 100644--- a/products/desktop/packages/ui/src/features/canvas/grid/WebsiteHome.tsx+++ b/products/desktop/packages/ui/src/features/canvas/grid/WebsiteHome.tsx@@ -89,7 +89,9 @@ export function WebsiteHome() {return (<div className="flex h-full flex-col"><div className="flex shrink-0 items-center justify-between border-(--gray-4) border-b px-4 py-2">- <Heading size="lg">Home</Heading>+ <Heading size="lg" className="font-bold">+ Home+ </Heading><Buttonvariant={editing ? "primary" : "outline"}size="sm"diff --git a/products/desktop/packages/ui/src/features/canvas/hooks/useRailSurface.ts b/products/desktop/packages/ui/src/features/canvas/hooks/useRailSurface.tsnew file mode 100644index 000000000000..c8e7ddb68dff--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/hooks/useRailSurface.ts@@ -0,0 +1,25 @@+import { useChannelsLayout } from "@posthog/ui/features/canvas/hooks/useChannelsLayout";+import {+ type NavRailPane,+ railPaneHasSidebar,+ useNavRailStore,+} from "@posthog/ui/features/canvas/stores/navRailStore";++export interface RailSurface {+ pane: NavRailPane;+ hasSidebar: boolean;+ showsActivityDetail: boolean;+}++/** What the rail is putting on screen. The one answer, for all three surfaces+ * that need it. */+export function useRailSurface(): RailSurface {+ const channelsLayout = useChannelsLayout();+ const pane = useNavRailStore((s) => s.pane);++ return {+ pane,+ hasSidebar: !channelsLayout || railPaneHasSidebar(pane),+ showsActivityDetail: channelsLayout && pane === "activity",+ };+}diff --git a/products/desktop/packages/ui/src/features/canvas/stores/activityDetailStore.ts b/products/desktop/packages/ui/src/features/canvas/stores/activityDetailStore.tsnew file mode 100644index 000000000000..33517f8dc52e--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/stores/activityDetailStore.ts@@ -0,0 +1,28 @@+import type { TaskActivityItem } from "@posthog/core/canvas/taskActivity";+import { create } from "zustand";++export interface ActivitySelection {+ id: string;+ taskId: string;+ channelId: string | null;+}++interface ActivityDetailState {+ /** Held here rather than in the URL: routing away from Activity would take+ * the feed off the screen you are reading it from. */+ selected: ActivitySelection | null;+ select: (selection: ActivitySelection | null) => void;+}++export const useActivityDetailStore = create<ActivityDetailState>()((set) => ({+ selected: null,+ select: (selected) => set({ selected }),+}));++export function selectActivityItem(item: TaskActivityItem): void {+ useActivityDetailStore.getState().select({+ id: item.id,+ taskId: item.taskId,+ channelId: item.channelId,+ });+}diff --git a/products/desktop/packages/ui/src/features/canvas/stores/navRailStore.ts b/products/desktop/packages/ui/src/features/canvas/stores/navRailStore.tsnew file mode 100644index 000000000000..64b07d87ae2d--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/stores/navRailStore.ts@@ -0,0 +1,29 @@+import { create } from "zustand";++/**+ * Which rail destination is selected. Only Spaces and Activity own the column+ * beside the rail; the rest are whole-screen and collapse it away.+ */+export type NavRailPane =+ | "home"+ | "spaces"+ | "activity"+ | "inbox"+ | "command-center"+ | "loops";++const PANES_WITH_SIDEBAR = new Set<NavRailPane>(["spaces", "activity"]);++export function railPaneHasSidebar(pane: NavRailPane): boolean {+ return PANES_WITH_SIDEBAR.has(pane);+}++interface NavRailState {+ pane: NavRailPane;+ setPane: (pane: NavRailPane) => void;+}++export const useNavRailStore = create<NavRailState>()((set) => ({+ pane: "spaces",+ setPane: (pane) => set({ pane }),+}));diff --git a/products/desktop/packages/ui/src/features/navigation/components/RightPanel.tsx b/products/desktop/packages/ui/src/features/navigation/components/RightPanel.tsxindex 05109eec2b44..4327d6853120 100644--- a/products/desktop/packages/ui/src/features/navigation/components/RightPanel.tsx+++ b/products/desktop/packages/ui/src/features/navigation/components/RightPanel.tsx@@ -26,6 +26,7 @@ import {SIDES,SWITCHER_WIDTH_PX,} from "@posthog/ui/features/navigation/rightPanelSide";+import { useActiveSession } from "@posthog/ui/features/navigation/useActiveSession";import { useCommentFocusRequest } from "@posthog/ui/features/sessions/useCommentFocusRequest";import {useSessionArtifactCount,@@ -36,7 +37,6 @@ import { useTasks } from "@posthog/ui/features/tasks/useTasks";import { useIsCloudTask } from "@posthog/ui/features/workspace/useWorkspace";import { useParentWidth } from "@posthog/ui/primitives/hooks/useObservedWidth";import { useQuery } from "@tanstack/react-query";-import { useParams } from "@tanstack/react-router";import {memo,type ReactNode,@@ -219,7 +219,7 @@ function useDrawnSide(/** Every side belongs to a session, so nothing below this runs elsewhere. */export function RightPanel() {- const taskId = useParams({ strict: false }).taskId;+ const { taskId } = useActiveSession();// Keyed by session: carrying per-session state across a navigation draws the// previous session's panel over the new one for a frame.return taskId ? <SessionRightPanel key={taskId} taskId={taskId} /> : null;diff --git a/products/desktop/packages/ui/src/features/navigation/useActiveSession.ts b/products/desktop/packages/ui/src/features/navigation/useActiveSession.tsnew file mode 100644index 000000000000..cb2dba92c833--- /dev/null+++ b/products/desktop/packages/ui/src/features/navigation/useActiveSession.ts@@ -0,0 +1,26 @@+import { useRailSurface } from "@posthog/ui/features/canvas/hooks/useRailSurface";+import { useActivityDetailStore } from "@posthog/ui/features/canvas/stores/activityDetailStore";+import { useParams } from "@tanstack/react-router";++export interface ActiveSession {+ taskId: string | undefined;+ channelId: string | undefined;+}++/**+ * Which session the chrome around the content pane is about. The route names it+ * everywhere except Activity, which reads a task into the pane without routing.+ */+export function useActiveSession(): ActiveSession {+ const { showsActivityDetail } = useRailSurface();+ const selected = useActivityDetailStore((s) => s.selected);+ const params = useParams({ strict: false });++ if (showsActivityDetail) {+ return {+ taskId: selected?.taskId,+ channelId: selected?.channelId ?? undefined,+ };+ }+ return { taskId: params.taskId, channelId: params.channelId };+}diff --git a/products/desktop/packages/ui/src/features/navigation/useReviewInRightPanel.test.ts b/products/desktop/packages/ui/src/features/navigation/useReviewInRightPanel.test.tsnew file mode 100644index 000000000000..dfe4e063858f--- /dev/null+++ b/products/desktop/packages/ui/src/features/navigation/useReviewInRightPanel.test.ts@@ -0,0 +1,52 @@+import { renderHook } from "@testing-library/react";+import { beforeEach, describe, expect, it, vi } from "vitest";++const mocks = vi.hoisted(() => ({+ channelsLayout: true,+ routeParams: {} as { taskId?: string; channelId?: string },+}));++vi.mock("@posthog/ui/features/canvas/hooks/useChannelsLayout", () => ({+ useChannelsLayout: () => mocks.channelsLayout,+}));+vi.mock("@tanstack/react-router", () => ({+ useParams: () => mocks.routeParams,+}));++import { useActivityDetailStore } from "@posthog/ui/features/canvas/stores/activityDetailStore";+import { useNavRailStore } from "@posthog/ui/features/canvas/stores/navRailStore";+import { useReviewInRightPanel } from "./useReviewInRightPanel";++describe("useReviewInRightPanel", () => {+ beforeEach(() => {+ mocks.channelsLayout = true;+ mocks.routeParams = {};+ useNavRailStore.setState({ pane: "spaces" });+ useActivityDetailStore.setState({ selected: null });+ });++ it("hands the review to the panel for a task opened through a space", () => {+ mocks.routeParams = { channelId: "chan-1", taskId: "task-1" };++ expect(renderHook(() => useReviewInRightPanel()).result.current).toBe(true);+ });++ // The regression: no channel in the URL left both surfaces drawing the diff.+ it("hands it over for a task read from the activity feed too", () => {+ useNavRailStore.setState({ pane: "activity" });+ useActivityDetailStore.setState({+ selected: { id: "a1", taskId: "task-1", channelId: null },+ });++ expect(renderHook(() => useReviewInRightPanel()).result.current).toBe(true);+ });++ it("leaves it with the session outside the spaces layout", () => {+ mocks.channelsLayout = false;+ mocks.routeParams = { channelId: "chan-1", taskId: "task-1" };++ expect(renderHook(() => useReviewInRightPanel()).result.current).toBe(+ false,+ );+ });+});diff --git a/products/desktop/packages/ui/src/features/navigation/useReviewInRightPanel.ts b/products/desktop/packages/ui/src/features/navigation/useReviewInRightPanel.tsindex 22770a2258f8..e8aaa35a0188 100644--- a/products/desktop/packages/ui/src/features/navigation/useReviewInRightPanel.ts+++ b/products/desktop/packages/ui/src/features/navigation/useReviewInRightPanel.ts@@ -1,13 +1,13 @@import { useChannelsLayout } from "@posthog/ui/features/canvas/hooks/useChannelsLayout";-import { useParams } from "@tanstack/react-router";+import { useActiveSession } from "@posthog/ui/features/navigation/useActiveSession";/*** Whether a session's review belongs to the shared right panel rather than to- * the surface asking. Three places turn on this: the panel draws the review,- * the session's own review pane stands down, and the controls that opened the- * review from elsewhere come off, because the panel's switcher owns it now.+ * the surface asking. Keyed on the session, not the route's channel: Activity+ * puts no channel in the URL, and asking for one there left both surfaces+ * drawing the diff.*/export function useReviewInRightPanel(): boolean {- const channelId = useParams({ strict: false }).channelId;- return useChannelsLayout() && channelId != null;+ const { taskId } = useActiveSession();+ return useChannelsLayout() && taskId != null;}diff --git a/products/desktop/packages/ui/src/features/sidebar/components/ProjectSwitcher.tsx b/products/desktop/packages/ui/src/features/sidebar/components/ProjectSwitcher.tsxindex 6b5d8880f3eb..0d4994e425be 100644--- a/products/desktop/packages/ui/src/features/sidebar/components/ProjectSwitcher.tsx+++ b/products/desktop/packages/ui/src/features/sidebar/components/ProjectSwitcher.tsx@@ -13,6 +13,7 @@ import {SignOut,} from "@phosphor-icons/react";import {+ Button,DropdownMenu,DropdownMenuContent,DropdownMenuGroup,@@ -56,8 +57,14 @@ import { getPostHogUrl } from "@posthog/ui/utils/urls";import { Avatar, Box } from "@radix-ui/themes";import { useMemo, useState } from "react";-/** The account / project / org menu at the bottom of the sidebar. */-export function ProjectSwitcher() {+interface ProjectSwitcherProps {+ appearance?: "row" | "icon";+}++/** The account / project / org menu. */+export function ProjectSwitcher({+ appearance = "row",+}: ProjectSwitcherProps = {}) {const [popoverOpen, setPopoverOpen] = useState(false);const holdPeek = useHoldSidebarPeek();@@ -82,6 +89,10 @@ export function ProjectSwitcher() {const archivedTaskIds = useArchivedTaskIds();const showArchived = channelsLayout && archivedTaskIds.size > 0;+ const isIcon = appearance === "icon";+ const projectName = currentProject?.name ?? "No project selected";+ const projectInitials = projectName.slice(0, 2);+const currentOrgGroup =groupedProjects.find((group) => group.orgId === currentOrgId) ?? null;const currentOrgName =@@ -196,27 +207,42 @@ export function ProjectSwitcher() {<DropdownMenu open={popoverOpen} onOpenChange={handleOpenChange}><DropdownMenuTriggerrender={- <Item- size="xs"- className="border-transparent bg-fill-hover py-1.5 hover:bg-fill-selected aria-expanded:bg-fill-active"- >- <ItemContent className="select-none gap-0">- <ItemTitle>- {currentProject?.name ?? "No project selected"}- </ItemTitle>- <ItemDescription className="text-[11px]">- {impersonationExpiry &&- `Impersonating until ${impersonationExpiry}`}- </ItemDescription>- </ItemContent>- </Item>+ isIcon ? (+ <Button+ variant="default"+ size="icon"+ aria-label={projectName}+ className="shrink-0 bg-fill-hover font-semibold text-[11px] text-muted-foreground uppercase hover:bg-fill-selected aria-expanded:bg-fill-active"+ >+ {projectInitials}+ </Button>+ ) : (+ <Item+ size="xs"+ className="border-transparent bg-fill-hover py-1.5 hover:bg-fill-selected aria-expanded:bg-fill-active"+ >+ <ItemContent className="select-none gap-0">+ <ItemTitle>{projectName}</ItemTitle>+ <ItemDescription className="text-[11px]">+ {impersonationExpiry &&+ `Impersonating until ${impersonationExpiry}`}+ </ItemDescription>+ </ItemContent>+ </Item>+ )}/><DropdownMenuContent- align="start"- side="bottom"- className="w-(--anchor-width) max-w-(--anchor-width) pt-0"+ align={isIcon ? "end" : "start"}+ side={isIcon ? "right" : "bottom"}+ // The rail trigger is one icon wide, so anchor-width would squeeze the+ // menu to nothing.+ className={+ isIcon+ ? "w-64 pt-0"+ : "w-(--anchor-width) max-w-(--anchor-width) pt-0"+ }sideOffset={4}><Box>diff --git a/products/desktop/packages/ui/src/features/sidebar/components/SidebarNavSection.test.tsx b/products/desktop/packages/ui/src/features/sidebar/components/SidebarNavSection.test.tsxindex f3263a61f2b7..44cbd58d7c9f 100644--- a/products/desktop/packages/ui/src/features/sidebar/components/SidebarNavSection.test.tsx+++ b/products/desktop/packages/ui/src/features/sidebar/components/SidebarNavSection.test.tsx@@ -144,7 +144,7 @@ describe("SidebarNavSection", () => {await user.click(screen.getByRole("button", { name: /Inbox/ }));expect(navigateToInbox).toHaveBeenCalledTimes(1);- // `layout` separates these from ChannelNav's identically-named clicks.+ // `layout` separates these from the nav rail's identically-named clicks.expect(track).toHaveBeenCalledWith(ANALYTICS_EVENTS.SIDEBAR_NAV_ITEM_CLICKED,{ item: "inbox", in_more: false, layout: "code" },diff --git a/products/desktop/packages/ui/src/features/sidebar/constants.ts b/products/desktop/packages/ui/src/features/sidebar/constants.tsindex a7e10425ef1a..d563d357e172 100644--- a/products/desktop/packages/ui/src/features/sidebar/constants.ts+++ b/products/desktop/packages/ui/src/features/sidebar/constants.ts@@ -10,6 +10,10 @@ export const SIDEBAR_MIN_WIDTH = 240;*/export const CHANNELS_SIDEBAR_MIN_WIDTH = 272;+/** Sits outside the sidebar, so anything measuring from the window's left edge+ * has to add it. */+export const NAV_RAIL_WIDTH = 44;+export const CUSTOMIZABLE_NAV_ITEMS = [{ id: "inbox", label: "Inbox", analyticsId: "inbox", defaultVisible: true },{diff --git a/products/desktop/packages/ui/src/features/tasks/useResolvedTask.ts b/products/desktop/packages/ui/src/features/tasks/useResolvedTask.tsnew file mode 100644index 000000000000..fd8271fcd12a--- /dev/null+++ b/products/desktop/packages/ui/src/features/tasks/useResolvedTask.ts@@ -0,0 +1,39 @@+import type { Task } from "@posthog/shared/domain-types";+import { useTaskViewed } from "@posthog/ui/features/sidebar/useTaskViewed";+import {+ getCachedTask,+ getCachedTaskDetail,+ taskDetailQuery,+} from "@posthog/ui/features/tasks/queries";+import { pickFreshestTask } from "@posthog/ui/features/tasks/taskFreshness";+import { useTasks } from "@posthog/ui/features/tasks/useTasks";+import { useQuery } from "@tanstack/react-query";+import { useEffect } from "react";++/**+ * Turn a task id into something renderable, and count that as a view. The list+ * copy and the cache stand in until the detail fetch lands; freshness picks+ * between them, because a poll can hand back an older run than the one already+ * on screen.+ */+export function useResolvedTask(taskId: string | undefined): Task | undefined {+ const { data: tasks } = useTasks();+ const { markAsViewed } = useTaskViewed();++ const { data: fetched } = useQuery({+ ...taskDetailQuery(taskId ?? ""),+ enabled: Boolean(taskId),+ });++ useEffect(() => {+ if (taskId) markAsViewed(taskId);+ }, [taskId, markAsViewed]);++ if (!taskId) return undefined;+ const known =+ tasks?.find((task) => task.id === taskId) ??+ getCachedTaskDetail(taskId) ??+ getCachedTask(taskId) ??+ undefined;+ return pickFreshestTask(fetched, known);+}diff --git a/products/desktop/packages/ui/src/primitives/ResizableSidebar.tsx b/products/desktop/packages/ui/src/primitives/ResizableSidebar.tsxindex 9b434802579d..e924b4e4ffc4 100644--- a/products/desktop/packages/ui/src/primitives/ResizableSidebar.tsx+++ b/products/desktop/packages/ui/src/primitives/ResizableSidebar.tsx@@ -40,6 +40,8 @@ interface ResizableSidebarProps {// What the resize grip says once the pointer has rested on it. Defaults to// the bare "Resize"; a panel with a shortcut of its own passes that too.resizeTooltip?: React.ReactNode;+ // Off when the child draws its own frame; two owners of an edge double it.+ drawEdge?: boolean;}export const ResizableSidebar: React.FC<ResizableSidebarProps> = ({@@ -58,6 +60,7 @@ export const ResizableSidebar: React.FC<ResizableSidebarProps> = ({onPeekLeave,onPeekDismiss,resizeTooltip = "Resize",+ drawEdge = true,}) => {// Whether the active drag started on the docked sidebar or the floating// (peek) one — dragging back out must restore the same mode it closed from.@@ -183,8 +186,10 @@ export const ResizableSidebar: React.FC<ResizableSidebarProps> = ({width: open ? `${width}px` : `${collapsedWidth}px`,minWidth: open ? `${width}px` : `${collapsedWidth}px`,maxWidth: open ? `${width}px` : `${collapsedWidth}px`,- borderLeft: !isLeft && open ? "1px solid var(--border)" : "none",- borderRight: isLeft && open ? "1px solid var(--border)" : "none",+ borderLeft:+ drawEdge && !isLeft && open ? "1px solid var(--border)" : "none",+ borderRight:+ drawEdge && isLeft && open ? "1px solid var(--border)" : "none",}}className="relative h-full shrink-0">@@ -212,8 +217,8 @@ export const ResizableSidebar: React.FC<ResizableSidebarProps> = ({}}className={isOverlay- ? `absolute inset-y-0 z-50 flex h-full min-w-0 flex-col border-border bg-chrome transition-transform duration-200 ease-out motion-reduce:transition-none ${- isLeft ? "left-0 border-r" : "right-0 border-l"+ ? `absolute inset-y-0 z-50 flex h-full min-w-0 flex-col border-border bg-chrome transition-transform duration-200 ease-out motion-reduce:transition-none ${isLeft ? "left-0" : "right-0"} ${+ drawEdge ? (isLeft ? "border-r" : "border-l") : ""} ${// Shadow only while shown — at translateX(-100%) the panel's// edge sits exactly on x=0 and an always-on shadow would paintdiff --git a/products/desktop/packages/ui/src/primitives/hooks/useSidebarEdgeHoverPeek.ts b/products/desktop/packages/ui/src/primitives/hooks/useSidebarEdgeHoverPeek.tsindex 40ec2e7ae18e..0ca382964c5b 100644--- a/products/desktop/packages/ui/src/primitives/hooks/useSidebarEdgeHoverPeek.ts+++ b/products/desktop/packages/ui/src/primitives/hooks/useSidebarEdgeHoverPeek.ts@@ -32,6 +32,9 @@ interface UseSidebarEdgeHoverPeekOptions {peeked: boolean;side: "left" | "right";width: number;+ // Distance from the window edge to the panel's own. Chrome pinned outside+ // the panel owns those pixels.+ offset?: number;onReveal: () => void;onClose: () => void;}@@ -41,11 +44,28 @@ export function useSidebarEdgeHoverPeek({peeked,side,width,+ offset = 0,onReveal,onClose,}: UseSidebarEdgeHoverPeekOptions): void {- const stateRef = useRef({ enabled, peeked, side, width, onReveal, onClose });- stateRef.current = { enabled, peeked, side, width, onReveal, onClose };+ const stateRef = useRef({+ enabled,+ peeked,+ side,+ width,+ offset,+ onReveal,+ onClose,+ });+ stateRef.current = {+ enabled,+ peeked,+ side,+ width,+ offset,+ onReveal,+ onClose,+ };useEffect(() => {let wasInside = false;@@ -53,7 +73,8 @@ export function useSidebarEdgeHoverPeek({const handleMouseMove = (e: MouseEvent) => {const state = stateRef.current;const pointer =- state.side === "left" ? e.clientX : window.innerWidth - e.clientX;+ (state.side === "left" ? e.clientX : window.innerWidth - e.clientX) -+ state.offset;if (state.enabled) {if (state.peeked) {diff --git a/products/desktop/packages/ui/src/router/routes/__root.tsx b/products/desktop/packages/ui/src/router/routes/__root.tsxindex 2de0cbacac51..8f3fae767ca2 100644--- a/products/desktop/packages/ui/src/router/routes/__root.tsx+++ b/products/desktop/packages/ui/src/router/routes/__root.tsx@@ -4,7 +4,7 @@ import {CaretRightIcon,} from "@phosphor-icons/react";import { useHostTRPC, useHostTRPCClient } from "@posthog/host-router/react";-import { Button, ButtonGroup } from "@posthog/quill";+import { Button, ButtonGroup, cn } from "@posthog/quill";import { BILLING_FLAG, PROJECT_BLUEBIRD_FLAG } from "@posthog/shared";import { ANALYTICS_EVENTS } from "@posthog/shared/analytics-events";import { isContentlessTask } from "@posthog/shared/domain-types";@@ -20,15 +20,18 @@ import { BrowserTabsDndProvider } from "@posthog/ui/features/browser-tabs/Browseimport { TabShortcutFallback } from "@posthog/ui/features/browser-tabs/TabShortcutFallback";import { useActiveTabIsBlank } from "@posthog/ui/features/browser-tabs/useBrowserTabs";import { ChannelHotkeys } from "@posthog/ui/features/canvas/components/ChannelHotkeys";+import { ChannelRouteSync } from "@posthog/ui/features/canvas/components/ChannelRouteSync";import { ChannelsSidebar } from "@posthog/ui/features/canvas/components/ChannelsSidebar";import { useChannelsSidebarStore } from "@posthog/ui/features/canvas/components/channelsSidebarStore";import {FeedbackModal,type FeedbackModalMode,} from "@posthog/ui/features/canvas/components/FeedbackModal";+import { NavRail } from "@posthog/ui/features/canvas/components/NavRail";import { useCanvasDeepLink } from "@posthog/ui/features/canvas/hooks/useCanvasDeepLink";import { useChannelDeepLink } from "@posthog/ui/features/canvas/hooks/useChannelDeepLink";import { useChannelsLayout } from "@posthog/ui/features/canvas/hooks/useChannelsLayout";+import { useRailSurface } from "@posthog/ui/features/canvas/hooks/useRailSurface";import { useShareLinkInterceptor } from "@posthog/ui/features/canvas/hooks/useShareLinkInterceptor";import { usePostHogWebFeedbackStore } from "@posthog/ui/features/canvas/stores/posthogWebFeedbackStore";import { CommandMenu } from "@posthog/ui/features/command/CommandMenu";@@ -45,6 +48,7 @@ import { useIntegrations } from "@posthog/ui/features/integrations/useIntegratioimport { useLoopDeepLink } from "@posthog/ui/features/loops/hooks/useLoopDeepLink";import { useScoutDeepLink } from "@posthog/ui/features/scouts/hooks/useScoutDeepLink";import { useSetupDiscovery } from "@posthog/ui/features/setup/useSetupDiscovery";+import { NAV_RAIL_WIDTH } from "@posthog/ui/features/sidebar/constants";import {beginSidebarPeek,cancelSidebarPeek,@@ -205,9 +209,16 @@ function RootLayout() {// The new channels layout has exactly one gate: its feature flag (no// sidebar toggle). When on it subsumes the channels alpha entirely.const channelsLayout = useChannelsLayout();+ const { hasSidebar } = useRailSurface();// When the sidebar is collapsed (Cmd+B) the title bar's left block shrinks to// fit its own controls so the tab strip flushes left with the content pane.const sidebarOpen = useSidebarStore((s) => s.open);+ // On screen, not merely un-collapsed: a destination with no list takes the+ // column away whatever the open flag says.+ const sidebarDocked = sidebarOpen && hasSidebar;+ // The corner belongs to whichever pane starts the framed inset.+ const framesOwnCorner = channelsLayout ? !sidebarDocked : sidebarDocked;+const toggleSidebar = useSidebarStore((s) => s.toggle);const sidebarPeek = useSidebarPeekStore((s) => s.peek);// Toggling makes any hover-peek redundant (opening replaces the overlay;@@ -369,7 +380,9 @@ function RootLayout() {// over- or under-shoots; the env var fallback covers hosts// without Window Controls Overlay.paddingLeft: isMac ? "env(titlebar-area-x, 78px)" : "78px",- width: sidebarOpen ? channelsSidebarWidth : undefined,+ width: sidebarDocked+ ? channelsSidebarWidth + (channelsLayout ? NAV_RAIL_WIDTH : 0)+ : undefined,}}><Flex align="center" gap="2" className="no-drag">@@ -462,14 +475,25 @@ function RootLayout() {}`}/>)}- <ChannelsSidebar />+ {/* Outside the sidebar on purpose: collapsing the sidebar (Cmd+B)+ must not take the destinations with it. */}+ {channelsLayout && <NavRail />}+ {hasSidebar && <ChannelsSidebar />}{/* Content sits in a bordered, rounded card inset from the window- edges — the framed pane from the design. */}+ edges — the framed pane from the design. The rounded corner+ belongs to whichever pane starts the inset: the sidebar when it+ is docked, this pane when it isn't and the rail holds the edge.+ Without a rail there is nothing to inset from until the sidebar+ opens, which is the corner this pane kept before. */}<Box flexGrow="1" className="overflow-hidden"><Box- className={`h-full overflow-hidden border-border border-t border-l bg-background ${- sidebarOpen ? "rounded-tl-sm" : ""- }`}+ className={cn(+ "h-full overflow-hidden border-border border-t bg-background",+ // A docked sidebar already draws this edge; two owners stack+ // two 1px lines into one seam.+ !sidebarDocked && "border-l",+ framesOwnCorner && "rounded-tl-sm",+ )}><Flex direction="column" height="100%">{/* Inside the framed pane, not the app column: announcements@@ -502,6 +526,10 @@ function RootLayout() {rather than in the switcher, which only exists once a channel isalready scoped. */}<ChannelHotkeys />+ {/* Renders nothing — owns which space is scoped. The sidebar used to,+ but the rail can take that column away and the scoping still has to+ happen. */}+ <ChannelRouteSync />{/* Renders nothing — wires the ⌥↑/⌥↓ task-cycling shortcuts. */}<SpaceSwitchertasks={visualTaskOrder}