: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): add cross-space canvases navigation (#88392)
Adam Leithcdf420ef67e3
diff --git a/products/desktop/packages/core/src/canvas/canvas.module.ts b/products/desktop/packages/core/src/canvas/canvas.module.tsindex 754d1dbdab54..0f2560f23e2a 100644--- a/products/desktop/packages/core/src/canvas/canvas.module.ts+++ b/products/desktop/packages/core/src/canvas/canvas.module.ts@@ -1,12 +1,14 @@import { ContainerModule } from "inversify";import { CanvasApplicationService } from "./canvasApplicationService";import { CanvasDataService } from "./canvasDataService";+import { CanvasListService } from "./canvasListService";import { CanvasTemplatesService } from "./canvasTemplatesService";import { ChannelTasksService } from "./channelTasksService";import { DashboardsService } from "./dashboardsService";import {CANVAS_APPLICATION_SERVICE,CANVAS_DATA_SERVICE,+ CANVAS_LIST_SERVICE,CANVAS_TEMPLATES_SERVICE,CHANNEL_TASKS_SERVICE,DASHBOARDS_SERVICE,@@ -35,11 +37,13 @@ export const canvasCoreModule = new ContainerModule(({ bind }) => {bind(CANVAS_TEMPLATES_SERVICE).toService(CanvasTemplatesService);});-// Canvas generation orchestration. Bound separately from canvasCoreModule-// because it runs where tasks are created (the desktop renderer / web app-// container, which bind TASK_SERVICE and the model/title helpers), while-// canvasCoreModule's persistence services run host-side behind tRPC.+// Portable canvas application policy. Bound separately from canvasCoreModule+// because it runs in the desktop renderer and web app, while canvasCoreModule's+// persistence services run host-side behind tRPC.export const canvasApplicationModule = new ContainerModule(({ bind }) => {+ bind(CanvasListService).toSelf().inSingletonScope();+ bind(CANVAS_LIST_SERVICE).toService(CanvasListService);+bind(CanvasApplicationService).toSelf().inSingletonScope();bind(CANVAS_APPLICATION_SERVICE).toService(CanvasApplicationService);});diff --git a/products/desktop/packages/core/src/canvas/canvasListService.test.ts b/products/desktop/packages/core/src/canvas/canvasListService.test.tsnew file mode 100644index 000000000000..bfdbcdd932bb--- /dev/null+++ b/products/desktop/packages/core/src/canvas/canvasListService.test.ts@@ -0,0 +1,222 @@+import { describe, expect, it } from "vitest";+import {+ CanvasListService,+ type CanvasListSettings,+ DEFAULT_CANVAS_LIST_SETTINGS,+} from "./canvasListService";+import type { DashboardRecord } from "./dashboardSchemas";++const CURRENT_USER = { uuid: "me", name: "Current User" };+const SPACES = [+ { id: "personal", name: "me", channelType: "personal" as const },+ { id: "space-a", name: "alpha", channelType: "public" as const },+ { id: "space-b", name: "beta", channelType: "public" as const },+];++function canvas(+ id: string,+ overrides: Partial<DashboardRecord> = {},+): DashboardRecord {+ return {+ id,+ channelId: "space-a",+ name: id,+ kind: "freeform",+ description: "",+ componentMeta: null,+ templateId: "freeform",+ context: "",+ generationTaskId: null,+ createdAt: 1,+ updatedAt: 1,+ currentVersionId: null,+ publishedBuildId: null,+ ...overrides,+ };+}++function settings(+ overrides: Partial<CanvasListSettings> = {},+): CanvasListSettings {+ return { ...DEFAULT_CANVAS_LIST_SETTINGS, ...overrides };+}++function buildViewModel(+ canvases: DashboardRecord[],+ listSettings: CanvasListSettings = DEFAULT_CANVAS_LIST_SETTINGS,+) {+ return new CanvasListService().buildViewModel({+ canvases,+ spaces: SPACES,+ currentUser: CURRENT_USER,+ settings: listSettings,+ query: "",+ lastViewedAtByCanvasId: {},+ now: new Date(2026, 7, 20, 12),+ });+}++describe("CanvasListService", () => {+ it("combines space, creator, and search filters", () => {+ const service = new CanvasListService();+ const viewModel = service.buildViewModel({+ canvases: [+ canvas("match", {+ channelId: "space-a",+ createdByUuid: "ada",+ description: "revenue report",+ }),+ canvas("wrong-space", {+ channelId: "space-b",+ createdByUuid: "ada",+ description: "revenue report",+ }),+ canvas("wrong-creator", {+ channelId: "space-a",+ createdByUuid: "grace",+ description: "revenue report",+ }),+ ],+ spaces: SPACES,+ currentUser: CURRENT_USER,+ settings: settings({+ spaceIds: ["space-a"],+ creatorUuids: ["ada"],+ }),+ query: "revenue",+ lastViewedAtByCanvasId: {},+ });++ expect(viewModel.canvases.map(({ id }) => id)).toEqual(["match"]);+ });++ it.each([+ {+ sort: "recently_viewed" as const,+ views: { first: 20, second: 10 },+ canvases: [canvas("second"), canvas("first")],+ expected: ["first", "second"],+ },+ {+ sort: "created_by" as const,+ views: {} as Record<string, number>,+ canvases: [+ canvas("zulu", { createdBy: "Zoe" }),+ canvas("alpha", { createdBy: "Ada" }),+ ],+ expected: ["alpha", "zulu"],+ },+ ])("sorts canvases by $sort", ({ sort, views, canvases, expected }) => {+ const viewModel = new CanvasListService().buildViewModel({+ canvases,+ spaces: SPACES,+ currentUser: CURRENT_USER,+ settings: settings({ sort }),+ query: "",+ lastViewedAtByCanvasId: views,+ });++ expect(viewModel.canvases.map(({ id }) => id)).toEqual(expected);+ });++ it.each([+ { grouping: "none" as const, expected: [[null, "a", "b"]] },+ {+ grouping: "space" as const,+ expected: [+ ["alpha", "a"],+ ["beta", "b"],+ ],+ },+ {+ grouping: "date" as const,+ expected: [+ ["Today", "b"],+ ["Yesterday", "a"],+ ],+ },+ ])("groups canvases by $grouping", ({ grouping, expected }) => {+ const canvases = [+ canvas("a", {+ channelId: "space-a",+ createdAt: new Date(2026, 7, 19, 8).getTime(),+ }),+ canvas("b", {+ channelId: "space-b",+ createdAt: new Date(2026, 7, 20, 8).getTime(),+ }),+ ];++ const viewModel = buildViewModel(canvases, settings({ grouping }));+ expect(+ viewModel.sections.map((section) => [+ section.label,+ ...section.canvases.map(({ id }) => id),+ ]),+ ).toEqual(expected);+ });++ it("limits creator options to creators in the selected spaces", () => {+ const viewModel = buildViewModel(+ [+ canvas("mine", {+ channelId: "space-a",+ createdByUuid: "me",+ createdBy: "Current User",+ }),+ canvas("ada", {+ channelId: "space-a",+ createdByUuid: "ada",+ createdBy: "Ada Lovelace",+ }),+ canvas("grace", {+ channelId: "space-b",+ createdByUuid: "grace",+ createdBy: "Grace Hopper",+ }),+ ],+ settings({ spaceIds: ["space-a"] }),+ );++ expect(viewModel.creatorOptions).toEqual([+ { value: "me", label: "Me", searchLabel: "Current User" },+ { value: null, label: "Anyone" },+ { value: "ada", label: "Ada Lovelace" },+ ]);+ });++ it("forces the current user when the personal space is selected", () => {+ const viewModel = buildViewModel(+ [+ canvas("mine", {+ channelId: "personal",+ createdByUuid: "me",+ }),+ ],+ settings({ spaceIds: ["personal"], creatorUuids: ["ada"] }),+ );++ expect(viewModel.personalSpaceSelected).toBe(true);+ expect(viewModel.settings.creatorUuids).toEqual(["me"]);+ });++ it("removes creators that are unavailable after a space change", () => {+ const update = new CanvasListService().updateSettings({+ canvases: [+ canvas("ada", {+ channelId: "space-a",+ createdByUuid: "ada",+ }),+ ],+ spaces: SPACES,+ currentUser: CURRENT_USER,+ currentSettings: settings({ creatorUuids: ["ada"] }),+ nextSettings: settings({+ spaceIds: ["space-b"],+ creatorUuids: ["ada"],+ }),+ });++ expect(update.settings.creatorUuids).toEqual([]);+ });+});diff --git a/products/desktop/packages/core/src/canvas/canvasListService.ts b/products/desktop/packages/core/src/canvas/canvasListService.tsnew file mode 100644index 000000000000..9c8e722d7925--- /dev/null+++ b/products/desktop/packages/core/src/canvas/canvasListService.ts@@ -0,0 +1,326 @@+import { formatShortDayLabel, getLocalDayKey } from "@posthog/shared";+import { injectable } from "inversify";+import type { DashboardRecord } from "./dashboardSchemas";++export type CanvasListSort = "recently_viewed" | "created_by";+export type CanvasListGrouping = "none" | "space" | "date";++export interface CanvasListSettings {+ spaceIds: readonly string[];+ creatorUuids: readonly string[];+ sort: CanvasListSort;+ grouping: CanvasListGrouping;+}++export const DEFAULT_CANVAS_LIST_SORT: CanvasListSort = "recently_viewed";+export const DEFAULT_CANVAS_LIST_GROUPING: CanvasListGrouping = "date";+export const DEFAULT_CANVAS_LIST_SETTINGS: CanvasListSettings = {+ spaceIds: [],+ creatorUuids: [],+ sort: DEFAULT_CANVAS_LIST_SORT,+ grouping: DEFAULT_CANVAS_LIST_GROUPING,+};++export interface CanvasListSpace {+ id: string;+ name: string;+ channelType: "public" | "personal";+}++export interface CanvasListUser {+ uuid: string;+ name: string;+}++export interface CanvasCreatorOption {+ value: string | null;+ label: string;+ searchLabel?: string;+}++export interface CanvasListSection {+ key: string;+ label: string | null;+ canvases: DashboardRecord[];+}++export interface CanvasListViewModel {+ settings: CanvasListSettings;+ personalSpaceSelected: boolean;+ creatorOptions: CanvasCreatorOption[];+ canvases: DashboardRecord[];+ sections: CanvasListSection[];+}++interface CanvasListContext {+ canvases: readonly DashboardRecord[];+ spaces: readonly CanvasListSpace[];+ currentUser?: CanvasListUser;+}++interface BuildCanvasListViewModelInput extends CanvasListContext {+ settings: CanvasListSettings;+ query: string;+ lastViewedAtByCanvasId: Readonly<Record<string, number>>;+ now?: Date;+}++interface UpdateCanvasListSettingsInput extends CanvasListContext {+ currentSettings: CanvasListSettings;+ nextSettings: CanvasListSettings;+}++export interface CanvasListSettingsUpdate {+ settings: CanvasListSettings;+ refreshRecentlyViewedSnapshot: boolean;+}++export function hasCustomizedCanvasList(settings: CanvasListSettings): boolean {+ return (+ settings.spaceIds.length > 0 ||+ settings.creatorUuids.length > 0 ||+ settings.sort !== DEFAULT_CANVAS_LIST_SORT ||+ settings.grouping !== DEFAULT_CANVAS_LIST_GROUPING+ );+}++function personalSpaceId(+ spaces: readonly CanvasListSpace[],+): string | undefined {+ return spaces.find((space) => space.channelType === "personal")?.id;+}++function constrainSettingsToPersonalSpace(+ settings: CanvasListSettings,+ spaceId: string | undefined,+ currentUserUuid: string | undefined,+): CanvasListSettings {+ if (!spaceId || !settings.spaceIds.includes(spaceId)) return settings;++ const creatorUuids = currentUserUuid ? [currentUserUuid] : [];+ if (+ settings.creatorUuids.length === creatorUuids.length &&+ settings.creatorUuids.every((uuid, index) => uuid === creatorUuids[index])+ ) {+ return settings;+ }+ return { ...settings, creatorUuids };+}++function buildCanvasCreatorOptions(+ canvases: readonly DashboardRecord[],+ currentUser?: CanvasListUser,+ spaceIds: readonly string[] = [],+): CanvasCreatorOption[] {+ const selectedSpaceIds = new Set(spaceIds);+ const limitsCreatorsBySpace = selectedSpaceIds.size > 0;+ const creatorsByUuid = new Map<string, string>();+ let currentUserHasCanvas = false;+ for (const canvas of canvases) {+ if (limitsCreatorsBySpace && !selectedSpaceIds.has(canvas.channelId)) {+ continue;+ }+ if (canvas.createdByUuid === currentUser?.uuid) {+ currentUserHasCanvas = true;+ continue;+ }+ if (canvas.createdByUuid && !creatorsByUuid.has(canvas.createdByUuid)) {+ creatorsByUuid.set(canvas.createdByUuid, canvas.createdBy ?? "Unknown");+ }+ }++ const otherCreators = [...creatorsByUuid.entries()]+ .map(([value, label]) => ({ value, label }))+ .sort((a, b) => a.label.localeCompare(b.label));++ return [+ ...(currentUser && (!limitsCreatorsBySpace || currentUserHasCanvas)+ ? [+ {+ value: currentUser.uuid,+ label: "Me",+ searchLabel: currentUser.name,+ },+ ]+ : []),+ { value: null, label: "Anyone" },+ ...otherCreators,+ ];+}++function normalizeSettings(+ settings: CanvasListSettings,+ context: CanvasListContext,+): CanvasListSettings {+ const spaceId = personalSpaceId(context.spaces);+ const constrainedSettings = constrainSettingsToPersonalSpace(+ settings,+ spaceId,+ context.currentUser?.uuid,+ );+ if (spaceId && constrainedSettings.spaceIds.includes(spaceId)) {+ return constrainedSettings;+ }++ const availableCreatorUuids = new Set(+ buildCanvasCreatorOptions(+ context.canvases,+ context.currentUser,+ constrainedSettings.spaceIds,+ ).flatMap((option) => (option.value === null ? [] : [option.value])),+ );+ const creatorUuids = constrainedSettings.creatorUuids.filter((uuid) =>+ availableCreatorUuids.has(uuid),+ );+ if (creatorUuids.length === constrainedSettings.creatorUuids.length) {+ return constrainedSettings;+ }+ return { ...constrainedSettings, creatorUuids };+}++function filterCanvasList(+ canvases: readonly DashboardRecord[],+ settings: CanvasListSettings,+ query: string,+): DashboardRecord[] {+ const normalizedQuery = query.toLowerCase();+ return canvases.filter(+ (canvas) =>+ (settings.spaceIds.length === 0 ||+ settings.spaceIds.includes(canvas.channelId)) &&+ (settings.creatorUuids.length === 0 ||+ (canvas.createdByUuid != null &&+ settings.creatorUuids.includes(canvas.createdByUuid))) &&+ (normalizedQuery === "" ||+ `${canvas.name} ${canvas.description}`+ .toLowerCase()+ .includes(normalizedQuery)),+ );+}++function compareByCreator(+ first: DashboardRecord,+ second: DashboardRecord,+): number {+ const creator = (first.createdBy ?? "Unknown").localeCompare(+ second.createdBy ?? "Unknown",+ );+ return creator !== 0 ? creator : first.name.localeCompare(second.name);+}++function sortCanvasList(+ canvases: readonly DashboardRecord[],+ sort: CanvasListSort,+ lastViewedAtByCanvasId: Readonly<Record<string, number>>,+): DashboardRecord[] {+ return [...canvases].sort((first, second) => {+ if (sort === "created_by") return compareByCreator(first, second);++ const lastViewed =+ (lastViewedAtByCanvasId[second.id] ?? 0) -+ (lastViewedAtByCanvasId[first.id] ?? 0);+ return lastViewed !== 0 ? lastViewed : second.updatedAt - first.updatedAt;+ });+}++function groupCanvasList(+ canvases: readonly DashboardRecord[],+ grouping: CanvasListGrouping,+ spaceNames: ReadonlyMap<string, string>,+ now: Date,+): CanvasListSection[] {+ if (canvases.length === 0) return [];+ if (grouping === "none") {+ return [{ key: "all", label: null, canvases: [...canvases] }];+ }++ if (grouping === "space") {+ const sections = new Map<string, CanvasListSection>();+ for (const canvas of canvases) {+ const key = `space:${canvas.channelId}`;+ const section = sections.get(key);+ if (section) {+ section.canvases.push(canvas);+ } else {+ sections.set(key, {+ key,+ label: spaceNames.get(canvas.channelId) ?? "Unknown space",+ canvases: [canvas],+ });+ }+ }+ return [...sections.values()];+ }++ const sections = new Map<+ string,+ { timestamp: number; canvases: DashboardRecord[] }+ >();+ for (const canvas of canvases) {+ const key = getLocalDayKey(canvas.createdAt);+ const section = sections.get(key);+ if (section) {+ section.canvases.push(canvas);+ } else {+ sections.set(key, { timestamp: canvas.createdAt, canvases: [canvas] });+ }+ }++ return [...sections.entries()]+ .sort(([, first], [, second]) => second.timestamp - first.timestamp)+ .map(([key, section]) => ({+ key: `date:${key}`,+ label: formatShortDayLabel(section.timestamp, now),+ canvases: section.canvases,+ }));+}++@injectable()+export class CanvasListService {+ buildViewModel(input: BuildCanvasListViewModelInput): CanvasListViewModel {+ const settings = normalizeSettings(input.settings, input);+ const spaceId = personalSpaceId(input.spaces);+ const canvases = sortCanvasList(+ filterCanvasList(input.canvases, settings, input.query),+ settings.sort,+ input.lastViewedAtByCanvasId,+ );+ const spaceNames = new Map(+ input.spaces.map((space) => [+ space.id,+ space.channelType === "personal" ? "personal" : space.name,+ ]),+ );++ return {+ settings,+ personalSpaceSelected: Boolean(+ spaceId && settings.spaceIds.includes(spaceId),+ ),+ creatorOptions: buildCanvasCreatorOptions(+ input.canvases,+ input.currentUser,+ settings.spaceIds,+ ),+ canvases,+ sections: groupCanvasList(+ canvases,+ settings.grouping,+ spaceNames,+ input.now ?? new Date(),+ ),+ };+ }++ updateSettings(+ input: UpdateCanvasListSettingsInput,+ ): CanvasListSettingsUpdate {+ const settings = normalizeSettings(input.nextSettings, input);+ return {+ settings,+ refreshRecentlyViewedSnapshot:+ input.currentSettings.sort !== DEFAULT_CANVAS_LIST_SORT &&+ settings.sort === DEFAULT_CANVAS_LIST_SORT,+ };+ }+}diff --git a/products/desktop/packages/core/src/canvas/dashboardsService.ts b/products/desktop/packages/core/src/canvas/dashboardsService.tsindex f642e03995e8..48be0743074c 100644--- a/products/desktop/packages/core/src/canvas/dashboardsService.ts+++ b/products/desktop/packages/core/src/canvas/dashboardsService.ts@@ -183,6 +183,15 @@ export class DashboardsService {return rows.map(toRecord);}+ async listAll(): Promise<DashboardRecord[]> {+ const rows = await this.api.listPaginated<ApiCanvas>(+ "canvases/",+ "list all canvases",+ { limit: 500 },+ );+ return rows.map(toRecord).filter((record) => record.kind !== "component");+ }+async create(input: {channelId: string;name: string;diff --git a/products/desktop/packages/core/src/canvas/identifiers.ts b/products/desktop/packages/core/src/canvas/identifiers.tsindex 5762c093ebe7..63bb29f13e45 100644--- a/products/desktop/packages/core/src/canvas/identifiers.ts+++ b/products/desktop/packages/core/src/canvas/identifiers.ts@@ -17,3 +17,6 @@ export const CHANNEL_TASKS_SERVICE = Symbol.for(export const CANVAS_APPLICATION_SERVICE = Symbol.for("posthog.core.canvas.applicationService",);+export const CANVAS_LIST_SERVICE = Symbol.for(+ "posthog.core.canvas.listService",+);diff --git a/products/desktop/packages/core/src/canvas/services.ts b/products/desktop/packages/core/src/canvas/services.tsindex fba96306f1ed..344c2f361991 100644--- a/products/desktop/packages/core/src/canvas/services.ts+++ b/products/desktop/packages/core/src/canvas/services.ts@@ -42,6 +42,7 @@ export interface IDashboardsService {list(channelId: string): Promise<DashboardRecord[]>;// The component store: component-kind canvases visible to the caller.listComponents(input: { search?: string }): Promise<DashboardRecord[]>;+ listAll(): Promise<DashboardRecord[]>;get(id: string): Promise<DashboardRecord | null>;create(input: {channelId: string;diff --git a/products/desktop/packages/host-router/src/routers/dashboards.router.ts b/products/desktop/packages/host-router/src/routers/dashboards.router.tsindex 93e973a130c3..89b14b77cb9f 100644--- a/products/desktop/packages/host-router/src/routers/dashboards.router.ts+++ b/products/desktop/packages/host-router/src/routers/dashboards.router.ts@@ -58,6 +58,11 @@ export const dashboardsRouter = router({.get<IDashboardsService>(DASHBOARDS_SERVICE).listComponents(input),),+ listAll: publicProcedure+ .output(z.array(dashboardRecordSchema))+ .query(({ ctx }) =>+ ctx.container.get<IDashboardsService>(DASHBOARDS_SERVICE).listAll(),+ ),get: publicProcedure.input(dashboardIdInput).output(dashboardRecordSchema.nullable())diff --git a/products/desktop/packages/shared/src/analytics-events.ts b/products/desktop/packages/shared/src/analytics-events.tsindex c95367f556b1..ea967e77a67a 100644--- a/products/desktop/packages/shared/src/analytics-events.ts+++ b/products/desktop/packages/shared/src/analytics-events.ts@@ -275,6 +275,7 @@ export type SidebarNavItem =| "command_center"| "contexts"| "activity"+ | "canvases"| "configure"| "loops"| "more";@@ -976,7 +977,8 @@ export type ChannelsSurface =| "context"| "thread_panel"| "activity_panel"- | "activity";+ | "activity"+ | "canvases_pane";export type ChannelActionType =| "enter_space"diff --git a/products/desktop/packages/ui/src/features/canvas/bluebirdRoutes.ts b/products/desktop/packages/ui/src/features/canvas/bluebirdRoutes.tsindex 9bda8fb31a57..e64cadf96dbf 100644--- a/products/desktop/packages/ui/src/features/canvas/bluebirdRoutes.ts+++ b/products/desktop/packages/ui/src/features/canvas/bluebirdRoutes.ts@@ -6,7 +6,12 @@* Flattening the routes took the prefix away, so the paths are listed here* instead — a flag-off user restoring one has to be sent somewhere they can use.*/-const BLUEBIRD_ONLY_ROOTS = ["/spaces", "/activity", "/feeds"] as const;+const BLUEBIRD_ONLY_ROOTS = [+ "/spaces",+ "/activity",+ "/feeds",+ "/canvases",+] as const;export function isBluebirdOnlyPath(pathname: string): boolean {return BLUEBIRD_ONLY_ROOTS.some(diff --git a/products/desktop/packages/ui/src/features/canvas/components/ActivityFeedList.tsx b/products/desktop/packages/ui/src/features/canvas/components/ActivityFeedList.tsxindex 3484226b1c86..a7cc7c39e443 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ActivityFeedList.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ActivityFeedList.tsx@@ -188,7 +188,7 @@ export function ActivityFeedList({/><AutocompleteListref={setScrollRoot}- className="scroll-mask-8 !max-h-none !p-1.5 min-h-0 flex-1 overflow-y-auto"+ className="sidebar-autocomplete-tree scroll-mask-8 !max-h-none !p-1.5 min-h-0 flex-1 overflow-y-auto">{isLoading && feedItems.length === 0 ? (<div className="flex justify-center py-10">diff --git a/products/desktop/packages/ui/src/features/canvas/components/ActivityIncludeMenuSection.tsx b/products/desktop/packages/ui/src/features/canvas/components/ActivityIncludeMenuSection.tsxindex bfa8860e8c65..ff1910131e21 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ActivityIncludeMenuSection.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ActivityIncludeMenuSection.tsx@@ -2,6 +2,7 @@ import { getAuthIdentity } from "@posthog/core/auth/authIdentity";import {cn,DropdownMenuCheckboxItem,+ DropdownMenuItem,DropdownMenuRadioGroup,DropdownMenuRadioItem,DropdownMenuSeparator,@@ -14,6 +15,7 @@ import type { SourceProduct } from "@posthog/shared/types";import { useAuthStateValue } from "@posthog/ui/features/auth/store";import {type ActivityInboxScope,+ hasActiveActivityMenuFilters,useActivityFilterStore,} from "@posthog/ui/features/canvas/stores/activityFilterStore";import { useReportsInboxEnabled } from "@posthog/ui/features/feature-flags/useReportsInboxEnabled";@@ -116,6 +118,12 @@ export function ActivityIncludeMenuSection(): ReactElement {const clearPriorityFilter = useActivityFilterStore((state) => state.clearInboxPriorityFilter,);+ const resetMenuFilters = useActivityFilterStore(+ (state) => state.resetMenuFilters,+ );+ const filtersActive = useActivityFilterStore((state) =>+ hasActiveActivityMenuFilters(state, authIdentity),+ );const inboxAvailable = reportsInboxEnabled && authIdentity !== null;const sourceOptions = useInboxSourceFilterOptions(sourceProductFilter, {enabled: inboxAvailable && inboxEnabled,@@ -128,7 +136,6 @@ export function ActivityIncludeMenuSection(): ReactElement {(option) =>option.field === sortField && option.direction === sortDirection,);-return (<><MenuLabel>Include</MenuLabel>@@ -304,6 +311,18 @@ export function ActivityIncludeMenuSection(): ReactElement {</DropdownMenuSub></>)}+ {filtersActive && (+ <>+ <DropdownMenuSeparator />+ <DropdownMenuItem+ data-attr="clear-activity-filters"+ variant="destructive"+ onClick={() => resetMenuFilters(authIdentity)}+ >+ Clear filters+ </DropdownMenuItem>+ </>+ )}</>);}diff --git a/products/desktop/packages/ui/src/features/canvas/components/CanvasFilterMenu.stories.tsx b/products/desktop/packages/ui/src/features/canvas/components/CanvasFilterMenu.stories.tsxnew file mode 100644index 000000000000..1ce74f67cdd4--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/CanvasFilterMenu.stories.tsx@@ -0,0 +1,135 @@+import { LockSimpleIcon } from "@phosphor-icons/react";+import type {+ CanvasListGrouping,+ CanvasListSettings,+ CanvasListSort,+} from "@posthog/core/canvas/canvasListService";+import type { Meta, StoryObj } from "@storybook/react-vite";+import { type ReactElement, useState } from "react";+import { within } from "storybook/test";+import { CanvasFilterMenu } from "./CanvasFilterMenu";++const SPACE_OPTIONS = [+ {+ value: "personal",+ label: "personal",+ icon: <LockSimpleIcon size={16} />,+ },+ { value: null, label: "Every space" },+ { value: "engineering", label: "engineering" },+];++const CREATOR_OPTIONS = [+ { value: null, label: "Anyone" },+ { value: "me", label: "Me" },+ { value: "ada", label: "Ada Lovelace" },+ { value: "grace", label: "Grace Hopper" },+ { value: "alan", label: "Alan Turing" },+ { value: "barbara", label: "Barbara Liskov" },+ { value: "donald", label: "Donald Knuth" },+ { value: "evelyn", label: "Evelyn Boyd Granville" },+ { value: "frances", label: "Frances Allen" },+ { value: "john", label: "John McCarthy" },+ { value: "katherine", label: "Katherine Johnson" },+ { value: "margaret", label: "Margaret Hamilton" },+ { value: "mary", label: "Mary Jackson" },+ { value: "radia", label: "Radia Perlman" },+ { value: "sophie", label: "Sophie Wilson" },+ { value: "tim", label: "Tim Berners-Lee" },+ { value: "yukihiro", label: "Yukihiro Matsumoto" },+];++function Harness({+ initialSpaceIds,+ initialCreatorUuids,+ initialSort,+ initialGrouping,+ createdByDisabled,+}: {+ initialSpaceIds: string[];+ initialCreatorUuids: string[];+ initialSort: CanvasListSort;+ initialGrouping: CanvasListGrouping;+ createdByDisabled: boolean;+}): ReactElement {+ const [settings, setSettings] = useState<CanvasListSettings>({+ spaceIds: initialSpaceIds,+ creatorUuids: initialCreatorUuids,+ sort: initialSort,+ grouping: initialGrouping,+ });++ return (+ <div className="flex justify-end p-2">+ <CanvasFilterMenu+ spaceOptions={SPACE_OPTIONS}+ creatorOptions={CREATOR_OPTIONS}+ createdByDisabled={createdByDisabled}+ settings={settings}+ onChange={setSettings}+ />+ </div>+ );+}++const meta: Meta<typeof Harness> = {+ title: "Canvases/CanvasFilterMenu",+ component: Harness,+ args: {+ initialSpaceIds: [],+ initialCreatorUuids: [],+ initialSort: "recently_viewed",+ initialGrouping: "date",+ createdByDisabled: false,+ },+ decorators: [+ (Story): ReactElement => (+ <div className="w-64 border border-border">+ <Story />+ </div>+ ),+ ],+};++export default meta;+type Story = StoryObj<typeof Harness>;++export const Default: Story = {};++export const MenuOpen: Story = {+ play: async ({ canvas, userEvent }): Promise<void> => {+ await userEvent.click(canvas.getByLabelText("Filter canvases"));+ },+};++export const CreatedByOpen: Story = {+ args: {+ initialCreatorUuids: ["me", "ada", "grace"],+ },+ play: async ({ canvas, canvasElement, userEvent }): Promise<void> => {+ const body = within(canvasElement.ownerDocument.body);+ await userEvent.click(canvas.getByLabelText("Filter canvases"));+ await userEvent.hover(await body.findByText("Created by"));+ await body.findByLabelText("Search users…");+ },+};++export const FilteredAndGrouped: Story = {+ args: {+ initialSpaceIds: ["personal", "engineering"],+ initialCreatorUuids: ["me", "ada", "grace"],+ initialSort: "created_by",+ initialGrouping: "space",+ },+};++export const PersonalSpace: Story = {+ args: {+ initialSpaceIds: ["personal"],+ initialCreatorUuids: ["me"],+ createdByDisabled: true,+ },+ play: async ({ canvas, userEvent }): Promise<void> => {+ await userEvent.click(canvas.getByLabelText("Filter canvases"));+ },+};diff --git a/products/desktop/packages/ui/src/features/canvas/components/CanvasFilterMenu.tsx b/products/desktop/packages/ui/src/features/canvas/components/CanvasFilterMenu.tsxnew file mode 100644index 000000000000..48372c930237--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/CanvasFilterMenu.tsx@@ -0,0 +1,196 @@+import { FunnelSimple as FunnelSimpleIcon } from "@phosphor-icons/react";+import {+ type CanvasListSettings,+ DEFAULT_CANVAS_LIST_GROUPING,+ DEFAULT_CANVAS_LIST_SETTINGS,+ DEFAULT_CANVAS_LIST_SORT,+ hasCustomizedCanvasList,+} from "@posthog/core/canvas/canvasListService";+import {+ Button,+ cn,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuRadioGroup,+ DropdownMenuRadioItem,+ DropdownMenuSeparator,+ DropdownMenuSub,+ DropdownMenuSubContent,+ DropdownMenuSubTrigger,+ DropdownMenuTrigger,+} from "@posthog/quill";+import { CanvasFilterMultiSelectSubmenu } from "@posthog/ui/features/canvas/components/CanvasFilterMultiSelectSubmenu";+import {+ type CanvasFilterOption,+ type CanvasMultiSelectOption,+ summarizeCreatorSelection,+ summarizeSpaceSelection,+} from "@posthog/ui/features/canvas/components/canvasFilterSelection";+import type { ReactElement } from "react";++const SORT_OPTIONS: readonly CanvasFilterOption<CanvasListSettings["sort"]>[] =+ [+ { value: "recently_viewed", label: "Last viewed" },+ { value: "created_by", label: "Created by" },+ ];++const GROUPING_OPTIONS: readonly CanvasFilterOption<+ CanvasListSettings["grouping"]+>[] = [+ { value: "none", label: "None" },+ { value: "space", label: "Space" },+ { value: "date", label: "Date" },+];++function RadioSubmenu<Value extends string>({+ label,+ options,+ value,+ defaultValue,+ onChange,+}: {+ label: string;+ options: readonly CanvasFilterOption<Value>[];+ value: Value;+ defaultValue: Value;+ onChange: (value: Value) => void;+}): ReactElement {+ const selected =+ options.find((option) => option.value === value)?.label ?? "None";++ return (+ <DropdownMenuSub>+ <DropdownMenuSubTrigger className="pr-1">+ <span>{label}</span>+ <span+ title={selected}+ className={cn(+ "min-w-0 flex-1 truncate pl-4 text-right",+ value === defaultValue+ ? "text-muted-foreground/80"+ : "text-primary",+ )}+ >+ {selected}+ </span>+ </DropdownMenuSubTrigger>+ <DropdownMenuSubContent>+ <DropdownMenuRadioGroup+ value={value}+ onValueChange={(nextValue) => onChange(nextValue as Value)}+ >+ {options.map((option) => (+ <DropdownMenuRadioItem key={option.value} value={option.value}>+ {option.label}+ </DropdownMenuRadioItem>+ ))}+ </DropdownMenuRadioGroup>+ </DropdownMenuSubContent>+ </DropdownMenuSub>+ );+}++export function CanvasFilterMenu({+ spaceOptions,+ creatorOptions,+ createdByDisabled,+ settings,+ onChange,+}: {+ spaceOptions: readonly CanvasMultiSelectOption[];+ creatorOptions: readonly CanvasMultiSelectOption[];+ createdByDisabled: boolean;+ settings: CanvasListSettings;+ onChange: (settings: CanvasListSettings) => void;+}): ReactElement {+ const active = hasCustomizedCanvasList(settings);+ const updateSetting = <Key extends keyof CanvasListSettings>(+ key: Key,+ value: CanvasListSettings[Key],+ ): void => onChange({ ...settings, [key]: value });++ return (+ <DropdownMenu>+ <DropdownMenuTrigger+ render={+ <Button+ variant="default"+ size="icon-xs"+ aria-label="Filter canvases"+ data-attr="canvas-list-filter"+ className="relative"+ >+ <FunnelSimpleIcon />+ {active && (+ <span+ aria-hidden+ className="absolute top-0 right-0 size-1.5 rounded-full bg-primary"+ />+ )}+ </Button>+ }+ />+ <DropdownMenuContent+ align="end"+ side="bottom"+ sideOffset={6}+ className="w-64"+ aria-label="Filter canvases"+ >+ <RadioSubmenu+ label="Group by"+ options={GROUPING_OPTIONS}+ value={settings.grouping}+ defaultValue={DEFAULT_CANVAS_LIST_GROUPING}+ onChange={(grouping) => updateSetting("grouping", grouping)}+ />+ <RadioSubmenu+ label="Sort by"+ options={SORT_OPTIONS}+ value={settings.sort}+ defaultValue={DEFAULT_CANVAS_LIST_SORT}+ onChange={(sort) => updateSetting("sort", sort)}+ />+ <DropdownMenuSeparator />+ <CanvasFilterMultiSelectSubmenu+ label="Space"+ summary={summarizeSpaceSelection(spaceOptions, settings.spaceIds)}+ options={spaceOptions}+ values={settings.spaceIds}+ onChange={(spaceIds) => updateSetting("spaceIds", spaceIds)}+ searchPlaceholder="Search spaces…"+ emptyLabel="No spaces found."+ />+ <CanvasFilterMultiSelectSubmenu+ label="Created by"+ summary={+ createdByDisabled+ ? "Me"+ : summarizeCreatorSelection(creatorOptions, settings.creatorUuids)+ }+ options={creatorOptions}+ values={settings.creatorUuids}+ onChange={(creatorUuids) =>+ updateSetting("creatorUuids", creatorUuids)+ }+ searchPlaceholder="Search users…"+ emptyLabel="No users found."+ disabled={createdByDisabled}+ />+ {active && (+ <>+ <DropdownMenuSeparator />+ <DropdownMenuItem+ data-attr="clear-canvas-list-filters"+ variant="destructive"+ onClick={() => onChange(DEFAULT_CANVAS_LIST_SETTINGS)}+ >+ Clear filters+ </DropdownMenuItem>+ </>+ )}+ </DropdownMenuContent>+ </DropdownMenu>+ );+}diff --git a/products/desktop/packages/ui/src/features/canvas/components/CanvasFilterMultiSelectSubmenu.tsx b/products/desktop/packages/ui/src/features/canvas/components/CanvasFilterMultiSelectSubmenu.tsxnew file mode 100644index 000000000000..e4ee0ea6e2b3--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/CanvasFilterMultiSelectSubmenu.tsx@@ -0,0 +1,122 @@+import {+ Combobox,+ ComboboxCollection,+ ComboboxEmpty,+ ComboboxInput,+ ComboboxItem,+ ComboboxList,+ DropdownMenuSub,+ DropdownMenuSubContent,+ DropdownMenuSubTrigger,+} from "@posthog/quill";+import type { CanvasMultiSelectOption } from "@posthog/ui/features/canvas/components/canvasFilterSelection";+import type { ReactElement, SyntheticEvent } from "react";++const DEFAULT_OPTION_KEY = "__canvas_filter_default__";++function stopPropagation(event: SyntheticEvent): void {+ event.stopPropagation();+}++export function CanvasFilterMultiSelectSubmenu({+ label,+ summary,+ options,+ values,+ onChange,+ searchPlaceholder,+ emptyLabel,+ disabled = false,+}: {+ label: string;+ summary: string;+ options: readonly CanvasMultiSelectOption[];+ values: readonly string[];+ onChange: (values: string[]) => void;+ searchPlaceholder: string;+ emptyLabel: string;+ disabled?: boolean;+}): ReactElement {+ const selectedValues = new Set(values);+ const selectedOptions = options.filter(+ (option) => option.value !== null && selectedValues.has(option.value),+ );+ const defaultOption = options.find((option) => option.value === null);+ const comboboxValue =+ selectedOptions.length === 0 && defaultOption+ ? [defaultOption]+ : selectedOptions;++ const updateSelection = (nextOptions: CanvasMultiSelectOption[]): void => {+ const defaultSelected = nextOptions.some((option) => option.value === null);+ const nextValues = nextOptions.flatMap((option) =>+ option.value === null ? [] : [option.value],+ );+ if (defaultSelected) {+ onChange(values.length === 0 ? nextValues : []);+ return;+ }+ onChange(nextValues);+ };++ return (+ <DropdownMenuSub>+ <DropdownMenuSubTrigger className="pr-1" disabled={disabled}>+ <span>{label}</span>+ <span+ title={summary}+ className={+ values.length === 0+ ? "min-w-0 flex-1 truncate pl-4 text-right text-muted-foreground/80"+ : "min-w-0 flex-1 truncate pl-4 text-right text-primary"+ }+ >+ {summary}+ </span>+ </DropdownMenuSubTrigger>+ <DropdownMenuSubContent className="w-64 [&>div]:overflow-hidden [&>div]:p-0">+ <Combobox<CanvasMultiSelectOption, true>+ multiple+ autoHighlight+ items={options}+ value={comboboxValue}+ onValueChange={(nextOptions) => updateSelection(nextOptions ?? [])}+ itemToStringLabel={(option) =>+ `${option.label} ${option.searchLabel ?? ""}`+ }+ itemToStringValue={(option) => option.value ?? DEFAULT_OPTION_KEY}+ >+ <div className="p-1">+ <ComboboxInput+ autoFocus+ showTrigger={false}+ placeholder={searchPlaceholder}+ aria-label={searchPlaceholder}+ className="w-full"+ onClick={stopPropagation}+ onKeyDown={stopPropagation}+ />+ </div>+ <ComboboxList className="group/combobox-list max-h-72 border-border border-t">+ <ComboboxCollection>+ {(option: CanvasMultiSelectOption) => (+ <ComboboxItem+ key={option.value ?? "default"}+ value={option}+ className="ps-7"+ onClick={stopPropagation}+ >+ {option.icon}+ {option.label}+ </ComboboxItem>+ )}+ </ComboboxCollection>+ <ComboboxEmpty className="group-data-empty/combobox-list:flex">+ {emptyLabel}+ </ComboboxEmpty>+ </ComboboxList>+ </Combobox>+ </DropdownMenuSubContent>+ </DropdownMenuSub>+ );+}diff --git a/products/desktop/packages/ui/src/features/canvas/components/CanvasesPane.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/CanvasesPane.test.tsxnew file mode 100644index 000000000000..0bcf11164d65--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/CanvasesPane.test.tsx@@ -0,0 +1,124 @@+import type { DashboardRecord } from "@posthog/core/canvas/dashboardSchemas";+import { render, screen } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++const mocks = vi.hoisted(() => ({+ dashboards: [] as DashboardRecord[],+ navigate: vi.fn(),+ track: vi.fn(),+ viewedState: {+ lastViewedAtByCanvasId: {} as Record<string, number>,+ markCanvasViewed: vi.fn(),+ },+}));++vi.mock("@posthog/ui/features/auth/useMeQuery", () => ({+ useMeQuery: () => ({ data: null }),+}));+vi.mock("@posthog/di/react", async () => {+ const { CanvasListService } = await import(+ "@posthog/core/canvas/canvasListService"+ );+ return { useService: () => new CanvasListService() };+});+vi.mock("@posthog/ui/features/canvas/components/CanvasFilterMenu", () => ({+ CanvasFilterMenu: () => <button type="button">Filter canvases</button>,+}));+vi.mock("@posthog/ui/features/canvas/hooks/useChannels", () => ({+ useChannels: () => ({ channels: [], isLoading: false }),+}));+vi.mock("@posthog/ui/features/canvas/hooks/useDashboards", () => ({+ useAllCanvases: () => ({ dashboards: mocks.dashboards, isLoading: false }),+}));+vi.mock("@posthog/ui/features/canvas/hooks/useSelectedCanvasId", () => ({+ useSelectedCanvasId: () => undefined,+}));+vi.mock("@posthog/ui/features/canvas/stores/canvasViewedStore", () => {+ const useCanvasViewedStore = Object.assign(+ (selector: (state: typeof mocks.viewedState) => unknown): unknown =>+ selector(mocks.viewedState),+ {+ getState: () => mocks.viewedState,+ persist: {+ hasHydrated: () => true,+ onFinishHydration: () => () => {},+ },+ },+ );+ return { useCanvasViewedStore };+});+vi.mock("@posthog/ui/shell/analytics", () => ({ track: mocks.track }));+vi.mock("@tanstack/react-router", async (importOriginal) => ({+ ...(await importOriginal<typeof import("@tanstack/react-router")>()),+ useNavigate: () => mocks.navigate,+}));++import { CanvasesPane } from "./CanvasesPane";++function canvas(id: string, name: string, updatedAt: number): DashboardRecord {+ return {+ id,+ channelId: "space-1",+ name,+ kind: "freeform",+ description: "",+ templateId: "freeform",+ context: "",+ createdAt: updatedAt,+ updatedAt,+ };+}++describe("CanvasesPane", () => {+ beforeEach(() => {+ mocks.dashboards = [+ canvas("canvas-first", "First canvas", 2),+ canvas("canvas-second", "Second canvas", 1),+ ];+ mocks.navigate.mockReset();+ mocks.track.mockReset();+ mocks.viewedState.markCanvasViewed.mockReset();+ mocks.viewedState.lastViewedAtByCanvasId = {};+ });++ afterEach(() => {+ vi.useRealTimers();+ });++ it("groups canvases by date by default", () => {+ vi.useFakeTimers();+ vi.setSystemTime(new Date(2026, 7, 20, 12));+ mocks.dashboards = [+ canvas(+ "canvas-today",+ "Today canvas",+ new Date(2026, 7, 20, 8).getTime(),+ ),+ canvas(+ "canvas-yesterday",+ "Yesterday canvas",+ new Date(2026, 7, 19, 8).getTime(),+ ),+ ];++ render(<CanvasesPane />);++ expect(screen.getByText("Today")).toBeInTheDocument();+ expect(screen.getByText("Yesterday")).toBeInTheDocument();+ });++ it("moves through canvases from the search input and opens the highlighted row", async () => {+ const user = userEvent.setup();+ render(<CanvasesPane />);++ expect(screen.getAllByRole("option")).toHaveLength(2);+ await user.click(screen.getByLabelText("Search canvases"));+ await user.keyboard("{ArrowDown}{ArrowDown}{ArrowUp}{Enter}");++ expect(mocks.navigate).toHaveBeenCalledWith({+ to: "/canvases",+ search: { canvas: "canvas-first" },+ });+ });+});diff --git a/products/desktop/packages/ui/src/features/canvas/components/CanvasesPane.tsx b/products/desktop/packages/ui/src/features/canvas/components/CanvasesPane.tsxnew file mode 100644index 000000000000..50cc21455b35--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/CanvasesPane.tsx@@ -0,0 +1,234 @@+import { BlueprintIcon } from "@phosphor-icons/react";+import {+ type CanvasListService,+ type CanvasListSettings,+ DEFAULT_CANVAS_LIST_SETTINGS,+} from "@posthog/core/canvas/canvasListService";+import type { DashboardRecord } from "@posthog/core/canvas/dashboardSchemas";+import { CANVAS_LIST_SERVICE } from "@posthog/core/canvas/identifiers";+import { useService } from "@posthog/di/react";+import {+ Autocomplete,+ AutocompleteItem,+ AutocompleteList,+ cn,+ Empty,+ EmptyDescription,+ EmptyHeader,+ EmptyMedia,+ EmptyTitle,+ MenuLabel,+ Spinner,+} from "@posthog/quill";+import { formatAbsoluteDateTime, formatRelativeAge } from "@posthog/shared";+import { ANALYTICS_EVENTS } from "@posthog/shared/analytics-events";+import { useMeQuery } from "@posthog/ui/features/auth/useMeQuery";+import { CanvasFilterMenu } from "@posthog/ui/features/canvas/components/CanvasFilterMenu";+import { buildCanvasSpaceOptions } from "@posthog/ui/features/canvas/components/canvasSpaceOptions";+import { iconForTemplate } from "@posthog/ui/features/canvas/components/canvasTemplateIcon";+import { SidebarSearchHeader } from "@posthog/ui/features/canvas/components/SidebarSearchHeader";+import { useChannels } from "@posthog/ui/features/canvas/hooks/useChannels";+import { useAllCanvases } from "@posthog/ui/features/canvas/hooks/useDashboards";+import { useSelectedCanvasId } from "@posthog/ui/features/canvas/hooks/useSelectedCanvasId";+import { useCanvasViewedStore } from "@posthog/ui/features/canvas/stores/canvasViewedStore";+import { userDisplayName } from "@posthog/ui/features/canvas/utils/userDisplay";+import { track } from "@posthog/ui/shell/analytics";+import { useNavigate } from "@tanstack/react-router";+import {+ Fragment,+ type ReactElement,+ useEffect,+ useMemo,+ useState,+} from "react";++export function CanvasesPane({+ className,+}: {+ className?: string;+}): ReactElement {+ const { dashboards, isLoading } = useAllCanvases();+ const { channels } = useChannels();+ const { data: currentUser } = useMeQuery();+ const canvasListService = useService<CanvasListService>(CANVAS_LIST_SERVICE);+ const navigate = useNavigate();+ const selectedId = useSelectedCanvasId();+ const [query, setQuery] = useState("");+ const [settings, setSettings] = useState<CanvasListSettings>(+ DEFAULT_CANVAS_LIST_SETTINGS,+ );+ const [recentlyViewedSortSnapshot, setRecentlyViewedSortSnapshot] = useState<+ Record<string, number>+ >(() => ({ ...useCanvasViewedStore.getState().lastViewedAtByCanvasId }));+ const lastViewedAtByCanvasId = useCanvasViewedStore(+ (state) => state.lastViewedAtByCanvasId,+ );+ useEffect(() => {+ if (useCanvasViewedStore.persist.hasHydrated()) {+ setRecentlyViewedSortSnapshot({+ ...useCanvasViewedStore.getState().lastViewedAtByCanvasId,+ });+ return;+ }+ return useCanvasViewedStore.persist.onFinishHydration((state) => {+ setRecentlyViewedSortSnapshot({ ...state.lastViewedAtByCanvasId });+ });+ }, []);+ const spaceOptions = useMemo(+ () => buildCanvasSpaceOptions(channels),+ [channels],+ );+ const canvasListUser = useMemo(+ () =>+ currentUser+ ? { uuid: currentUser.uuid, name: userDisplayName(currentUser) }+ : undefined,+ [currentUser],+ );+ const viewModel = useMemo(+ () =>+ canvasListService.buildViewModel({+ canvases: dashboards,+ spaces: channels,+ currentUser: canvasListUser,+ settings,+ query,+ lastViewedAtByCanvasId: recentlyViewedSortSnapshot,+ }),+ [+ canvasListService,+ canvasListUser,+ channels,+ dashboards,+ query,+ recentlyViewedSortSnapshot,+ settings,+ ],+ );+ const optionValues = viewModel.canvases.map((canvas) => canvas.id);+ const changeSettings = (nextSettings: CanvasListSettings): void => {+ const update = canvasListService.updateSettings({+ canvases: dashboards,+ spaces: channels,+ currentUser: canvasListUser,+ currentSettings: viewModel.settings,+ nextSettings,+ });+ if (update.refreshRecentlyViewedSnapshot) {+ setRecentlyViewedSortSnapshot({+ ...useCanvasViewedStore.getState().lastViewedAtByCanvasId,+ });+ }+ setSettings(update.settings);+ };+ const open = (canvas: DashboardRecord): void => {+ track(ANALYTICS_EVENTS.DASHBOARD_ACTION, {+ action_type: "open",+ surface: "canvases_pane",+ channel_id: canvas.channelId,+ dashboard_id: canvas.id,+ template_id: canvas.templateId,+ });+ void navigate({ to: "/canvases", search: { canvas: canvas.id } });+ };+ return (+ <Autocomplete<string>+ inline+ open+ value={query}+ items={optionValues}+ filter={null}+ onValueChange={(value, eventDetails) => {+ if (+ eventDetails.reason === "input-change" &&+ typeof value === "string"+ ) {+ setQuery(value);+ }+ }}+ >+ <div className={cn("flex min-h-0 flex-col", className)}>+ <SidebarSearchHeader+ title="Canvases"+ query={query}+ placeholder="Search canvases…"+ searchLabel="Search canvases"+ onClear={() => setQuery("")}+ actions={+ <CanvasFilterMenu+ spaceOptions={spaceOptions}+ creatorOptions={viewModel.creatorOptions}+ createdByDisabled={viewModel.personalSpaceSelected}+ settings={viewModel.settings}+ onChange={changeSettings}+ />+ }+ />+ <AutocompleteList className="sidebar-autocomplete-tree scroll-mask-8 !max-h-none !p-1.5 min-h-0 flex-1 overflow-y-auto">+ {isLoading ? (+ <div className="flex justify-center py-10">+ <Spinner />+ </div>+ ) : viewModel.canvases.length === 0 ? (+ <Empty className="border-0 py-8">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BlueprintIcon />+ </EmptyMedia>+ <EmptyTitle>No canvases match</EmptyTitle>+ <EmptyDescription>+ Try another search or filter.+ </EmptyDescription>+ </EmptyHeader>+ </Empty>+ ) : (+ <div className="flex flex-col gap-px">+ {viewModel.sections.map((section) => (+ <Fragment key={section.key}>+ {section.label ? (+ <MenuLabel>{section.label}</MenuLabel>+ ) : null}+ {section.canvases.map((canvas) => {+ const lastViewedAt = lastViewedAtByCanvasId[canvas.id];+ const lastViewedLabel = lastViewedAt+ ? `Last viewed ${formatRelativeAge(lastViewedAt)}`+ : "Not viewed yet";+ const lastViewedTitle = lastViewedAt+ ? `Last viewed ${formatAbsoluteDateTime(lastViewedAt)}`+ : lastViewedLabel;++ return (+ <AutocompleteItem+ key={canvas.id}+ value={canvas.id}+ nativeButton+ className={cn(+ "h-auto w-full items-start py-1.5 text-left ring-offset-0 data-highlighted:border-transparent data-highlighted:bg-fill-hover data-highlighted:ring-0 [&>span]:w-full [&>span]:items-start [&>span]:gap-2",+ canvas.id === selectedId && "bg-fill-selected",+ )}+ onClick={() => open(canvas)}+ >+ {iconForTemplate(canvas.templateId, { size: 14 })}+ <span className="min-w-0">+ <span className="block truncate text-[13px]">+ {canvas.name}+ </span>+ <span+ className="block truncate text-muted-foreground text-xxs"+ title={lastViewedTitle}+ >+ {canvas.createdBy ?? "Unknown"} · {lastViewedLabel}+ </span>+ </span>+ </AutocompleteItem>+ );+ })}+ </Fragment>+ ))}+ </div>+ )}+ </AutocompleteList>+ </div>+ </Autocomplete>+ );+}diff --git a/products/desktop/packages/ui/src/features/canvas/components/CanvasesRoute.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/CanvasesRoute.test.tsxnew file mode 100644index 000000000000..4de1d9269738--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/CanvasesRoute.test.tsx@@ -0,0 +1,44 @@+import { render } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++const mocks = vi.hoisted(() => ({+ canvasId: "canvas-1" as string | undefined,+ markCanvasViewed: vi.fn(),+}));++vi.mock("@posthog/ui/features/canvas/components/WebsiteDashboard", () => ({+ WebsiteDashboard: ({ dashboardId }: { dashboardId: string }) => (+ <div>{dashboardId}</div>+ ),+}));+vi.mock("@posthog/ui/features/canvas/hooks/useSelectedCanvasId", () => ({+ useSelectedCanvasId: () => mocks.canvasId,+}));+vi.mock("@posthog/ui/features/canvas/stores/canvasViewedStore", () => ({+ useCanvasViewedStore: (+ selector: (state: {+ markCanvasViewed: typeof mocks.markCanvasViewed;+ }) => typeof mocks.markCanvasViewed,+ ) => selector({ markCanvasViewed: mocks.markCanvasViewed }),+}));++import { CanvasesRoute } from "./CanvasesRoute";++describe("CanvasesRoute", () => {+ beforeEach(() => {+ mocks.canvasId = "canvas-1";+ mocks.markCanvasViewed.mockReset();+ });++ afterEach(() => {+ vi.restoreAllMocks();+ });++ it("records the selected canvas as viewed", () => {+ vi.spyOn(Date, "now").mockReturnValue(1234);++ render(<CanvasesRoute />);++ expect(mocks.markCanvasViewed).toHaveBeenCalledWith("canvas-1", 1234);+ });+});diff --git a/products/desktop/packages/ui/src/features/canvas/components/CanvasesRoute.tsx b/products/desktop/packages/ui/src/features/canvas/components/CanvasesRoute.tsxnew file mode 100644index 000000000000..8a0841d8c78f--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/CanvasesRoute.tsx@@ -0,0 +1,39 @@+import { BlueprintIcon } from "@phosphor-icons/react";+import {+ Empty,+ EmptyDescription,+ EmptyHeader,+ EmptyMedia,+ EmptyTitle,+} from "@posthog/quill";+import { WebsiteDashboard } from "@posthog/ui/features/canvas/components/WebsiteDashboard";+import { useSelectedCanvasId } from "@posthog/ui/features/canvas/hooks/useSelectedCanvasId";+import { useCanvasViewedStore } from "@posthog/ui/features/canvas/stores/canvasViewedStore";+import { useEffect } from "react";++export function CanvasesRoute() {+ const canvasId = useSelectedCanvasId();+ const markCanvasViewed = useCanvasViewedStore(+ (state) => state.markCanvasViewed,+ );+ useEffect(() => {+ if (canvasId) markCanvasViewed(canvasId, Date.now());+ }, [canvasId, markCanvasViewed]);++ if (canvasId) return <WebsiteDashboard dashboardId={canvasId} />;+ return (+ <div className="flex h-full items-center justify-center p-6">+ <Empty className="border-0">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BlueprintIcon />+ </EmptyMedia>+ <EmptyTitle>Pick a canvas</EmptyTitle>+ <EmptyDescription>+ Choose a canvas from the list to open it here.+ </EmptyDescription>+ </EmptyHeader>+ </Empty>+ </div>+ );+}diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelFilterMenu.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelFilterMenu.tsxindex 545976e38414..36e31c858663 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelFilterMenu.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelFilterMenu.tsx@@ -232,6 +232,22 @@ export function ChannelFilterMenu({sideOffset={6}className="min-w-fit">+ {/* A canvas has no repository, so the canvas tab cannot group by repository. */}+ {showRunFilters && (+ <FilterSubmenu+ label="Group by"+ options={GROUPING_OPTIONS}+ value={grouping}+ onChange={onGroupingChange}+ />+ )}+ <FilterSubmenu+ label="Sort by"+ options={SORT_OPTIONS}+ value={sort}+ onChange={onSortChange}+ />+ <DropdownMenuSeparator />{showRunFilters && (<FilterSubmenulabel="Status"@@ -273,23 +289,9 @@ export function ChannelFilterMenu({/></>)}- <DropdownMenuSeparator />- <FilterSubmenu- label="Sort by"- options={SORT_OPTIONS}- value={sort}- onChange={onSortChange}- />- {/* A canvas has no repository, and no second row to configure, so the- tab that lists them is offered neither. */}+ {/* A canvas has no configurable second row, so the canvas tab has no appearance editor. */}{showRunFilters && (<>- <FilterSubmenu- label="Group by"- options={GROUPING_OPTIONS}- value={grouping}- onChange={onGroupingChange}- /><DropdownMenuSeparator /><DropdownMenuItemdata-attr="edit-list-item-appearance"diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelsList.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelsList.tsxindex e1d21f903db6..9af86ae77da6 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelsList.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelsList.tsx@@ -1902,7 +1902,7 @@ export function ChannelsList() {// ordered. Here the list *is* the pane, so the cap has to go and the pane's// own padding has to win: `!` is what outranks an unlayered rule.const listClass = cn(- "flex flex-col gap-px",+ "sidebar-autocomplete-tree flex flex-col gap-px","!max-h-none !px-2 !pt-2 !pb-16 scroll-py-8",scrollClass,);diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.tsxindex 3980fffaedbe..9101154b25f6 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelsSidebar.tsx@@ -3,6 +3,7 @@ import { cn, Separator } from "@posthog/quill";import { useArchivedTaskIds } from "@posthog/ui/features/archive/useArchivedTaskIds";import { usePendingTabViewState } from "@posthog/ui/features/browser-tabs/usePendingTabViewState";import { ActivityFeedList } from "@posthog/ui/features/canvas/components/ActivityFeedList";+import { CanvasesPane } from "@posthog/ui/features/canvas/components/CanvasesPane";import { ChannelItemPreviewCardProvider } from "@posthog/ui/features/canvas/components/ChannelItemHoverCard";import { ChannelSidebar } from "@posthog/ui/features/canvas/components/ChannelSidebar";import { ChannelsFab } from "@posthog/ui/features/canvas/components/ChannelsFab";@@ -201,7 +202,7 @@ export function ChannelsSidebar() {// 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 { pane: railPane, showsActivityDetail } = useRailSurface();const selectedActivityId = useActivitySelection()?.id;const { feedId } = useParams({ strict: false });const pane = useChannelPaneStore((s) => s.pane);@@ -259,6 +260,8 @@ export function ChannelsSidebar() {onActivate={selectActivityItem}onReportActivate={selectActivityReport}/>+ ) : railPane === "canvases" ? (+ <CanvasesPane className="min-h-0 flex-1" />) : feedId ? (<TaskFeedPane feedId={feedId} className="min-h-0 flex-1" />) : (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.tsxindex 3575f643728f..2bcd63655cdf 100644--- a/products/desktop/packages/ui/src/features/canvas/components/NavRail.test.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/NavRail.test.tsx@@ -9,6 +9,7 @@ const mocks = vi.hoisted(() => ({href: "/",navigate: vi.fn(),navigateToActivity: vi.fn(),+ navigateToCanvases: vi.fn(),navigateToSpaces: vi.fn(),navigateToChannel: vi.fn(),navigateToHome: vi.fn(),@@ -66,6 +67,7 @@ vi.mock("@posthog/ui/features/settings/hooks/useOpenSettings", () => ({vi.mock("@posthog/ui/router/navigationBridge", () => ({getCurrentMatches: () => [{ fullPath: mocks.fullPath }],navigateToActivity: (...a: unknown[]) => mocks.navigateToActivity(...a),+ navigateToCanvases: (...a: unknown[]) => mocks.navigateToCanvases(...a),navigateToSpaces: (...a: unknown[]) => mocks.navigateToSpaces(...a),navigateToChannel: (...a: unknown[]) => mocks.navigateToChannel(...a),navigateToHome: (...a: unknown[]) => mocks.navigateToHome(...a),diff --git a/products/desktop/packages/ui/src/features/canvas/components/ShellLayout.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/ShellLayout.test.tsxindex a3b73fb0535c..aaa6de48ed1a 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ShellLayout.test.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ShellLayout.test.tsx@@ -12,15 +12,25 @@ vi.mock("@posthog/host-router/react", () => ({}),}));vi.mock("@posthog/ui/shell/analytics", () => ({ track: vi.fn() }));+vi.mock("@posthog/ui/features/canvas/hooks/useSelectedCanvasId", () => ({+ useSelectedCanvasId: () => useSelectedCanvasId(),+}));-const { useChannelTasks, useDashboard, useParams, usePathname, useTasks } =- vi.hoisted(() => ({- useChannelTasks: vi.fn(),- useDashboard: vi.fn(),- useParams: vi.fn(),- usePathname: vi.fn(),- useTasks: vi.fn(),- }));+const {+ useChannelTasks,+ useDashboard,+ useParams,+ usePathname,+ useSelectedCanvasId,+ useTasks,+} = vi.hoisted(() => ({+ useChannelTasks: vi.fn(),+ useDashboard: vi.fn(),+ useParams: vi.fn(),+ usePathname: vi.fn(),+ useSelectedCanvasId: vi.fn(),+ useTasks: vi.fn(),+}));vi.mock("@tanstack/react-router", () => ({Outlet: () => null,@@ -33,11 +43,13 @@ vi.mock("@tanstack/react-router", () => ({location: { pathname: string };matches: { routeId: string }[];}) => unknown;- }) =>- select({- location: { pathname: usePathname() },+ }) => {+ const pathname = usePathname();+ return select({+ location: { pathname },matches: [{ routeId: "/spaces/$channelId/tasks/$taskId" }],- }),+ });+ },}));vi.mock(@@ -120,18 +132,22 @@ function renderLayout({tasks = [{ id: "task-1", title: "Fix the bug" }],channelTaskIds = tasks.map((task) => task.id),dashboard,+ selectedCanvasId,}: {pathname: string;params: Record<string, string>;tasks?: { id: string; title: string }[];channelTaskIds?: string[];dashboard?: {+ channelId?: string;name: string;templateId: string;generationTaskId: string | null;};+ selectedCanvasId?: string;}) {usePathname.mockReturnValue(pathname);+ useSelectedCanvasId.mockReturnValue(selectedCanvasId);useParams.mockReturnValue(params);useTasks.mockReturnValue({ data: tasks });useChannelTasks.mockReturnValue({@@ -149,7 +165,7 @@ function renderLayout({);}-describe("ShellLayout task header actions", () => {+describe("ShellLayout headers", () => {it.each([["while generating", "task-1"],["after generation", null],@@ -198,6 +214,30 @@ describe("ShellLayout task header actions", () => {});});+ it("renders the canvas toolbar for a Canvases rail selection", () => {+ renderLayout({+ pathname: "/canvases",+ params: {},+ selectedCanvasId: "canvas-1",+ dashboard: {+ channelId: "chan-1",+ name: "Launch",+ templateId: "freeform",+ generationTaskId: "task-1",+ },+ });++ expect(screen.getByText("project-bluebird")).toBeInTheDocument();+ expect(screen.getByText("Launch")).toBeInTheDocument();+ expect(+ screen.getByRole("button", { name: /Comments/ }),+ ).toBeInTheDocument();+ expect(+ screen.getByRole("button", { name: "Canvas options" }),+ ).toBeInTheDocument();+ expect(screen.getByRole("button", { name: "Edit" })).toBeInTheDocument();+ });+it("renders the task action row on a channel task detail", () => {renderLayout({pathname: "/spaces/chan-1/tasks/task-1",diff --git a/products/desktop/packages/ui/src/features/canvas/components/ShellLayout.tsx b/products/desktop/packages/ui/src/features/canvas/components/ShellLayout.tsxindex c7c001fbfab9..34b954fbf731 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ShellLayout.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ShellLayout.tsx@@ -41,6 +41,7 @@ import {useDashboard,useDashboardMutations,} from "@posthog/ui/features/canvas/hooks/useDashboards";+import { useSelectedCanvasId } from "@posthog/ui/features/canvas/hooks/useSelectedCanvasId";import { useCanvasChatPanelStore } from "@posthog/ui/features/canvas/stores/canvasChatPanelStore";import {useDashboardEditStore,@@ -344,16 +345,17 @@ function CanvasBreadcrumb({);}-// Canvas toolbar + content outlet for the Website space (channel-scoped). A-// single toolbar carries the channel breadcrumb (left) and data controls /-// actions (right).export function ShellLayout() {const spacesLayout = useChannelsLayout();const pathname = useRouterState({ select: (s) => s.location.pathname });+ const selectedCanvasId = useSelectedCanvasId();const params = useParams({ strict: false });const channelId = params.channelId;const dashboardId = params.dashboardId;+ const { dashboard: selectedCanvas } = useDashboard(selectedCanvasId);+ const toolbarDashboardId = dashboardId ?? selectedCanvasId;+ const toolbarChannelId = channelId ?? selectedCanvas?.channelId;// Activity reads a task into its pane off the feed, so the session is not// always the one in the URL.@@ -380,8 +382,11 @@ export function ShellLayout() {: spacesLayout? "Space": "Channel";+ const toolbarChannelName = toolbarChannelId+ ? (channels.find((c) => c.id === toolbarChannelId)?.name ?? channelName)+ : channelName;- const isDashboardDetail = Boolean(channelId && dashboardId);+ const isDashboardDetail = Boolean(toolbarDashboardId);// The canvases grid (its own sub-route now that the channel index is the// static homepage, which carries its own header content).const isDashboardsGrid =@@ -389,8 +394,7 @@ export function ShellLayout() {// Whether the single toolbar should render: the canvases grid, or any single// canvas (so Edit lives here too).- const showToolbar =- Boolean(channelId) && (isDashboardsGrid || isDashboardDetail);+ const showToolbar = isDashboardsGrid || isDashboardDetail;return (<Flex direction="column" height="100%" overflow="hidden">@@ -405,28 +409,28 @@ export function ShellLayout() {{/* Single canvas toolbar: the "# channel / canvas" breadcrumb (left) andcanvas actions (Edit / New canvas) on the right.Freeform canvases own their own date control in-app (DateTimePicker). */}- {showToolbar && channelId && (+ {showToolbar && (<div className="flex h-10 shrink-0 items-center border-border border-b px-3">- {isDashboardDetail && dashboardId ? (+ {isDashboardDetail && toolbarDashboardId && toolbarChannelId ? (<CanvasBreadcrumb- channelName={channelName}- channelId={channelId}- dashboardId={dashboardId}+ channelName={toolbarChannelName}+ channelId={toolbarChannelId}+ dashboardId={toolbarDashboardId}trailing={<FreeformEditControls- channelId={channelId}- dashboardId={dashboardId}+ channelId={toolbarChannelId}+ dashboardId={toolbarDashboardId}/>}/>- ) : (+ ) : channelId ? (<ChannelBreadcrumbchannelName={channelName}channelId={channelId}leafLabel="Canvases"trailing={<NewCanvasMenu channelId={channelId} />}/>- )}+ ) : null}</div>)}{/* The right panel lays itself over this row's right edge and pins itsdiff --git a/products/desktop/packages/ui/src/features/canvas/components/SpaceHeaderRow.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/SpaceHeaderRow.test.tsxindex f926a16e66ad..5e316d375c6b 100644--- a/products/desktop/packages/ui/src/features/canvas/components/SpaceHeaderRow.test.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/SpaceHeaderRow.test.tsx@@ -29,6 +29,9 @@ vi.mock("@posthog/host-router/react", () => ({}),}));vi.mock("@posthog/ui/shell/analytics", () => ({ track: vi.fn() }));+vi.mock("@posthog/ui/features/canvas/hooks/useSelectedCanvasId", () => ({+ useSelectedCanvasId: () => undefined,+}));vi.mock("@tanstack/react-router", () => ({// The route's own pane, which is where the header's writer lives.Outlet: () => <ActivityDetailPane />,diff --git a/products/desktop/packages/ui/src/features/canvas/components/canvasFilterSelection.test.ts b/products/desktop/packages/ui/src/features/canvas/components/canvasFilterSelection.test.tsnew file mode 100644index 000000000000..1ddfa22b932a--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/canvasFilterSelection.test.ts@@ -0,0 +1,32 @@+import { describe, expect, it } from "vitest";+import {+ summarizeCreatorSelection,+ summarizeSpaceSelection,+} from "./canvasFilterSelection";++const OPTIONS = [+ { value: null, label: "Anyone" },+ { value: "me", label: "Me" },+ { value: "ada", label: "Ada Lovelace" },+ { value: "grace", label: "Grace Hopper" },+];++describe("canvasFilterSelection", () => {+ it.each([+ { values: [], expected: "Anyone" },+ { values: ["me"], expected: "Me" },+ { values: ["me", "ada"], expected: "Me + 1 user" },+ { values: ["me", "ada", "grace"], expected: "Me + 2 users" },+ { values: ["ada", "grace"], expected: "2 users" },+ ])("summarizes creator selection as $expected", ({ values, expected }) => {+ expect(summarizeCreatorSelection(OPTIONS, values)).toBe(expected);+ });++ it.each([+ { values: [], expected: "Every space" },+ { values: ["ada"], expected: "Ada Lovelace" },+ { values: ["ada", "grace"], expected: "2 spaces" },+ ])("summarizes space selection as $expected", ({ values, expected }) => {+ expect(summarizeSpaceSelection(OPTIONS, values)).toBe(expected);+ });+});diff --git a/products/desktop/packages/ui/src/features/canvas/components/canvasFilterSelection.ts b/products/desktop/packages/ui/src/features/canvas/components/canvasFilterSelection.tsnew file mode 100644index 000000000000..37e9de24347f--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/canvasFilterSelection.ts@@ -0,0 +1,48 @@+import type { ReactNode } from "react";++export interface CanvasFilterOption<Value extends string = string> {+ value: Value;+ label: string;+ searchLabel?: string;+ icon?: ReactNode;+}++export interface CanvasMultiSelectOption+ extends Omit<CanvasFilterOption, "value"> {+ value: string | null;+}++function selectedOptions(+ options: readonly CanvasMultiSelectOption[],+ values: readonly string[],+): CanvasMultiSelectOption[] {+ const selectedValues = new Set(values);+ return options.filter(+ (option) => option.value !== null && selectedValues.has(option.value),+ );+}++export function summarizeSpaceSelection(+ options: readonly CanvasMultiSelectOption[],+ values: readonly string[],+): string {+ const selected = selectedOptions(options, values);+ if (selected.length === 0) return "Every space";+ if (selected.length === 1) return selected[0].label;+ return `${selected.length} spaces`;+}++export function summarizeCreatorSelection(+ options: readonly CanvasMultiSelectOption[],+ values: readonly string[],+): string {+ const selected = selectedOptions(options, values);+ if (selected.length === 0) return "Anyone";+ if (selected.length === 1) return selected[0].label;++ const includesMe = selected.some((option) => option.label === "Me");+ if (!includesMe) return `${selected.length} users`;++ const otherUserCount = selected.length - 1;+ return `Me + ${otherUserCount} ${otherUserCount === 1 ? "user" : "users"}`;+}diff --git a/products/desktop/packages/ui/src/features/canvas/components/canvasSpaceOptions.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/canvasSpaceOptions.test.tsxnew file mode 100644index 000000000000..defe032997ee--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/canvasSpaceOptions.test.tsx@@ -0,0 +1,38 @@+import { LockSimpleIcon } from "@phosphor-icons/react";+import type { Channel } from "@posthog/ui/features/canvas/hooks/useChannels";+import type { ReactElement } from "react";+import { describe, expect, it } from "vitest";+import { buildCanvasSpaceOptions } from "./canvasSpaceOptions";++const CHANNELS: Channel[] = [+ {+ id: "access-control",+ name: "access-control",+ channelType: "public",+ starred: false,+ repositories: [],+ createdBy: null,+ },+ {+ id: "personal",+ name: "me",+ channelType: "personal",+ starred: false,+ repositories: [],+ createdBy: null,+ },+];++describe("buildCanvasSpaceOptions", () => {+ it("puts personal above the default and uses space labels", () => {+ const options = buildCanvasSpaceOptions(CHANNELS);++ expect(options.map(({ label }) => label)).toEqual([+ "personal",+ "Every space",+ "access-control",+ ]);+ expect((options[0].icon as ReactElement).type).toBe(LockSimpleIcon);+ expect(options[2].icon).toBeNull();+ });+});diff --git a/products/desktop/packages/ui/src/features/canvas/components/canvasSpaceOptions.tsx b/products/desktop/packages/ui/src/features/canvas/components/canvasSpaceOptions.tsxnew file mode 100644index 000000000000..8494bb5117ea--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/components/canvasSpaceOptions.tsx@@ -0,0 +1,33 @@+import type { CanvasMultiSelectOption } from "@posthog/ui/features/canvas/components/canvasFilterSelection";+import { channelGlyph } from "@posthog/ui/features/canvas/components/channelGlyph";+import type { Channel } from "@posthog/ui/features/canvas/hooks/useChannels";++function optionForChannel(channel: Channel): CanvasMultiSelectOption {+ const personal = channel.channelType === "personal";+ return {+ value: channel.id,+ label: personal ? "personal" : channel.name,+ icon: channelGlyph(channel.name, {+ size: 16,+ personal,+ space: true,+ className: "shrink-0 text-muted-foreground",+ }),+ };+}++export function buildCanvasSpaceOptions(+ channels: readonly Channel[],+): CanvasMultiSelectOption[] {+ const personal = channels.filter(+ (channel) => channel.channelType === "personal",+ );+ const shared = channels.filter(+ (channel) => channel.channelType !== "personal",+ );+ return [+ ...personal.map(optionForChannel),+ { value: null, label: "Every space" },+ ...shared.map(optionForChannel),+ ];+}diff --git a/products/desktop/packages/ui/src/features/canvas/components/railDestinations.ts b/products/desktop/packages/ui/src/features/canvas/components/railDestinations.tsindex 5845cc316725..1d4405a9a63e 100644--- a/products/desktop/packages/ui/src/features/canvas/components/railDestinations.ts+++ b/products/desktop/packages/ui/src/features/canvas/components/railDestinations.ts@@ -5,6 +5,7 @@ import {HouseSimple,type IconProps,Lightning,+ ShapesIcon,} from "@phosphor-icons/react";import type { RailVisit } from "@posthog/shared";import type { SidebarNavItem } from "@posthog/shared/analytics-events";@@ -24,6 +25,7 @@ import type { CountBadgeTone } from "@posthog/ui/primitives/CountBadge";import { LoopIcon } from "@posthog/ui/primitives/LoopIcon";import {navigateToActivity,+ navigateToCanvases,navigateToChannel,navigateToCommandCenter,navigateToHome,@@ -164,6 +166,14 @@ export const RAIL_DESTINATIONS: readonly RailDestination[] = [onPick: navigateToActivity,count: (counts) => counts.activity,},+ {+ pane: "canvases",+ label: "Canvases",+ analyticsId: "canvases",+ Icon: ShapesIcon,+ href: "/canvases",+ onPick: () => navigateToCanvases(),+ },{pane: "inbox",label: "Self-driving",diff --git a/products/desktop/packages/ui/src/features/canvas/hooks/useDashboards.ts b/products/desktop/packages/ui/src/features/canvas/hooks/useDashboards.tsindex a078769b220b..ef69ec0f5ccc 100644--- a/products/desktop/packages/ui/src/features/canvas/hooks/useDashboards.ts+++ b/products/desktop/packages/ui/src/features/canvas/hooks/useDashboards.ts@@ -57,6 +57,23 @@ export function useDashboards(return { dashboards: data ?? [], isLoading };}+/** Every canvas across every visible space. */+export function useAllCanvases(): {+ dashboards: DashboardRecord[];+ isLoading: boolean;+} {+ const trpc = useHostTRPC();+ const { data, isLoading } = useQuery(+ trpc.dashboards.listAll.queryOptions(undefined, {+ gcTime: SPACE_QUERY_GC_TIME_MS,+ meta: AUTH_SCOPED_QUERY_META,+ refetchInterval: SPACE_QUERY_REFETCH_INTERVAL_MS,+ staleTime: SPACE_QUERY_STALE_TIME_MS,+ }),+ );+ return { dashboards: data ?? [], isLoading };+}+/*** Warm the dashboards-list cache for a channel ahead of opening it (e.g. on* hover), so expanding the channel shows its canvases without a cold fetch.diff --git a/products/desktop/packages/ui/src/features/canvas/hooks/useSelectedCanvasId.ts b/products/desktop/packages/ui/src/features/canvas/hooks/useSelectedCanvasId.tsnew file mode 100644index 000000000000..4321c1cdbd0d--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/hooks/useSelectedCanvasId.ts@@ -0,0 +1,9 @@+import { useMatch } from "@tanstack/react-router";++export function useSelectedCanvasId(): string | undefined {+ return useMatch({+ from: "/_shell/canvases",+ shouldThrow: false,+ select: (match) => match.search.canvas,+ });+}diff --git a/products/desktop/packages/ui/src/features/canvas/railPane.ts b/products/desktop/packages/ui/src/features/canvas/railPane.tsindex 6beb67cdfaef..631bd0326cfa 100644--- a/products/desktop/packages/ui/src/features/canvas/railPane.ts+++ b/products/desktop/packages/ui/src/features/canvas/railPane.ts@@ -12,6 +12,7 @@ export type NavRailPane =| "home"| "spaces"| "activity"+ | "canvases"| "inbox"| "command-center"| "loops"@@ -28,6 +29,7 @@ export const RAIL_PANE_ROOT: Readonly<Record<NavRailPane, string>> = {home: "/",spaces: "/spaces",activity: "/activity",+ canvases: "/canvases",inbox: "/inbox","command-center": "/command-center",loops: "/loops",@@ -39,6 +41,7 @@ export const RAIL_PANE_ROOT: Readonly<Record<NavRailPane, string>> = {const CLAIMED: readonly NavRailPane[] = ["home","activity",+ "canvases","inbox","command-center","loops",@@ -71,7 +74,11 @@ export function getRailPane(): NavRailPane {// Home, Inbox, Command Center and Loops are whole-screen destinations: no// route under them may put a second nav on the screen. Spaces owns the space// tree, Activity owns the feed.-const PANES_WITH_SIDEBAR = new Set<NavRailPane>(["spaces", "activity"]);+const PANES_WITH_SIDEBAR = new Set<NavRailPane>([+ "spaces",+ "activity",+ "canvases",+]);export function railPaneHasSidebar(pane: NavRailPane): boolean {return PANES_WITH_SIDEBAR.has(pane);diff --git a/products/desktop/packages/ui/src/features/canvas/stores/activityFilterStore.test.ts b/products/desktop/packages/ui/src/features/canvas/stores/activityFilterStore.test.tsindex 35343c0ff17d..40395d792e81 100644--- a/products/desktop/packages/ui/src/features/canvas/stores/activityFilterStore.test.ts+++ b/products/desktop/packages/ui/src/features/canvas/stores/activityFilterStore.test.ts@@ -34,4 +34,39 @@ describe("activityFilterStore", () => {false,).toBe(false);});++ it("resets the menu filters without changing unread mode or other projects", async () => {+ const { hasActiveActivityMenuFilters, useActivityFilterStore } =+ await import("./activityFilterStore");+ const state = useActivityFilterStore.getState();++ state.setUnreadsOnly(true);+ state.setMentionsEnabled(false);+ state.setInboxEnabled("us:1", true);+ state.setInboxEnabled("eu:1", true);+ state.setInboxScope("entire-project");+ state.toggleInboxSourceProduct("error_tracking");+ state.setInboxPrFilter("with_pr");+ state.setInboxSort("created_at", "desc");+ state.toggleInboxPriority("P2");+ expect(+ hasActiveActivityMenuFilters(useActivityFilterStore.getState(), "us:1"),+ ).toBe(true);+ useActivityFilterStore.getState().resetMenuFilters("us:1");++ expect(useActivityFilterStore.getState()).toMatchObject({+ unreadsOnly: true,+ mentionsEnabled: true,+ inboxEnabledByAuthIdentity: { "us:1": false, "eu:1": true },+ inboxScope: "for-you",+ inboxSourceProductFilter: [],+ inboxPrFilter: "all",+ inboxSortField: "priority",+ inboxSortDirection: "asc",+ inboxPriorityFilter: ["P1"],+ });+ expect(+ hasActiveActivityMenuFilters(useActivityFilterStore.getState(), "us:1"),+ ).toBe(false);+ });});diff --git a/products/desktop/packages/ui/src/features/canvas/stores/activityFilterStore.ts b/products/desktop/packages/ui/src/features/canvas/stores/activityFilterStore.tsindex ae988b17daeb..57b00de6f46d 100644--- a/products/desktop/packages/ui/src/features/canvas/stores/activityFilterStore.ts+++ b/products/desktop/packages/ui/src/features/canvas/stores/activityFilterStore.ts@@ -9,6 +9,16 @@ import { persist } from "zustand/middleware";export type ActivityInboxScope = "for-you" | "entire-project";+const DEFAULT_ACTIVITY_MENU_FILTERS = {+ mentionsEnabled: true,+ inboxScope: "for-you" as const,+ inboxSourceProductFilter: [] as SourceProduct[],+ inboxPrFilter: "all" as InboxPrFilter,+ inboxSortField: "priority" as InboxSortField,+ inboxSortDirection: "asc" as const,+ inboxPriorityFilter: ["P1"] as SignalReportPriority[],+};+interface ActivityFilterStore {/** Show only activity that hasn't been read yet. */unreadsOnly: boolean;@@ -33,6 +43,28 @@ interface ActivityFilterStore {) => void;toggleInboxPriority: (priority: SignalReportPriority) => void;clearInboxPriorityFilter: () => void;+ resetMenuFilters: (authIdentity: string | null) => void;+}++export function hasActiveActivityMenuFilters(+ state: ActivityFilterStore,+ authIdentity: string | null,+): boolean {+ return (+ state.mentionsEnabled !== DEFAULT_ACTIVITY_MENU_FILTERS.mentionsEnabled ||+ (authIdentity+ ? (state.inboxEnabledByAuthIdentity[authIdentity] ?? false)+ : false) ||+ state.inboxScope !== DEFAULT_ACTIVITY_MENU_FILTERS.inboxScope ||+ state.inboxSourceProductFilter.length > 0 ||+ state.inboxPrFilter !== DEFAULT_ACTIVITY_MENU_FILTERS.inboxPrFilter ||+ state.inboxSortField !== DEFAULT_ACTIVITY_MENU_FILTERS.inboxSortField ||+ state.inboxSortDirection !==+ DEFAULT_ACTIVITY_MENU_FILTERS.inboxSortDirection ||+ state.inboxPriorityFilter.length !== 1 ||+ state.inboxPriorityFilter[0] !==+ DEFAULT_ACTIVITY_MENU_FILTERS.inboxPriorityFilter[0]+ );}// Per-device preference shared by the Activity popover and the Activity page, so@@ -41,14 +73,8 @@ export const useActivityFilterStore = create<ActivityFilterStore>()(persist((set) => ({unreadsOnly: false,- mentionsEnabled: true,inboxEnabledByAuthIdentity: {},- inboxScope: "for-you",- inboxSourceProductFilter: [],- inboxPrFilter: "all",- inboxSortField: "priority",- inboxSortDirection: "asc",- inboxPriorityFilter: ["P1"],+ ...DEFAULT_ACTIVITY_MENU_FILTERS,setUnreadsOnly: (unreadsOnly) => set({ unreadsOnly }),setMentionsEnabled: (mentionsEnabled) => set({ mentionsEnabled }),setInboxEnabled: (authIdentity, inboxEnabled) =>@@ -79,6 +105,16 @@ export const useActivityFilterStore = create<ActivityFilterStore>()(: [...state.inboxPriorityFilter, priority],})),clearInboxPriorityFilter: () => set({ inboxPriorityFilter: [] }),+ resetMenuFilters: (authIdentity) =>+ set((state) => ({+ ...DEFAULT_ACTIVITY_MENU_FILTERS,+ inboxEnabledByAuthIdentity: authIdentity+ ? {+ ...state.inboxEnabledByAuthIdentity,+ [authIdentity]: false,+ }+ : state.inboxEnabledByAuthIdentity,+ })),}),{name: "activity-filter-storage",diff --git a/products/desktop/packages/ui/src/features/canvas/stores/canvasViewedStore.test.ts b/products/desktop/packages/ui/src/features/canvas/stores/canvasViewedStore.test.tsnew file mode 100644index 000000000000..93a04f05e96c--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/stores/canvasViewedStore.test.ts@@ -0,0 +1,41 @@+import { expect, it, vi } from "vitest";++const readDelayMs = 5;++async function freshStore(+ stored: Record<string, number>,+): Promise<typeof import("./canvasViewedStore").useCanvasViewedStore> {+ vi.resetModules();+ vi.doMock("@posthog/ui/shell/rendererStorage", () => ({+ electronStorage: {+ getItem: async () => {+ await new Promise((resolve) => setTimeout(resolve, readDelayMs));+ return {+ state: { lastViewedAtByCanvasId: stored },+ version: 0,+ };+ },+ setItem: async () => {},+ removeItem: async () => {},+ },+ }));+ const { useCanvasViewedStore } = await import("./canvasViewedStore");+ return useCanvasViewedStore;+}++it("keeps the latest view when storage hydrates", async () => {+ const store = await freshStore({ first: 10, stored: 30 });+ store.getState().markCanvasViewed("first", 20);+ store.getState().markCanvasViewed("current", 40);++ await vi.waitFor(() => {+ expect(store.getState().lastViewedAtByCanvasId).toEqual({+ first: 20,+ stored: 30,+ current: 40,+ });+ });++ store.getState().markCanvasViewed("current", 35);+ expect(store.getState().lastViewedAtByCanvasId.current).toBe(40);+});diff --git a/products/desktop/packages/ui/src/features/canvas/stores/canvasViewedStore.ts b/products/desktop/packages/ui/src/features/canvas/stores/canvasViewedStore.tsnew file mode 100644index 000000000000..b82fc9548b8b--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/stores/canvasViewedStore.ts@@ -0,0 +1,52 @@+import { electronStorage } from "@posthog/ui/shell/rendererStorage";+import { create } from "zustand";+import { persist } from "zustand/middleware";++interface CanvasViewedState {+ lastViewedAtByCanvasId: Record<string, number>;+ markCanvasViewed: (canvasId: string, at: number) => void;+}++function latestViews(+ first: Record<string, number>,+ second: Record<string, number>,+): Record<string, number> {+ const merged = { ...first };+ for (const [canvasId, viewedAt] of Object.entries(second)) {+ merged[canvasId] = Math.max(merged[canvasId] ?? 0, viewedAt);+ }+ return merged;+}++export const useCanvasViewedStore = create<CanvasViewedState>()(+ persist(+ (set) => ({+ lastViewedAtByCanvasId: {},+ markCanvasViewed: (canvasId, at) =>+ set((state) => {+ if ((state.lastViewedAtByCanvasId[canvasId] ?? 0) >= at) return state;+ return {+ lastViewedAtByCanvasId: {+ ...state.lastViewedAtByCanvasId,+ [canvasId]: at,+ },+ };+ }),+ }),+ {+ name: "canvas-viewed",+ storage: electronStorage,+ partialize: (state) => ({+ lastViewedAtByCanvasId: state.lastViewedAtByCanvasId,+ }),+ merge: (persisted, current) => ({+ ...current,+ lastViewedAtByCanvasId: latestViews(+ current.lastViewedAtByCanvasId,+ (persisted as Partial<CanvasViewedState>)?.lastViewedAtByCanvasId ??+ {},+ ),+ }),+ },+ ),+);diff --git a/products/desktop/packages/ui/src/router/navigationBridge.ts b/products/desktop/packages/ui/src/router/navigationBridge.tsindex 5d3b055da722..651520f00562 100644--- a/products/desktop/packages/ui/src/router/navigationBridge.ts+++ b/products/desktop/packages/ui/src/router/navigationBridge.ts@@ -42,6 +42,13 @@ export function navigateToActivity(): void {void getRouterOrNull()?.navigate({ to: "/activity" });}+export function navigateToCanvases(canvasId?: string): void {+ void getRouterOrNull()?.navigate({+ to: "/canvases",+ search: { canvas: canvasId },+ });+}+export function navigateToHome(): void {void getRouterOrNull()?.navigate({ to: "/" });}diff --git a/products/desktop/packages/ui/src/router/routeTree.gen.ts b/products/desktop/packages/ui/src/router/routeTree.gen.tsindex 7d507e75b471..bffc8e03cfe5 100644--- a/products/desktop/packages/ui/src/router/routeTree.gen.ts+++ b/products/desktop/packages/ui/src/router/routeTree.gen.ts@@ -40,6 +40,7 @@ import { Route as ShellSkillsRouteImport } from './routes/_shell/skills'import { Route as ShellNewRouteImport } from './routes/_shell/new'import { Route as ShellMcpServersRouteImport } from './routes/_shell/mcp-servers'import { Route as ShellCommandCenterRouteImport } from './routes/_shell/command-center'+import { Route as ShellCanvasesRouteImport } from './routes/_shell/canvases'import { Route as ShellActivityRouteImport } from './routes/_shell/activity'import { Route as LoopsLoopIdIndexRouteImport } from './routes/loops/$loopId/index'import { Route as InboxRunsIndexRouteImport } from './routes/inbox/runs.index'@@ -225,6 +226,11 @@ const ShellCommandCenterRoute = ShellCommandCenterRouteImport.update({path: '/command-center',getParentRoute: () => ShellRoute,} as any)+const ShellCanvasesRoute = ShellCanvasesRouteImport.update({+ id: '/canvases',+ path: '/canvases',+ getParentRoute: () => ShellRoute,+} as any)const ShellActivityRoute = ShellActivityRouteImport.update({id: '/activity',path: '/activity',@@ -395,6 +401,7 @@ export interface FileRoutesByFullPath {'/pr': typeof PrRoute'/usage': typeof UsageRoute'/activity': typeof ShellActivityRoute+ '/canvases': typeof ShellCanvasesRoute'/command-center': typeof ShellCommandCenterRoute'/mcp-servers': typeof ShellMcpServersRoute'/new': typeof ShellNewRoute@@ -454,6 +461,7 @@ export interface FileRoutesByTo {'/pr': typeof PrRoute'/usage': typeof UsageRoute'/activity': typeof ShellActivityRoute+ '/canvases': typeof ShellCanvasesRoute'/command-center': typeof ShellCommandCenterRoute'/mcp-servers': typeof ShellMcpServersRoute'/new': typeof ShellNewRoute@@ -511,6 +519,7 @@ export interface FileRoutesById {'/pr': typeof PrRoute'/usage': typeof UsageRoute'/_shell/activity': typeof ShellActivityRoute+ '/_shell/canvases': typeof ShellCanvasesRoute'/_shell/command-center': typeof ShellCommandCenterRoute'/_shell/mcp-servers': typeof ShellMcpServersRoute'/_shell/new': typeof ShellNewRoute@@ -576,6 +585,7 @@ export interface FileRouteTypes {| '/pr'| '/usage'| '/activity'+ | '/canvases'| '/command-center'| '/mcp-servers'| '/new'@@ -635,6 +645,7 @@ export interface FileRouteTypes {| '/pr'| '/usage'| '/activity'+ | '/canvases'| '/command-center'| '/mcp-servers'| '/new'@@ -691,6 +702,7 @@ export interface FileRouteTypes {| '/pr'| '/usage'| '/_shell/activity'+ | '/_shell/canvases'| '/_shell/command-center'| '/_shell/mcp-servers'| '/_shell/new'@@ -987,6 +999,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof ShellCommandCenterRouteImportparentRoute: typeof ShellRoute}+ '/_shell/canvases': {+ id: '/_shell/canvases'+ path: '/canvases'+ fullPath: '/canvases'+ preLoaderRoute: typeof ShellCanvasesRouteImport+ parentRoute: typeof ShellRoute+ }'/_shell/activity': {id: '/_shell/activity'path: '/activity'@@ -1202,6 +1221,7 @@ declare module '@tanstack/react-router' {interface ShellRouteChildren {ShellActivityRoute: typeof ShellActivityRoute+ ShellCanvasesRoute: typeof ShellCanvasesRouteShellCommandCenterRoute: typeof ShellCommandCenterRouteShellMcpServersRoute: typeof ShellMcpServersRouteShellNewRoute: typeof ShellNewRoute@@ -1224,6 +1244,7 @@ interface ShellRouteChildren {const ShellRouteChildren: ShellRouteChildren = {ShellActivityRoute: ShellActivityRoute,+ ShellCanvasesRoute: ShellCanvasesRoute,ShellCommandCenterRoute: ShellCommandCenterRoute,ShellMcpServersRoute: ShellMcpServersRoute,ShellNewRoute: ShellNewRoute,diff --git a/products/desktop/packages/ui/src/router/routes/_shell/canvases.tsx b/products/desktop/packages/ui/src/router/routes/_shell/canvases.tsxnew file mode 100644index 000000000000..428bf7aaf533--- /dev/null+++ b/products/desktop/packages/ui/src/router/routes/_shell/canvases.tsx@@ -0,0 +1,12 @@+import { CanvasesRoute } from "@posthog/ui/features/canvas/components/CanvasesRoute";+import { createFileRoute } from "@tanstack/react-router";++export const Route = createFileRoute("/_shell/canvases")({+ validateSearch: (search: Record<string, unknown>) => ({+ canvas:+ typeof search.canvas === "string" && search.canvas+ ? search.canvas+ : undefined,+ }),+ component: CanvasesRoute,+});diff --git a/products/desktop/packages/ui/src/styles/globals.css b/products/desktop/packages/ui/src/styles/globals.cssindex b598bff6d16e..9c8a43f6e53c 100644--- a/products/desktop/packages/ui/src/styles/globals.css+++ b/products/desktop/packages/ui/src/styles/globals.css@@ -1480,6 +1480,18 @@ body.ph-window-blurred .app-fade-in {* caps are utility classes on the elements themselves, and a rule inside* @layer components would lose to them.*/+@layer components {+ /*+ * Arrow navigation can place one row under a stationary pointer while another row stays highlighted.+ * Remove the non-highlighted row's hover style so the list shows one active row.+ */+ .sidebar-autocomplete-tree:has([data-highlighted])+ [role="option"]:not([data-highlighted]):hover {+ color: inherit;+ background-color: transparent;+ }+}+/** @posthog/quill Tabs — quill paints an active trigger `var(--background)` with* `!important`, and `!important` inverts cascade-layer order, so no utility