Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-9281: feat(work): fold the Inbox into the Work panel; archive notifications when an issue is done (#10614)
Jiayuan Zhang6e54f5b3f562
diff --git a/packages/core/api/schemas.ts b/packages/core/api/schemas.tsindex dca67687ca..519d03fdf9 100644--- a/packages/core/api/schemas.ts+++ b/packages/core/api/schemas.ts@@ -870,6 +870,7 @@ export const SidebarProjectPrefsDocSchema = z.object({statuses: z.array(z.string()).optional().catch(undefined),onlyMine: z.boolean().optional().catch(undefined),showCount: z.boolean().optional().catch(undefined),+ showNoProject: z.boolean().optional().catch(undefined),}).catch({}),issues: z.object({sortBy: z.enum(["updated_at", "created_at", "priority", "status", "title", "due_date"]).optional().catch(undefined),diff --git a/packages/core/inbox/group.ts b/packages/core/inbox/group.tsindex d41efa0b0c..a4a8a36f22 100644--- a/packages/core/inbox/group.ts+++ b/packages/core/inbox/group.ts@@ -20,10 +20,12 @@ export function groupInboxRows(items: readonly InboxItem[]): InboxItem[][] {/*** The row a group renders as. It keeps the group's newest comment anchor when- * it has none of its own, so opening it still scrolls to the comment.+ * it has none of its own, so opening it still scrolls to the comment. An app+ * notification lands on its own request instead, so it never borrows one.*/export function withCommentAnchor(row: InboxItem, group: readonly InboxItem[]): InboxItem {if (row.details?.comment_id) return row;+ if (row.type.startsWith("app_") && row.details?.request_id) return row;const commentId = group.find((item) => item.details?.comment_id)?.details?.comment_id;if (!commentId) return row;return { ...row, details: { ...(row.details ?? {}), comment_id: commentId } };diff --git a/packages/core/inbox/queries.test.ts b/packages/core/inbox/queries.test.tsindex 146a6b5d89..3ec61d7a78 100644--- a/packages/core/inbox/queries.test.ts+++ b/packages/core/inbox/queries.test.ts@@ -63,6 +63,22 @@ describe("deduplicateInboxItems", () => {});});+ it("leaves an app request row on its own request, not an older comment", () => {+ const merged = deduplicateInboxItems([+ item({ id: "comment-notification", created_at: "2026-06-15T08:00:00Z", details: { comment_id: "comment-1" } }),+ item({+ id: "app-notification",+ type: "app_action_requested",+ created_at: "2026-06-15T08:01:00Z",+ details: { request_id: "request-1" },+ }),+ ]);++ expect(merged).toHaveLength(1);+ expect(merged[0]?.id).toBe("app-notification");+ expect(merged[0]?.details).toEqual({ request_id: "request-1" });+ });+it("preserves the newest row's own comment anchor", () => {const merged = deduplicateInboxItems([item({diff --git a/packages/core/inbox/selection-store.ts b/packages/core/inbox/selection-store.tsindex 3a26f3227b..590193ba25 100644--- a/packages/core/inbox/selection-store.ts+++ b/packages/core/inbox/selection-store.ts@@ -5,6 +5,17 @@ import { create } from "zustand";interface InboxSelectionState {lastResolvedKeyByWorkspace: Record<string, string>;rememberResolvedKey: (wsId: string, key: string) => void;+ /** The issue last opened from the Work panel's Inbox section. */+ sidebarIssueByWorkspace: Record<string, string | null>;+ rememberSidebarIssue: (wsId: string, issueId: string | null) => void;+ /**+ * The issue a notification row was last clicked for, with a counter that+ * moves on every click. The issue page replays its landing (the comment or+ * app request the link names) when the counter moves, which a click on the+ * row already open needs: the page neither remounts nor sees a new link.+ */+ landing: { issueId: string; token: number } | null;+ requestLanding: (issueId: string) => void;}// Keep only the last resolved pointer per workspace, for this client run.@@ -15,4 +26,12 @@ export const useInboxSelectionStore = create<InboxSelectionState>()((set) => ({set((state) => state.lastResolvedKeyByWorkspace[wsId] === key ? state : {lastResolvedKeyByWorkspace: { ...state.lastResolvedKeyByWorkspace, [wsId]: key },}),+ sidebarIssueByWorkspace: {},+ rememberSidebarIssue: (wsId, issueId) =>+ set((state) => (state.sidebarIssueByWorkspace[wsId] ?? null) === issueId ? state : {+ sidebarIssueByWorkspace: { ...state.sidebarIssueByWorkspace, [wsId]: issueId },+ }),+ landing: null,+ requestLanding: (issueId) =>+ set((state) => ({ landing: { issueId, token: (state.landing?.token ?? 0) + 1 } })),}));diff --git a/packages/core/issue-views/builtin-issue-views.ts b/packages/core/issue-views/builtin-issue-views.tsnew file mode 100644index 0000000000..a05a2c78e6--- /dev/null+++ b/packages/core/issue-views/builtin-issue-views.ts@@ -0,0 +1,66 @@+import type { IssueView } from "../api/schemas";+import { baselineFromQuery, type IssueViewBaseline } from "./baseline";++/**+ * The built-in views that are All issues under a fixed filter. They are not+ * stored on the server: the workspace issues page opens them through the same+ * `?view=` id as a saved view, and these definitions stand in for the saved+ * ones.+ */+export type FilteredBuiltinViewKey = "my_work" | "working" | "subscribed";++const QUERIES: Record<FilteredBuiltinViewKey, Record<string, unknown>> = {+ // Assigned to the viewer or to an agent they own.+ my_work: { relationFilters: ["assigned", "my_agents"] },+ // An agent is running on it.+ working: { agentRunningFilter: true },+ subscribed: { relationFilters: ["subscribed"] },+};++function builtinView(key: FilteredBuiltinViewKey): IssueView {+ return {+ id: key,+ workspace_id: "",+ owner_id: "",+ name: "",+ scope_type: "workspace",+ scope_id: null,+ scope_variant: null,+ visibility: "private",+ definition_version: 1,+ query: QUERIES[key],+ display: {},+ revision: 1,+ created_at: "",+ updated_at: "",+ };+}++export const FILTERED_BUILTIN_VIEWS: Record<FilteredBuiltinViewKey, IssueView> = {+ my_work: builtinView("my_work"),+ working: builtinView("working"),+ subscribed: builtinView("subscribed"),+};++/**+ * Saved views can be edited, so their filters stay removable. These have no+ * editor: their condition is fixed, and clearing filters returns to it.+ */+const BASELINES: Record<FilteredBuiltinViewKey, IssueViewBaseline> = {+ my_work: baselineFromQuery(QUERIES.my_work),+ working: baselineFromQuery(QUERIES.working),+ subscribed: baselineFromQuery(QUERIES.subscribed),+};++export function isFilteredBuiltinViewKey(id: string | null | undefined): id is FilteredBuiltinViewKey {+ return id === "my_work" || id === "working" || id === "subscribed";+}++/** The built-in a workspace view id names, or `null` for a saved view. */+export function filteredBuiltinView(id: string | null | undefined): IssueView | null {+ return isFilteredBuiltinViewKey(id) ? FILTERED_BUILTIN_VIEWS[id] : null;+}++export function filteredBuiltinBaseline(view: Pick<IssueView, "id"> | null | undefined): IssueViewBaseline | null {+ return isFilteredBuiltinViewKey(view?.id) ? BASELINES[view.id] : null;+}diff --git a/packages/core/issue-views/sidebar-views.hook.test.tsx b/packages/core/issue-views/sidebar-views.hook.test.tsxindex b682c3ad26..2d80d44500 100644--- a/packages/core/issue-views/sidebar-views.hook.test.tsx+++ b/packages/core/issue-views/sidebar-views.hook.test.tsx@@ -48,7 +48,7 @@ describe("useSidebarViews writes", () => {});it("keeps starred views that have not loaded when unstarring a built-in", async () => {- const { result } = setup(preference(["builtin:my_issues", "view:a", "builtin:all_issues", "view:b"]));+ const { result } = setup(preference(["builtin:my_work", "view:a", "builtin:all_issues", "view:b"]));await waitFor(() => expect(result.current.isStarred("view:a")).toBe(true));expect(result.current.viewsPending).toBe(true);@@ -56,7 +56,7 @@ describe("useSidebarViews writes", () => {await waitFor(() => expect(putIssueViewPreference).toHaveBeenCalledTimes(1));expect(putIssueViewPreference.mock.calls[0]![0].prefs.order).toEqual([- "builtin:my_issues",+ "builtin:my_work","view:a","view:b",]);diff --git a/packages/core/issue-views/sidebar-views.test.ts b/packages/core/issue-views/sidebar-views.test.tsindex 25cd60ef40..bf7baf6cdd 100644--- a/packages/core/issue-views/sidebar-views.test.ts+++ b/packages/core/issue-views/sidebar-views.test.ts@@ -1,6 +1,11 @@import { describe, expect, it } from "vitest";import type { IssueView } from "../api/schemas";-import { defaultSidebarViewOrder, reorderSidebarViewOrder, resolveSidebarViewItems } from "./sidebar-views";+import {+ defaultSidebarViewOrder,+ migrateSidebarViewOrder,+ reorderSidebarViewOrder,+ resolveSidebarViewItems,+} from "./sidebar-views";const view = (id: string, owner_id: string): IssueView => ({id,@@ -20,12 +25,13 @@ const view = (id: string, owner_id: string): IssueView => ({});describe("defaultSidebarViewOrder", () => {- it("lists built-ins except Unread, own views, then previously pinned views once", () => {+ it("lists every built-in, own views, then previously pinned views once", () => {const views = [view("a", "me"), view("b", "other"), view("c", "other")];expect(defaultSidebarViewOrder(views, "me", ["c", "a"])).toEqual([- "builtin:my_issues",- "builtin:my_agents","builtin:all_issues",+ "builtin:my_work",+ "builtin:working",+ "builtin:subscribed","view:a","view:c",]);@@ -42,10 +48,37 @@ describe("resolveSidebarViewItems", () => {expect(items[1]).toMatchObject({ kind: "builtin", key: "all_issues" });});- it("resolves a starred Unread like any other built-in", () => {- const items = resolveSidebarViewItems(["builtin:all_issues", "view:a", "builtin:unread"], [view("a", "me")]);- expect(items.map((item) => item.id)).toEqual(["builtin:all_issues", "view:a", "builtin:unread"]);- expect(items[2]).toMatchObject({ kind: "builtin", key: "unread" });+ it("drops built-ins that no longer exist", () => {+ const items = resolveSidebarViewItems(["builtin:unread", "builtin:subscribed"], []);+ expect(items).toEqual([{ id: "builtin:subscribed", kind: "builtin", key: "subscribed" }]);+ });+});++describe("migrateSidebarViewOrder", () => {+ it("turns My issues and My agents into My work, followed by the new built-ins, and drops Unread", () => {+ expect(+ migrateSidebarViewOrder([+ "view:a",+ "builtin:my_issues",+ "builtin:all_issues",+ "builtin:my_agents",+ "builtin:unread",+ "view:b",+ ]),+ ).toEqual([+ "view:a",+ "builtin:my_work",+ "builtin:working",+ "builtin:subscribed",+ "builtin:all_issues",+ "view:b",+ ]);+ });++ it("keeps a removed My issues removed, and leaves today's orders alone", () => {+ expect(migrateSidebarViewOrder(["builtin:all_issues", "builtin:unread"])).toEqual(["builtin:all_issues"]);+ const current = ["builtin:subscribed", "view:a"];+ expect(migrateSidebarViewOrder(current)).toEqual(current);});});@@ -53,10 +86,10 @@ describe("reorderSidebarViewOrder", () => {it("moves visible ids and keeps unresolved ones in their slots", () => {expect(reorderSidebarViewOrder(- ["builtin:my_issues", "view:loading", "view:a", "builtin:all_issues"],- ["builtin:all_issues", "builtin:my_issues", "view:a"],+ ["builtin:my_work", "view:loading", "view:a", "builtin:all_issues"],+ ["builtin:all_issues", "builtin:my_work", "view:a"],),- ).toEqual(["builtin:all_issues", "view:loading", "builtin:my_issues", "view:a"]);+ ).toEqual(["builtin:all_issues", "view:loading", "builtin:my_work", "view:a"]);});it("appends visible ids the stored order did not have", () => {diff --git a/packages/core/issue-views/sidebar-views.ts b/packages/core/issue-views/sidebar-views.tsindex a4185fc52e..de5133a038 100644--- a/packages/core/issue-views/sidebar-views.ts+++ b/packages/core/issue-views/sidebar-views.ts@@ -9,18 +9,37 @@ import { issueViewEverywhereOptions } from "./queries";import { issueViewPreferenceOptions, useUpdateIssueViewPreference } from "./preferences";/** The views every workspace has without saving anything. */-export type BuiltinViewKey = "my_issues" | "my_agents" | "all_issues" | "unread";-export const BUILTIN_VIEW_KEYS: readonly BuiltinViewKey[] = ["my_issues", "my_agents", "all_issues", "unread"];--/**- * The built-ins starred before the user arranges the list. Unread is opt-in- * while it overlaps with Inbox.- */-const DEFAULT_STARRED_BUILTINS: readonly BuiltinViewKey[] = ["my_issues", "my_agents", "all_issues"];+export type BuiltinViewKey = "all_issues" | "my_work" | "working" | "subscribed";+export const BUILTIN_VIEW_KEYS: readonly BuiltinViewKey[] = ["all_issues", "my_work", "working", "subscribed"];export const builtinViewItemId = (key: BuiltinViewKey) => `builtin:${key}`;export const savedViewItemId = (viewId: string) => `view:${viewId}`;+/** Built-ins an order saved before My work replaced My issues and My agents can hold. */+const LEGACY_MY_WORK_IDS = new Set(["builtin:my_issues", "builtin:my_agents"]);+const LEGACY_UNREAD_ID = "builtin:unread";++/**+ * A saved order in today's built-ins: My issues and My agents become My work,+ * followed by Working and Subscribed, which did not exist then; Unread goes.+ */+export function migrateSidebarViewOrder(order: readonly string[]): string[] {+ if (!order.some((id) => LEGACY_MY_WORK_IDS.has(id) || id === LEGACY_UNREAD_ID)) return [...order];+ const added = [builtinViewItemId("working"), builtinViewItemId("subscribed")].filter((id) => !order.includes(id));+ const next: string[] = [];+ for (const id of order) {+ if (id === LEGACY_UNREAD_ID) continue;+ if (!LEGACY_MY_WORK_IDS.has(id)) {+ next.push(id);+ continue;+ }+ const myWork = builtinViewItemId("my_work");+ if (next.includes(myWork)) continue;+ next.push(myWork, ...added);+ }+ return [...new Set(next)];+}+export const SIDEBAR_VIEWS_SCOPE = { scope_type: "sidebar" } as const;export type SidebarViewItem =@@ -40,7 +59,7 @@ export function defaultSidebarViewOrder(userId: string | undefined,pinnedViewIds: readonly string[],): string[] {- const ids = DEFAULT_STARRED_BUILTINS.map(builtinViewItemId);+ const ids = BUILTIN_VIEW_KEYS.map(builtinViewItemId);for (const view of views) {if (view.owner_id === userId) ids.push(savedViewItemId(view.id));}@@ -102,7 +121,8 @@ export function useSidebarViews(wsId: string, userId: string | undefined) {const save = useUpdateIssueViewPreference(wsId, SIDEBAR_VIEWS_SCOPE);const preference = preferenceQuery.data;- const savedOrder = preference && preference.updated_at !== "" ? preference.prefs.order : null;+ const storedOrder = preference && preference.updated_at !== "" ? preference.prefs.order : null;+ const savedOrder = useMemo(() => (storedOrder ? migrateSidebarViewOrder(storedOrder) : null), [storedOrder]);const order = useMemo(() =>savedOrder ??diff --git a/packages/core/issue-views/unread-view.ts b/packages/core/issue-views/unread-view.tsdeleted file mode 100644index 255cbb38b4..0000000000--- a/packages/core/issue-views/unread-view.ts+++ /dev/null@@ -1,37 +0,0 @@-import type { IssueView } from "../api/schemas";-import { baselineFromQuery, type IssueViewBaseline } from "./baseline";--/**- * The built-in "Unread" view: All issues filtered on the viewer's unread- * marks. It is not stored on the server. The workspace issues page opens it- * through the same `?view=` id as a saved view, and this definition stands- * in for the saved one.- */-export const UNREAD_VIEW_ID = "unread";--export const UNREAD_VIEW: IssueView = {- id: UNREAD_VIEW_ID,- workspace_id: "",- owner_id: "",- name: "",- scope_type: "workspace",- scope_id: null,- scope_variant: null,- visibility: "private",- definition_version: 1,- query: { unreadFilter: true },- display: {},- revision: 1,- created_at: "",- updated_at: "",-};--/**- * Saved views can be edited, so their filters stay removable. This one has no- * editor: the unread condition is fixed, and clearing filters returns to it.- */-export const UNREAD_VIEW_BASELINE: IssueViewBaseline = baselineFromQuery(UNREAD_VIEW.query);--export function isUnreadView(view: Pick<IssueView, "id"> | null | undefined): boolean {- return view?.id === UNREAD_VIEW_ID;-}diff --git a/packages/core/issue-views/use-active-view.test.tsx b/packages/core/issue-views/use-active-view.test.tsxindex 82a26e02e8..7fcfc3a459 100644--- a/packages/core/issue-views/use-active-view.test.tsx+++ b/packages/core/issue-views/use-active-view.test.tsx@@ -9,14 +9,13 @@ import { setApiInstance } from "../api";import type { ApiClient } from "../api/client";import { createQueryClient } from "../query-client";import { issueViewContainerKey, useActiveIssueViewStore } from "./active-view-store";-import { UNREAD_VIEW_ID } from "./unread-view";import { useActiveIssueView } from "./use-active-view";import type { IssueViewScope } from "./queries";const WORKSPACE: IssueViewScope = { scope_type: "workspace" };const PROJECT: IssueViewScope = { scope_type: "project", scope_id: "p1" };-describe("useActiveIssueView and the built-in Unread view", () => {+describe("useActiveIssueView and the built-in filtered views", () => {let qc: QueryClient;function render(scope: IssueViewScope) {@@ -38,16 +37,26 @@ describe("useActiveIssueView and the built-in Unread view", () => {vi.restoreAllMocks();});- it("opens on the workspace page without a saved view behind it", async () => {- act(() => useActiveIssueViewStore.getState().setActive(issueViewContainerKey("ws-1", WORKSPACE), UNREAD_VIEW_ID));+ it.each([+ ["my_work", { relationFilters: ["assigned", "my_agents"] }],+ ["working", { agentRunningFilter: true }],+ ["subscribed", { relationFilters: ["subscribed"] }],+ ])("opens %s on the workspace page without a saved view behind it", async (id, query) => {+ act(() => useActiveIssueViewStore.getState().setActive(issueViewContainerKey("ws-1", WORKSPACE), id));const { result } = render(WORKSPACE);await waitFor(() => expect(result.current.viewsReady).toBe(true));- expect(result.current.activeView).toMatchObject({ id: UNREAD_VIEW_ID, query: { unreadFilter: true } });+ expect(result.current.activeView).toMatchObject({ id, query });expect(result.current.missing).toBe(false);});+ it("no longer opens the retired Unread view", async () => {+ act(() => useActiveIssueViewStore.getState().setActive(issueViewContainerKey("ws-1", WORKSPACE), "unread"));+ const { result } = render(WORKSPACE);+ await waitFor(() => expect(result.current.missing).toBe(true));+ });+it("is not a view on other surfaces, so the id there reads as missing", async () => {- act(() => useActiveIssueViewStore.getState().setActive(issueViewContainerKey("ws-1", PROJECT), UNREAD_VIEW_ID));+ act(() => useActiveIssueViewStore.getState().setActive(issueViewContainerKey("ws-1", PROJECT), "subscribed"));const { result } = render(PROJECT);await waitFor(() => expect(result.current.missing).toBe(true));expect(result.current.activeView).toBeNull();diff --git a/packages/core/issue-views/use-active-view.ts b/packages/core/issue-views/use-active-view.tsindex 0516365554..2686282bf5 100644--- a/packages/core/issue-views/use-active-view.ts+++ b/packages/core/issue-views/use-active-view.ts@@ -8,7 +8,7 @@ import {issueViewContainerKey,useActiveIssueViewStore,} from "./active-view-store";-import { UNREAD_VIEW, UNREAD_VIEW_ID } from "./unread-view";+import { filteredBuiltinView } from "./builtin-issue-views";const EMPTY_VIEWS: IssueView[] = [];@@ -33,8 +33,7 @@ export function useActiveIssueView(enabled: !!scope && !!wsId,});const views = listQuery.data ?? EMPTY_VIEWS;- const builtinView =- scope?.scope_type === "workspace" && activeViewId === UNREAD_VIEW_ID ? UNREAD_VIEW : null;+ const builtinView = scope?.scope_type === "workspace" ? filteredBuiltinView(activeViewId) : null;const activeView =builtinView ?? (activeViewId ? (views.find((v) => v.id === activeViewId) ?? null) : null);// "Missing" must never fire off a STALE list: right after a create thediff --git a/packages/core/issues/cache-coordinator.ts b/packages/core/issues/cache-coordinator.tsindex 8d081beeff..9d63bf858e 100644--- a/packages/core/issues/cache-coordinator.ts+++ b/packages/core/issues/cache-coordinator.ts@@ -22,6 +22,7 @@ import {patchNeedsInvalidation,removeIssueFromBuckets,} from "./cache-helpers";+import { NO_PROJECT_SIDEBAR_SOURCE } from "./sidebar-list";import {issueMatchesListFilter,listFilterDependsOn,@@ -654,7 +655,10 @@ export function invalidateSidebarListsForIssue(issueId: string,projectIds: readonly (string | null | undefined)[],) {- const projectSources = new Set(projectIds.filter(Boolean).map((id) => `project:${id}`));+ // `null` is no project; `undefined` says nothing about it.+ const projectSources = new Set(+ projectIds.flatMap((id) => (id ? [`project:${id}`] : id === null ? [NO_PROJECT_SIDEBAR_SOURCE] : [])),+ );const prefix = issueKeys.sidebarAll(wsId);qc.invalidateQueries({queryKey: prefix,diff --git a/packages/core/issues/sidebar-list.test.ts b/packages/core/issues/sidebar-list.test.tsindex b39e9bc2c7..5fbb94d1ae 100644--- a/packages/core/issues/sidebar-list.test.ts+++ b/packages/core/issues/sidebar-list.test.ts@@ -1,10 +1,14 @@import { describe, expect, it } from "vitest";import type { Project } from "../types";import {+ noProjectCountRequest,+ noProjectSidebarRequest,projectSidebarRequest,shownSidebarStatuses,builtinSidebarRequest,sidebarProjects,+ noProjectRowIndex,+ NO_PROJECT_ORDER_ID,viewSidebarRequest,} from "./sidebar-list";import {@@ -58,6 +62,36 @@ describe("projectSidebarRequest", () => {});});+describe("No project", () => {+ it("lists issues outside every project with the project rows' settings", () => {+ const settings: SidebarIssueSettings = { ...DEFAULT_SIDEBAR_ISSUE_SETTINGS, assignee: "me" };+ expect(noProjectSidebarRequest(settings, STATUSES, "u1")).toEqual({+ table: {+ scope: { kind: "workspace" },+ filters: {+ include_no_project: true,+ statuses: ["backlog", "todo", "in_progress", "merged"],+ relations: ["assigned"],+ include_sub_issues: true,+ },+ sort: { field: "updated_at", direction: "desc" },+ },+ });+ });++ it("counts open issues, sub-issues included, as a project's count does", () => {+ expect(noProjectCountRequest(STATUSES)).toEqual({+ query: {+ scope: { kind: "workspace" },+ filters: { statuses: ["backlog", "todo", "in_progress", "merged"], include_sub_issues: true },+ sort: { field: "position", direction: "asc" },+ },+ facets: [{ kind: "project" }],+ include_total: false,+ });+ });+});+describe("viewSidebarRequest", () => {const TODAY = "2026-03-11";const workspace = { display: {}, scope_type: "workspace" as const, scope_variant: null };@@ -146,28 +180,31 @@ describe("viewSidebarRequest", () => {});describe("builtinSidebarRequest", () => {- it("scopes each built-in like its page and lists with the sidebar settings", () => {- const request = (builtin: Parameters<typeof builtinSidebarRequest>[0], relation: Parameters<typeof builtinSidebarRequest>[1] = "assigned") =>- builtinSidebarRequest(builtin, relation, DEFAULT_SIDEBAR_ISSUE_SETTINGS, STATUSES)?.table;- expect(request("all_issues")).toEqual({+ it("filters All issues like each built-in's page and lists with the sidebar settings", () => {+ const filters = (builtin: Parameters<typeof builtinSidebarRequest>[0], working?: string[]) =>+ builtinSidebarRequest(builtin, { ...DEFAULT_SIDEBAR_ISSUE_SETTINGS, hiddenStatuses: [] }, STATUSES, working)+ ?.table.filters;+ expect(builtinSidebarRequest("all_issues", DEFAULT_SIDEBAR_ISSUE_SETTINGS, STATUSES)?.table).toEqual({scope: { kind: "workspace" },filters: { statuses: ["backlog", "todo", "in_progress", "merged"], include_sub_issues: true },sort: { field: "updated_at", direction: "desc" },});- expect(request("my_issues", "created")?.scope).toEqual({ kind: "my", relation: "created" });- expect(request("my_issues", "all")?.scope).toEqual({ kind: "my", relation: "any" });- expect(request("my_agents", "assigned")?.scope).toEqual({ kind: "my", relation: "involved" });+ expect(filters("my_work")).toEqual({ relations: ["assigned", "my_agents"], include_sub_issues: true });+ expect(filters("subscribed")).toEqual({ relations: ["subscribed"], include_sub_issues: true });+ expect(filters("working", ["i2", "i1"])).toEqual({ working_issue_ids: ["i1", "i2"], include_sub_issues: true });+ expect(filters("working")).toEqual({ working_issue_ids: [], include_sub_issues: true });});it("ignores the project-only assignee setting and lists nothing when every status is hidden", () => {for (const assignee of ["me", "my_agents", "me_and_my_agents"] as const) {const settings = { ...DEFAULT_SIDEBAR_ISSUE_SETTINGS, hiddenStatuses: [], assignee };- expect(builtinSidebarRequest("my_agents", "assigned", settings, STATUSES)?.table.filters).toEqual({+ expect(builtinSidebarRequest("subscribed", settings, STATUSES)?.table.filters).toEqual({+ relations: ["subscribed"],include_sub_issues: true,});}const none = { ...DEFAULT_SIDEBAR_ISSUE_SETTINGS, hiddenStatuses: STATUSES.map((s) => s.key) };- expect(builtinSidebarRequest("all_issues", "assigned", none, STATUSES)).toBeNull();+ expect(builtinSidebarRequest("all_issues", none, STATUSES)).toBeNull();});});@@ -223,3 +260,23 @@ describe("sidebarProjects", () => {expect(sidebarProjects(withActivity, settings, [], "u1").map((p) => p.id)).toEqual(["p2", "p4", "p1"]);});});++describe("noProjectRowIndex", () => {+ const shown = [{ id: "p1" }, { id: "p2" }, { id: "p3" }];+ const manual = DEFAULT_SIDEBAR_PROJECT_SETTINGS;++ it("puts No project first until it is dragged", () => {+ expect(noProjectRowIndex(shown, manual, [])).toBe(0);+ expect(noProjectRowIndex(shown, manual, ["p2", "p1"])).toBe(0);+ });++ it("follows its place in the manual order, counting only the shown projects before it", () => {+ expect(noProjectRowIndex(shown, manual, ["p1", "p2", NO_PROJECT_ORDER_ID, "p3"])).toBe(2);+ expect(noProjectRowIndex(shown, manual, ["p1", "hidden", NO_PROJECT_ORDER_ID, "p2"])).toBe(1);+ expect(noProjectRowIndex(shown, manual, ["p1", "p2", "p3", NO_PROJECT_ORDER_ID])).toBe(3);+ });++ it("stays first when the projects sort by name or date", () => {+ expect(noProjectRowIndex(shown, { ordering: "name" }, ["p1", "p2", NO_PROJECT_ORDER_ID])).toBe(0);+ });+});diff --git a/packages/core/issues/sidebar-list.ts b/packages/core/issues/sidebar-list.tsindex 95f877d8f9..391168673e 100644--- a/packages/core/issues/sidebar-list.ts+++ b/packages/core/issues/sidebar-list.ts@@ -3,6 +3,7 @@ import { baselineFromQuery } from "../issue-views/baseline";import type { BuiltinViewKey } from "../issue-views/sidebar-views";import type {IssueStatusCategory,+ IssueTableFacetsRequest,IssueTableQuerySpec,IssueTableRelation,IssueTableScope,@@ -13,7 +14,6 @@ import { projectLastActivityAt } from "../projects/activity";import { assigneeTypesForActorKind } from "./surface/scope";import { effectiveNegatedFilters } from "./stores/view-store";import { FILTER_DIMENSION_TABLE_FIELD, advancedFilterToTableQuery, advancedFilterUsesField } from "./stores/filter-tree";-import type { MyIssuesRelation } from "./stores/my-issues-view-store";import type { SidebarIssueAssignee, SidebarIssueSettings, SidebarProjectSettings } from "./stores/sidebar-tree-store";/** Rows an expanded sidebar list shows before "Load more". */@@ -51,9 +51,9 @@ const ASSIGNEE_RELATIONS: Record<SidebarIssueAssignee, IssueTableRelation[]> = {me_and_my_agents: ["assigned", "my_agents"],};-/** The request for an expanded project, or `null` when the settings leave nothing to list. */-export function projectSidebarRequest(- projectId: string,+function projectRowRequest(+ scope: IssueTableScope,+ filters: IssueTableQuerySpec["filters"],settings: SidebarIssueSettings,statuses: readonly StatusRef[],userId: string | undefined,@@ -64,8 +64,9 @@ export function projectSidebarRequest(const relations = ASSIGNEE_RELATIONS[settings.assignee] ?? [];return {table: {- scope: { kind: "project", project_id: projectId },+ scope,filters: {+ ...filters,...(shown.length < statuses.length ? { statuses: shown } : {}),...(relations.length > 0 ? { relations } : {}),include_sub_issues: settings.showSubIssues,@@ -75,6 +76,51 @@ export function projectSidebarRequest(};}+/** The request for an expanded project, or `null` when the settings leave nothing to list. */+export function projectSidebarRequest(+ projectId: string,+ settings: SidebarIssueSettings,+ statuses: readonly StatusRef[],+ userId: string | undefined,+): SidebarIssuesRequest | null {+ return projectRowRequest({ kind: "project", project_id: projectId }, {}, settings, statuses, userId);+}++/** The Projects section's row for issues outside every project. */+export const NO_PROJECT_SIDEBAR_SOURCE = "project:none";++/** The request for the expanded "No project" row, listed like an expanded project. */+export function noProjectSidebarRequest(+ settings: SidebarIssueSettings,+ statuses: readonly StatusRef[],+ userId: string | undefined,+): SidebarIssuesRequest | null {+ return projectRowRequest({ kind: "workspace" }, { include_no_project: true }, settings, statuses, userId);+}++/** The facet key the table query gives issues outside every project. */+export const NO_PROJECT_FACET_KEY = "__none__";++/**+ * Counts open issues per project, the "No project" row's under+ * `NO_PROJECT_FACET_KEY`. Open is what a project's count means: any status+ * outside the done and closed categories, sub-issues included.+ */+export function noProjectCountRequest(statuses: readonly StatusRef[]): IssueTableFacetsRequest {+ return {+ query: {+ scope: { kind: "workspace" },+ filters: {+ statuses: statuses.filter((s) => !FINISHED.has(s.category)).map((s) => s.key),+ include_sub_issues: true,+ },+ sort: { field: "position", direction: "asc" },+ },+ facets: [{ kind: "project" }],+ include_total: false,+ };+}+const VIEW_SORTS = new Set<string>(["position","status",@@ -184,25 +230,35 @@ export function viewSidebarRequest(};}+/** What each built-in adds to All issues, as the issues page applies it. */+const BUILTIN_FILTERS: Record<Exclude<BuiltinViewKey, "working">, IssueTableQuerySpec["filters"]> = {+ all_issues: {},+ my_work: { relations: ASSIGNEE_RELATIONS.me_and_my_agents },+ subscribed: { relations: ["subscribed"] },+};+/**- * The request for an expanded built-in view: the page's scope, listed with- * the same status, sub-issue and ordering settings as an expanded project.- * The assignee setting is for projects only: the scope already says whose- * issues a built-in lists. `null` when the settings leave nothing to list.+ * The request for an expanded built-in view: its filter, listed with the same+ * status, sub-issue and ordering settings as an expanded project. The+ * assignee setting is for projects only: a built-in already says whose+ * issues it lists. Working lists `workingIssueIds`, the issues agents are+ * running on, as the page does. `null` when the settings leave nothing to list.*/export function builtinSidebarRequest(- builtin: Exclude<BuiltinViewKey, "unread">,- myRelation: MyIssuesRelation,+ builtin: BuiltinViewKey,settings: SidebarIssueSettings,statuses: readonly StatusRef[],+ workingIssueIds: readonly string[] = [],): SidebarIssuesRequest | null {const shown = shownSidebarStatuses(settings, statuses);if (shown.length === 0) return null;- const relation = builtin === "my_agents" ? "involved" : myRelation === "all" ? "any" : myRelation;return {table: {- scope: builtin === "all_issues" ? { kind: "workspace" } : { kind: "my", relation },+ scope: { kind: "workspace" },filters: {+ ...(builtin === "working"+ ? { working_issue_ids: [...workingIssueIds].sort() }+ : BUILTIN_FILTERS[builtin]),...(shown.length < statuses.length ? { statuses: shown } : {}),include_sub_issues: settings.showSubIssues,},@@ -243,3 +299,22 @@ export function sidebarProjects<}}}++/** The "No project" row's id in the manual project order, beside the project ids. */+export const NO_PROJECT_ORDER_ID = "no_project";++/**+ * Where the "No project" row sits among the shown projects: first, until it+ * is dragged elsewhere. A sort by name or date leaves it first, since it is+ * not a project.+ */+export function noProjectRowIndex(+ shown: readonly Pick<Project, "id">[],+ settings: Pick<SidebarProjectSettings, "ordering">,+ manualOrder: readonly string[],+): number {+ const at = settings.ordering === "manual" ? manualOrder.indexOf(NO_PROJECT_ORDER_ID) : -1;+ if (at === -1) return 0;+ const before = new Set(manualOrder.slice(0, at));+ return shown.filter((project) => before.has(project.id)).length;+}diff --git a/packages/core/issues/sidebar-project-prefs.ts b/packages/core/issues/sidebar-project-prefs.tsindex 56705e4172..8ec4948a15 100644--- a/packages/core/issues/sidebar-project-prefs.ts+++ b/packages/core/issues/sidebar-project-prefs.ts@@ -27,7 +27,7 @@ export interface SidebarProjectPrefs {projectSettings: SidebarProjectSettings;/** How expanded rows, projects and built-in views alike, list their issues. */issueSettings: SidebarIssueSettings;- /** Manual project order; projects missing from it follow in list order. */+ /** Manual order of the projects and the "No project" row; projects missing from it follow in list order. */projectOrder: string[];}diff --git a/packages/core/issues/stores/sidebar-tree-store.ts b/packages/core/issues/stores/sidebar-tree-store.tsindex 7be0f6f564..fa6aa552a1 100644--- a/packages/core/issues/stores/sidebar-tree-store.ts+++ b/packages/core/issues/stores/sidebar-tree-store.ts@@ -35,6 +35,8 @@ export interface SidebarProjectSettings {statuses: ProjectStatus[];onlyMine: boolean;showCount: boolean;+ /** The row after the projects that lists issues outside every project. */+ showNoProject: boolean;}export const DEFAULT_SIDEBAR_PROJECT_SETTINGS: SidebarProjectSettings = {@@ -42,8 +44,29 @@ export const DEFAULT_SIDEBAR_PROJECT_SETTINGS: SidebarProjectSettings = {statuses: ["planned", "in_progress", "paused"],onlyMine: false,showCount: true,+ showNoProject: true,};+/** How many rows a capped sidebar section shows before "Show more". */+export type SidebarSectionLimit = 5 | 10 | 20;++/** The Work panel's Inbox section. Which notifications exist is the account's notification preferences. */+export interface SidebarInboxSettings {+ limit: SidebarSectionLimit;+ /** The unread count beside the section label. */+ showCount: boolean;+ /** The unread count on the Work rail item. */+ railBadge: boolean;+ /** One line per notification, without the actor and what happened. */+ compact: boolean;+}++export const DEFAULT_SIDEBAR_INBOX_SETTINGS: SidebarInboxSettings = {+ limit: 5,+ showCount: true,+ railBadge: true,+ compact: false,+};export interface SidebarLocateRequest {issueId: string;@@ -66,6 +89,11 @@ interface SidebarTreeState {issueSettings: SidebarIssueSettings;projectSettings: SidebarProjectSettings;projectOrder: string[];+ inboxSettings: SidebarInboxSettings;+ pinnedLimit: SidebarSectionLimit;+ /** Counts on the Views section's rows (Unread, All views). */+ viewsShowCount: boolean;+ inboxCollapsed: boolean;projectsCollapsed: boolean;viewsCollapsed: boolean;pinnedCollapsed: boolean;@@ -78,6 +106,10 @@ interface SidebarTreeState {locate: SidebarLocateRequest | null;setExpanded: (key: string, expanded: boolean) => void;requestLocate: (request: SidebarLocateRequest | null) => void;+ setInboxSettings: (patch: Partial<SidebarInboxSettings>) => void;+ setPinnedLimit: (limit: SidebarSectionLimit) => void;+ setViewsShowCount: (show: boolean) => void;+ setInboxCollapsed: (collapsed: boolean) => void;setProjectsCollapsed: (collapsed: boolean) => void;setViewsCollapsed: (collapsed: boolean) => void;setPinnedCollapsed: (collapsed: boolean) => void;@@ -91,6 +123,10 @@ type PersistedSidebarTree = Pick<| "issueSettings"| "projectSettings"| "projectOrder"+ | "inboxSettings"+ | "pinnedLimit"+ | "viewsShowCount"+ | "inboxCollapsed"| "projectsCollapsed"| "viewsCollapsed"| "pinnedCollapsed"@@ -103,6 +139,10 @@ const INITIAL: PersistedSidebarTree = {issueSettings: DEFAULT_SIDEBAR_ISSUE_SETTINGS,projectSettings: DEFAULT_SIDEBAR_PROJECT_SETTINGS,projectOrder: [],+ inboxSettings: DEFAULT_SIDEBAR_INBOX_SETTINGS,+ pinnedLimit: 5,+ viewsShowCount: true,+ inboxCollapsed: false,projectsCollapsed: false,viewsCollapsed: false,pinnedCollapsed: false,@@ -121,6 +161,10 @@ export const useSidebarTreeStore = create<SidebarTreeState>()(if (s.expanded.includes(key) === expanded) return s;return { expanded: expanded ? [...s.expanded, key] : s.expanded.filter((k) => k !== key) };}),+ setInboxSettings: (patch) => set((s) => ({ inboxSettings: { ...s.inboxSettings, ...patch } })),+ setPinnedLimit: (pinnedLimit) => set({ pinnedLimit }),+ setViewsShowCount: (viewsShowCount) => set({ viewsShowCount }),+ setInboxCollapsed: (collapsed) => set({ inboxCollapsed: collapsed }),setProjectsCollapsed: (collapsed) => set({ projectsCollapsed: collapsed }),setViewsCollapsed: (collapsed) => set({ viewsCollapsed: collapsed }),setPinnedCollapsed: (collapsed) => set({ pinnedCollapsed: collapsed }),@@ -135,6 +179,10 @@ export const useSidebarTreeStore = create<SidebarTreeState>()(issueSettings: state.issueSettings,projectSettings: state.projectSettings,projectOrder: state.projectOrder,+ inboxSettings: state.inboxSettings,+ pinnedLimit: state.pinnedLimit,+ viewsShowCount: state.viewsShowCount,+ inboxCollapsed: state.inboxCollapsed,projectsCollapsed: state.projectsCollapsed,viewsCollapsed: state.viewsCollapsed,pinnedCollapsed: state.pinnedCollapsed,@@ -151,6 +199,7 @@ export const useSidebarTreeStore = create<SidebarTreeState>()(...p,issueSettings: { ...DEFAULT_SIDEBAR_ISSUE_SETTINGS, ...p.issueSettings },projectSettings: { ...DEFAULT_SIDEBAR_PROJECT_SETTINGS, ...p.projectSettings },+ inboxSettings: { ...DEFAULT_SIDEBAR_INBOX_SETTINGS, ...p.inboxSettings },};},},diff --git a/packages/core/issues/ws-updaters.test.ts b/packages/core/issues/ws-updaters.test.tsindex 5d42f3b531..c97ef07066 100644--- a/packages/core/issues/ws-updaters.test.ts+++ b/packages/core/issues/ws-updaters.test.ts@@ -17,6 +17,7 @@ import {patchIssueProperties,} from "./ws-updaters";import { issueKeys } from "./queries";+import { NO_PROJECT_SIDEBAR_SOURCE } from "./sidebar-list";import { labelKeys } from "../labels/queries";import { EMPTY_INBOX_FILTERS } from "../inbox/filters";import { archivedInboxFacetsOptions, archivedInboxPagesOptions } from "../inbox/queries";@@ -1193,6 +1194,18 @@ describe("sidebar issue lists", () => {expect(invalidated(otherKey)).toBe(true);});+ it("refetches No project when an issue leaves its project", () => {+ const noProjectKey = issueKeys.sidebar(+ WS_ID,+ NO_PROJECT_SIDEBAR_SOURCE,+ { table: { scope: { kind: "workspace" }, filters: { include_no_project: true }, sort } },+ 5,+ );+ qc.setQueryData(noProjectKey, { issues: [], total: 0 });+ onIssueUpdated(qc, WS_ID, { id: ISSUE_ID, project_id: null, revision: 2 }, { projectChanged: true });+ expect(invalidated(noProjectKey)).toBe(true);+ });+it("refetches every list when an issue is created or deleted", () => {onIssueCreated(qc, WS_ID, otherIssue);expect(invalidated(otherKey)).toBe(true);diff --git a/packages/core/navigation/rail-order-store.test.ts b/packages/core/navigation/rail-order-store.test.tsindex 2e60a8fda9..78d429e85d 100644--- a/packages/core/navigation/rail-order-store.test.ts+++ b/packages/core/navigation/rail-order-store.test.ts@@ -8,14 +8,22 @@ describe("resolveRailOrder", () => {});it("keeps a saved order", () => {- const saved = ["chat", "inbox", "work", "team", "autopilots"];+ const saved = ["chat", "work", "team", "autopilots"];expect(resolveRailOrder(saved)).toEqual(saved);});it("drops unknown and repeated ids", () => {- expect(resolveRailOrder(["chat", "settings", 3, "chat", "inbox", "work", "team", "autopilots"])).toEqual([+ expect(resolveRailOrder(["chat", "settings", 3, "chat", "work", "team", "autopilots"])).toEqual([+ "chat",+ "work",+ "team",+ "autopilots",+ ]);+ });++ it("drops the retired Inbox space from an order saved before it moved into Work", () => {+ expect(resolveRailOrder(["chat", "inbox", "work", "team", "autopilots"])).toEqual(["chat",- "inbox","work","team","autopilots",@@ -23,17 +31,15 @@ describe("resolveRailOrder", () => {});it("puts a space missing from the saved order after its default neighbour", () => {- expect(resolveRailOrder(["chat", "inbox", "autopilots", "work"])).toEqual([+ expect(resolveRailOrder(["chat", "autopilots", "work"])).toEqual(["chat",- "inbox","autopilots","work","team",]);- expect(resolveRailOrder(["chat", "work", "team", "autopilots"])).toEqual([- "inbox",- "chat",+ expect(resolveRailOrder(["chat", "team", "autopilots"])).toEqual(["work",+ "chat","team","autopilots",]);@@ -46,13 +52,13 @@ describe("useRailOrderStore", () => {});it("saves a custom order", () => {- const order = ["chat", "inbox", "work", "team", "autopilots"] as const;+ const order = ["chat", "work", "team", "autopilots"] as const;useRailOrderStore.getState().setOrder(order);expect(useRailOrderStore.getState().order).toEqual(order);});it("forgets the order once it is back to the default", () => {- useRailOrderStore.getState().setOrder(["work", "inbox", "team", "chat", "autopilots"]);+ useRailOrderStore.getState().setOrder(["team", "work", "chat", "autopilots"]);useRailOrderStore.getState().setOrder(RAIL_SPACES);expect(useRailOrderStore.getState().order).toBeNull();});diff --git a/packages/core/package.json b/packages/core/package.jsonindex e853d1b918..ca18cc270d 100644--- a/packages/core/package.json+++ b/packages/core/package.json@@ -137,7 +137,7 @@"./issue-views/preferences": "./issue-views/preferences.ts","./issue-views/sidebar-views": "./issue-views/sidebar-views.ts","./issue-views/view-target": "./issue-views/view-target.ts",- "./issue-views/unread-view": "./issue-views/unread-view.ts",+ "./issue-views/builtin-issue-views": "./issue-views/builtin-issue-views.ts","./issue-views/definition": "./issue-views/definition.ts","./issue-views/rename-store": "./issue-views/rename-store.ts","./issue-views/edit-store": "./issue-views/edit-store.ts",diff --git a/packages/core/paths/spaces.test.ts b/packages/core/paths/spaces.test.tsindex 4cc5f1d7a3..fffee5f7d5 100644--- a/packages/core/paths/spaces.test.ts+++ b/packages/core/paths/spaces.test.ts@@ -15,7 +15,7 @@ describe("spaceForPath", () => {});it.each([- [ws.inbox(), "inbox"],+ [ws.inbox(), "work"],[ws.myIssues(), "work"],[ws.issues(), "work"],[ws.issueDetail("MUL-1"), "work"],diff --git a/packages/core/paths/spaces.ts b/packages/core/paths/spaces.tsindex 1fd4047d6f..dca772b033 100644--- a/packages/core/paths/spaces.ts+++ b/packages/core/paths/spaces.ts@@ -7,7 +7,6 @@*/export type AppSpaceId =- | "inbox"| "work"| "team"| "chat"@@ -19,7 +18,6 @@ export type RailSpaceId = Exclude<AppSpaceId, "settings">;/** Spaces in rail order. */export const RAIL_SPACES: readonly RailSpaceId[] = [- "inbox","work","team","chat",@@ -27,7 +25,8 @@ export const RAIL_SPACES: readonly RailSpaceId[] = [];const SPACE_BY_SEGMENT: Record<string, AppSpaceId> = {- inbox: "inbox",+ // The full notification list; its sidebar section heads the Work panel.+ inbox: "work","my-issues": "work",issues: "work",projects: "work",diff --git a/packages/views/inbox/components/inbox-display.ts b/packages/views/inbox/components/inbox-display.tsindex 7e681c5dd6..36910048bb 100644--- a/packages/views/inbox/components/inbox-display.ts+++ b/packages/views/inbox/components/inbox-display.ts@@ -1,3 +1,4 @@+import type { WorkspacePaths } from "@multica/core/paths";import type { InboxItem } from "@multica/core/types";function singleLine(value: string | null | undefined): string {@@ -90,3 +91,17 @@ export function resolveDetailItem(if (!detailKey || detailKey === selectedKey) return null;return selectedKey ? byKey(selectedKey) : null;}++/**+ * Where a notification row leads: its issue, at the comment or app request it+ * is about when it names one. An issue-less notification opens on the Inbox+ * page, which shows the detail of the row picked there.+ */+export function inboxRowHref(p: WorkspacePaths, item: InboxItem): string {+ if (!item.issue_id) return `${p.inbox()}?${new URLSearchParams({ issue: item.id }).toString()}`;+ const issueHref = p.issueDetail(item.issue_id);+ const requestId = item.type.startsWith("app_") ? item.details?.request_id : undefined;+ if (requestId) return `${issueHref}#app-request-${requestId}`;+ const commentId = item.details?.comment_id;+ return commentId ? `${issueHref}#comment-${commentId}` : issueHref;+}diff --git a/packages/views/inbox/components/inbox-filter-menu.tsx b/packages/views/inbox/components/inbox-filter-menu.tsxindex b9fb1b0dab..a5e465bcfb 100644--- a/packages/views/inbox/components/inbox-filter-menu.tsx+++ b/packages/views/inbox/components/inbox-filter-menu.tsx@@ -126,6 +126,7 @@ export function InboxFilterMenu({issueFieldsSupport = "supported",activeIssueIds = EMPTY_ISSUE_IDS,archived = false,+ sectionTrigger,}: {wsId: string;items: InboxItem[];@@ -134,6 +135,11 @@ export function InboxFilterMenu({/** Issues an agent is running or queued on. */activeIssueIds?: ReadonlySet<string>;archived?: boolean;+ /**+ * In a panel section's header instead of a page header: a plain row button+ * styled by the section, its menu opening to the right.+ */+ sectionTrigger?: { className: string; activeClassName: string };}) {const { t } = useT("inbox");const { t: tIssues } = useT("issues");@@ -144,6 +150,9 @@ export function InboxFilterMenu({const clearPriorityFilters = useInboxFilterStore((state) => state.clearPriorityFilters);const clearIssueFieldFilters = useInboxFilterStore((state) => state.clearIssueFieldFilters);const [open, setOpen] = useState(false);+ // The body is built only while the menu is open or closing: the trigger+ // also sits in the always-mounted Work panel, which re-renders often.+ const [bodyMounted, setBodyMounted] = useState(false);const [search, setSearch] = useState("");const [activeAtOpen, setActiveAtOpen] = useState<ReadonlySet<InboxFilterKey> | null>(null);const query = search.trim().toLowerCase();@@ -524,7 +533,7 @@ export function InboxFilterMenu({}const matchedValues = valueHits.filter((hit) => matchesFilterQuery(hit.label, query)).slice(0, 50);- const menuBody = query ? (+ const menuBody = !bodyMounted ? null : query ? (<>{fieldHits.length > 0 && (<DropdownMenuGroup>@@ -595,33 +604,63 @@ export function InboxFilterMenu({return (<DropdownMenuopen={open}+ onOpenChangeComplete={(next) => {+ if (!next) setBodyMounted(false);+ }}onOpenChange={(next) => {setOpen(next);+ if (next) setBodyMounted(true);setActiveAtOpen(next ? new Set(activeInboxFilterKeys(effectiveFilters)) : null);if (!next) setSearch("");}}>- <DropdownMenuTrigger- render={- <IconButton- variant={activeCount > 0 ? "default" : "ghost"}- size="icon-sm"- label={triggerLabel}- tooltipSide="bottom"- className={cn(- "text-muted-foreground",- activeCount > 0 &&- "w-auto gap-1 bg-brand px-2 text-white hover:bg-brand/90",- )}- />- }+ {sectionTrigger ? (+ <DropdownMenuTrigger+ render={+ <button+ type="button"+ aria-label={triggerLabel}+ className={cn(+ sectionTrigger.className,+ "data-popup-open:bg-surface-selected data-popup-open:opacity-100",+ activeCount > 0 ? sectionTrigger.activeClassName : "data-popup-open:text-foreground",+ )}+ />+ }+ >+ <Filter className="size-3.5" />+ {activeCount > 0 && (+ <span className="text-caption tabular-nums">{activeCount}</span>+ )}+ </DropdownMenuTrigger>+ ) : (+ <DropdownMenuTrigger+ render={+ <IconButton+ variant={activeCount > 0 ? "default" : "ghost"}+ size="icon-sm"+ label={triggerLabel}+ tooltipSide="bottom"+ className={cn(+ "text-muted-foreground",+ activeCount > 0 &&+ "w-auto gap-1 bg-brand px-2 text-white hover:bg-brand/90",+ )}+ />+ }+ >+ <Filter className="size-4" />+ {activeCount > 0 && (+ <span className="text-caption tabular-nums">{activeCount}</span>+ )}+ </DropdownMenuTrigger>+ )}+ <DropdownMenuContent+ side={sectionTrigger ? "right" : undefined}+ align={sectionTrigger ? "start" : "end"}+ sideOffset={sectionTrigger ? 8 : undefined}+ className="w-auto min-w-64 p-0">- <Filter className="size-4" />- {activeCount > 0 && (- <span className="text-caption tabular-nums">{activeCount}</span>- )}- </DropdownMenuTrigger>- <DropdownMenuContent align="end" className="w-auto min-w-64 p-0"><div data-filter-search className="flex items-center gap-1.5 border-b border-foreground/5 px-2.5 py-2"><Search className="size-3.5 shrink-0 text-muted-foreground" /><inputdiff --git a/packages/views/inbox/components/inbox-page-query.test.tsx b/packages/views/inbox/components/inbox-page-query.test.tsxindex 04c9f7f8c6..b4f4b54b66 100644--- a/packages/views/inbox/components/inbox-page-query.test.tsx+++ b/packages/views/inbox/components/inbox-page-query.test.tsx@@ -39,7 +39,7 @@ vi.mock("../../navigation", () => ({useNavigation: () => ({ searchParams, replace }),useReportNavigating: () => {},}));-vi.mock("@multica/ui/hooks/use-mobile", () => ({ useIsCompact: () => false }));+vi.mock("@multica/ui/hooks/use-mobile", () => ({ useIsCompact: () => true }));vi.mock("./inbox-list", () => ({InboxList: ({ items, onSelect }: { items: InboxItem[]; onSelect: (item: InboxItem) => void }) => (<div>{items.map((row) => (@@ -55,12 +55,8 @@ vi.mock("./inbox-filter-menu", () => ({},}));vi.mock("./inbox-list-item", () => ({ useTimeAgo: () => vi.fn() }));-let rowActions: { onAction: (id: string) => void };vi.mock("./inbox-context-menu", () => ({- InboxContextMenuProvider: ({ actions, children }: { actions: typeof rowActions; children: ReactNode }) => {- rowActions = actions;- return children;- },+ InboxContextMenuProvider: ({ children }: { children: ReactNode }) => children,}));vi.mock("./inbox-detail-label", () => ({ useTypeLabels: () => ({}) }));vi.mock("../../i18n", () => {@@ -224,8 +220,7 @@ it.each([false, true])("clears an older unread assignment when opening a read rosetApiInstance({ listInbox, markInboxRead, getInboxUnreadSummary: async () => [] } as unknown as ApiClient);renderPage();- const row = await screen.findByText("comment");- if (!viaUrl) fireEvent.click(row);+ if (!viaUrl) fireEvent.click(await screen.findByText("comment"));expect(await screen.findByTestId("detail")).toHaveTextContent("issue-a");await waitFor(() => expect(markInboxRead).toHaveBeenCalledExactlyOnceWith("comment"));@@ -256,7 +251,7 @@ function archivedFixture() {setApiInstance({ listArchivedInboxPage, markInboxRead, unarchiveInbox,getInboxUnreadSummary: async () => [],} as unknown as ApiClient);- return { a, readGate, lookup, listArchivedInboxPage, unarchiveInbox,+ return { a, readGate, lookup, listArchivedInboxPage, markInboxRead, unarchiveInbox,remove: () => { rows = rows.filter((row) => row.id !== a.id); },};}@@ -264,16 +259,15 @@ function archivedFixture() {async function openArchived(fixture: ReturnType<typeof archivedFixture>, viaUrl = false) {if (viaUrl) searchParams.set("issue", "issue-a");renderPage();- const row = await screen.findByText("inbox-a");- if (!viaUrl) fireEvent.click(row);+ if (!viaUrl) fireEvent.click(await screen.findByText("inbox-a"));const detail = await screen.findByTestId("detail");- await waitFor(() => expect(screen.getByText("inbox-a")).toHaveAttribute("data-read", "true"));+ await waitFor(() => expect(fixture.markInboxRead).toHaveBeenCalledWith("inbox-a"));await act(async () => fixture.readGate.resolve());await waitFor(() => expect(fixture.listArchivedInboxPage.mock.calls.some((call) => call[1].groupId === "issue-a")).toBe(true));return detail;}-it("keeps the active read selection until moving to another notification", async () => {+it("keeps an unread-filtered selection open after reading it", async () => {let rows = [item(), item({ id: "inbox-b", issue_id: "issue-b" })];const listInbox = vi.fn(async () => rows);const markInboxRead = vi.fn(async (id: string) => {@@ -284,29 +278,19 @@ it("keeps the active read selection until moving to another notification", asyncrenderPage();fireEvent.click(await screen.findByText("inbox-a"));await waitFor(() => expect(listInbox).toHaveBeenCalledTimes(2));- expect(screen.getByText("inbox-a")).toHaveAttribute("data-read", "true");expect(screen.getByTestId("detail")).toHaveTextContent("issue-a");- fireEvent.click(screen.getByText("inbox-b"));- await waitFor(() => expect(listInbox).toHaveBeenCalledTimes(3));- expect(screen.getByTestId("detail")).toHaveTextContent("issue-b");- expect(screen.queryByText("inbox-a")).not.toBeInTheDocument();- expect(screen.getByText("inbox-b")).toHaveAttribute("data-read", "true");+ expect(replace).not.toHaveBeenLastCalledWith("/acme/inbox");});-it.each(["click", "url"])("keeps the archived row and detail mounted through refetch and slow lookup after %s selection, then releases the pin", async (selection) => {+it.each(["click", "url"])("keeps the archived detail mounted through refetch and slow lookup after %s selection", async (selection) => {const fixture = archivedFixture();const detail = await openArchived(fixture, selection === "url");- expect(screen.getByText("inbox-a")).toHaveAttribute("data-read", "true");expect(screen.getByTestId("detail")).toBe(detail);expect(detailUnmounted).not.toHaveBeenCalled();await act(async () => fixture.lookup.resolve(page([{ ...fixture.a, read: true }])));- expect(screen.getByText("inbox-a")).toHaveAttribute("data-read", "true");expect(screen.getByTestId("detail")).toBe(detail);expect(detailUnmounted).not.toHaveBeenCalled();expect(replace).not.toHaveBeenCalledWith("/acme/inbox?view=archived");- fireEvent.click(screen.getByText("inbox-b"));- await waitFor(() => expect(screen.getByTestId("detail")).toHaveTextContent("issue-b"));- expect(screen.queryByText("inbox-a")).not.toBeInTheDocument();});it("keeps an older archived notification open through auto-read when the lookup carries its type filter", async () => {@@ -359,7 +343,6 @@ it("keeps reading through lookup failure and clears a confirmed missing notificaconst detail = await openArchived(fixture);await act(async () => fixture.lookup.reject(new Error("offline")));await waitFor(() => expect(qc.getQueryState(archivedInboxLookupOptions("workspace-1", "issue-a").queryKey)?.status).toBe("error"));- expect(screen.getByText("inbox-a")).toBeInTheDocument();expect(screen.getByTestId("detail")).toBe(detail);expect(detailUnmounted).not.toHaveBeenCalled();fixture.listArchivedInboxPage.mockImplementation(async () => page([]));@@ -380,16 +363,6 @@ it("removes a pinned archived notification when its issue is deleted", async ()expect(replace).toHaveBeenLastCalledWith("/acme/inbox?view=archived");});-it("restores a pinned notification without keeping it in the archived list", async () => {- const fixture = archivedFixture();- await openArchived(fixture);- await act(async () => fixture.lookup.resolve(page([{ ...fixture.a, read: true }])));- act(() => rowActions.onAction("inbox-a"));- await waitFor(() => expect(fixture.unarchiveInbox).toHaveBeenCalledOnce());- await waitFor(() => expect(screen.getByTestId("detail")).toHaveTextContent("issue-b"));- expect(screen.queryByText("inbox-a")).not.toBeInTheDocument();-});-it.each(["status", "priority", "actor"] as const)("still applies the %s filter to a pinned archived row", async (filter) => {const fixture = archivedFixture();await openArchived(fixture);diff --git a/packages/views/inbox/components/inbox-page.test.tsx b/packages/views/inbox/components/inbox-page.test.tsxindex a27897741f..3abd736c8d 100644--- a/packages/views/inbox/components/inbox-page.test.tsx+++ b/packages/views/inbox/components/inbox-page.test.tsx@@ -5,6 +5,7 @@ import { ApiError } from "@multica/core/api";import type { AgentTask, InboxItem } from "@multica/core/types";import { useInboxFilterStore } from "@multica/core/inbox/filter-store";import { useInboxSelectionStore } from "@multica/core/inbox/selection-store";+import { useCommandBarContextStore } from "@multica/core/command-bar";import { InboxPage } from "./inbox-page";vi.mock("sonner", () => ({@@ -124,7 +125,7 @@ const issueDetailProps = vi.hoisted(vi.mock("../../issues/components/issue-detail", () => ({IssueDetail: (props: Record<string, unknown>) => {issueDetailProps.push(props);- return null;+ return <div data-testid="issue-detail">{String(props.issueId)}</div>;},issueHighlightMementoKey: (issueId: string) => `highlight:${issueId}`,}));@@ -141,9 +142,9 @@ vi.mock("../../navigation", () => ({// Drive the layout from a viewport width so a test can name the device it// cares about instead of a boolean, and the two breakpoints stay in one place.-// Phone-width by default — one column keeps most assertions simple. Tests-// about actioning a row WHILE it is open need the two-panel desktop layout,-// since a single column swaps the list out for the detail on selection.+// Phone-width by default: only there does the page keep its own list. From+// the compact breakpoint up it shows the detail of the notification picked in+// the Work panel, so desktop tests open one through the URL.const PHONE = 390;// iPhone Duo's inner screen: 669px wide held upright, 951px held sideways.const FOLD_INNER_PORTRAIT = 669;@@ -279,10 +280,41 @@ function reset() {useInboxFilterStore.setState({ filtersByWorkspace: {} });}+function inboxCommands() {+ const entry = useCommandBarContextStore.getState().entries.find((e) => e.context.kind === "inbox");+ if (entry?.context.kind !== "inbox") throw new Error("the Inbox registered no command bar context");+ return entry.context;+}+describe("InboxPage", () => {- it.each([false, true])("enabling idle hides an already busy row with unread pin=%s", (unreadOnly) => {+ it("opens a notification the Work panel offered despite a type filter", () => {reset();layout.width = DESKTOP;+ searchParams = new URLSearchParams("issue=quick-failed");+ listData.active = [item({ id: "quick-failed", issue_id: null, type: "quick_create_failed", title: "Review quick-create failure" })];+ useInboxFilterStore.getState().toggleFilterValue("workspace-1", "type", "mentions");+ render(<InboxPage />);+ expect(replace).not.toHaveBeenCalledWith("/acme/inbox");+ expect(screen.getByText("Review quick-create failure")).toBeInTheDocument();+ });++ it("replays the comment landing when re-clicking an open archived row", () => {+ reset();+ layout.width = DESKTOP;+ searchParams = new URLSearchParams("view=archived");+ listData.archived = [item({ archived: true, details: { comment_id: "comment-1" } })];+ render(<InboxPage />);+ fireEvent.click(screen.getByTestId("row"));+ const firstToken = issueDetailProps.at(-1)?.highlightRequestToken;+ fireEvent.click(screen.getByTestId("row"));+ expect(issueDetailProps.at(-1)?.highlightRequestToken).not.toBe(firstToken);+ });++ // Only the phone's page lists notifications; on desktop the Work panel does.+ it.each([false, true])("enabling idle closes an already busy notification with unread pin=%s", (unreadOnly) => {+ reset();+ layout.width = PHONE;+ searchParams = new URLSearchParams("issue=busy-issue");listData.active = [item({ id: "busy-row", issue_id: "busy-issue", read: !unreadOnly })];listData.tasks = [{ id: "task-a", agent_id: "agent-1", issue_id: "busy-issue", status: "running" }] as AgentTask[];if (unreadOnly) useInboxFilterStore.getState().toggleUnreadOnly("workspace-1");@@ -290,56 +322,72 @@ describe("InboxPage", () => {listData.active = listData.active.map((current) => ({ ...current, read: true }));});const { rerender } = render(<InboxPage />);- fireEvent.click(screen.getByTestId("row"));rerender(<InboxPage />);- expect(screen.getByTestId("row")).toHaveTextContent("busy-row");+ expect(screen.getByTestId("issue-detail")).toHaveTextContent("busy-issue");act(() => useInboxFilterStore.getState().setAgent("workspace-1", "idle"));- expect(screen.queryByTestId("row")).toBeNull();+ expect(screen.queryByTestId("issue-detail")).toBeNull();+ expect(replace).toHaveBeenLastCalledWith("/acme/inbox");});- it("enabling unread hides a read row pinned by idle", () => {+ it("enabling unread closes a read notification pinned by idle", () => {reset();- layout.width = DESKTOP;+ layout.width = PHONE;+ searchParams = new URLSearchParams("issue=idle-issue");listData.active = [item({ id: "read-row", issue_id: "idle-issue", read: true })];useInboxFilterStore.getState().setAgent("workspace-1", "idle");render(<InboxPage />);- fireEvent.click(screen.getByTestId("row"));+ expect(screen.getByTestId("issue-detail")).toHaveTextContent("idle-issue");act(() => useInboxFilterStore.getState().toggleUnreadOnly("workspace-1"));- expect(screen.queryByTestId("row")).toBeNull();+ expect(screen.queryByTestId("issue-detail")).toBeNull();});it("re-enabling idle evaluates current activity after disabling it", () => {reset();- layout.width = DESKTOP;+ layout.width = PHONE;+ searchParams = new URLSearchParams("issue=issue-a");listData.active = [item({ id: "was-idle", issue_id: "issue-a", read: true })];useInboxFilterStore.getState().setAgent("workspace-1", "idle");const { rerender } = render(<InboxPage />);- fireEvent.click(screen.getByTestId("row"));act(() => useInboxFilterStore.getState().setAgent("workspace-1", "idle"));listData.tasks = [{ id: "task-a", agent_id: "agent-1", issue_id: "issue-a", status: "running" }] as AgentTask[];rerender(<InboxPage />);- expect(screen.getByTestId("row")).toHaveTextContent("was-idle");+ expect(screen.getByTestId("issue-detail")).toHaveTextContent("issue-a");act(() => useInboxFilterStore.getState().setAgent("workspace-1", "idle"));- expect(screen.queryByTestId("row")).toBeNull();+ expect(screen.queryByTestId("issue-detail")).toBeNull();});- // Inbox rows need more room than the nav's labels, so the list is sized by- // the list width rather than the space panel's.- it("sizes the desktop list with the list column width", () => {+ // The Work panel's Inbox section is the list from the compact breakpoint up.+ it("shows no list of its own on desktop, only a prompt until a notification is picked", () => {reset();layout.width = DESKTOP;+ listData.active = [item({ id: "inbox-a", issue_id: "issue-a" })];const { container } = render(<InboxPage />);- expect(container.querySelector("[data-slot='list-column']")).toHaveClass(- "w-[min(var(--list-column-width),40vw)]",- );+ expect(screen.queryByTestId("list")).toBeNull();+ expect(container.querySelector("[data-slot='list-column']")).toBeNull();+ expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent("Inbox");+ expect(screen.queryByTestId("issue-detail")).toBeNull();+ });++ // The live Inbox lives in the Work panel; the archive has nowhere else to list.+ it("lists the archive in its own column on desktop", () => {+ reset();+ layout.width = DESKTOP;+ searchParams = new URLSearchParams("view=archived");+ listData.archived = [item({ id: "archived-1", archived: true })];++ const { container } = render(<InboxPage />);++ expect(container.querySelector("[data-slot='list-column']")).not.toBeNull();+ expect(screen.getByTestId("list").dataset.view).toBe("archived");+ expect(screen.getByTestId("row").textContent).toBe("archived-1");});it("keeps the title unread count static", () => {@@ -540,10 +588,9 @@ describe("InboxPage", () => {expect(queryCalls.find((q) => q.queryKey.includes("lookup"))?.enabled).toBe(true);});- describe.each([PHONE, DESKTOP])("archive deep links at width %s", (width) => {+ describe("archive deep links", () => {function setupLookup() {reset();- layout.width = width;searchParams = new URLSearchParams("view=archived&issue=old-issue");listData.archived = [item({ id: "recent", issue_id: "recent-issue", archived: true })];listData.lookup = [];@@ -605,8 +652,6 @@ describe("InboxPage", () => {it("switches between the inbox and the archive from the title menu", async () => {reset();- layout.width = DESKTOP;- searchParams = new URLSearchParams("issue=issue-1");listData.active = [item({ id: "active-1", issue_id: "issue-1" })];const { container } = render(<InboxPage />);@@ -659,33 +704,16 @@ describe("InboxPage", () => {expect(screen.getByTestId("list").dataset.view).toBe("archived");});- it("replays the comment highlight when the already-open row is clicked again", () => {- // Re-clicking the open notification is an explicit "take me back to that- // comment". It doesn't remount the detail (same issue key), so the page- // signals the replay through the bumped token; a selection change keeps- // the token still — its remount replays the landing by itself.- reset();- layout.width = DESKTOP;- listData.active = [item({ details: { comment_id: "comment-1" } })];-- render(<InboxPage />);- fireEvent.click(screen.getByTestId("row"));- expect(issueDetailProps.at(-1)?.highlightRequestToken).toBe(0);-- fireEvent.click(screen.getByTestId("row"));- expect(issueDetailProps.at(-1)?.highlightRequestToken).toBe(1);- });-it("keeps its own detail pane from reading the inbox, so a row marked unread stays unread", () => {// The detail reads an issue's notifications when it is opened anywhere// else (MUL-8588). Here the page reads the row it selected itself, and a// row the reader marks unread while it is open must not be read again.reset();layout.width = DESKTOP;+ searchParams = new URLSearchParams("issue=issue-1");listData.active = [item()];render(<InboxPage />);- fireEvent.click(screen.getByTestId("row"));expect(issueDetailProps.at(-1)).toMatchObject({ readsInbox: false });});@@ -834,6 +862,7 @@ describe("InboxPage", () => {// looked like it only made the notification disappear.reset();layout.width = DESKTOP;+ searchParams = new URLSearchParams("issue=issue-a");listData.active = [item({ id: "inbox-a", issue_id: "issue-a", read: false }),];@@ -845,10 +874,10 @@ describe("InboxPage", () => {});const { rerender } = render(<InboxPage />);- fireEvent.click(screen.getByTestId("row"));rerender(<InboxPage />);- expect(screen.getByTestId("row")).toHaveTextContent("inbox-a");+ expect(markReadMutate).toHaveBeenCalledWith("inbox-a", expect.anything());+ expect(screen.getByTestId("issue-detail")).toHaveTextContent("issue-a");expect(replace).not.toHaveBeenCalledWith("/acme/inbox");});@@ -857,6 +886,7 @@ describe("InboxPage", () => {// idle filter on, that would drop the row the user is working in.reset();layout.width = DESKTOP;+ searchParams = new URLSearchParams("issue=issue-a");listData.active = [item({ id: "inbox-a", issue_id: "issue-a", read: true }),item({ id: "inbox-b", issue_id: "issue-b", read: true }),@@ -864,18 +894,13 @@ describe("InboxPage", () => {useInboxFilterStore.getState().setAgent("workspace-1", "idle");const { rerender } = render(<InboxPage />);- fireEvent.click(screen.getAllByTestId("row")[0]!);rerender(<InboxPage />);listData.tasks = [{ id: "task-a", agent_id: "agent-1", issue_id: "issue-a", status: "queued" },- { id: "task-b", agent_id: "agent-1", issue_id: "issue-b", status: "running" },] as AgentTask[];rerender(<InboxPage />);- // The open row stays; another row that turned busy is still filtered.- expect(screen.getAllByTestId("row").map((row) => row.textContent)).toEqual([- "inbox-a",- ]);+ expect(screen.getByTestId("issue-detail")).toHaveTextContent("issue-a");expect(replace).not.toHaveBeenCalledWith("/acme/inbox");});@@ -885,15 +910,15 @@ describe("InboxPage", () => {// no-op.reset();layout.width = DESKTOP;+ searchParams = new URLSearchParams("issue=issue-a");listData.active = [item({ id: "inbox-a", issue_id: "issue-a", read: false }),];const { rerender } = render(<InboxPage />);- fireEvent.click(screen.getByTestId("row"));markReadMutate.mockClear();- act(() => rowActions?.onMarkUnread("inbox-a"));+ act(() => inboxCommands().markUnread("inbox-a"));rerender(<InboxPage />);expect(markUnreadMutate).toHaveBeenCalledWith("inbox-a", expect.anything());@@ -905,19 +930,20 @@ describe("InboxPage", () => {// later is a fresh open and must behave like any other.reset();layout.width = DESKTOP;+ searchParams = new URLSearchParams("issue=issue-a");listData.active = [item({ id: "inbox-a", issue_id: "issue-a", read: false }),item({ id: "inbox-b", issue_id: "issue-b", read: false }),];- render(<InboxPage />);- const [rowA, rowB] = screen.getAllByTestId("row");- fireEvent.click(rowA!);- act(() => rowActions?.onMarkUnread("inbox-a"));+ const { rerender } = render(<InboxPage />);+ act(() => inboxCommands().markUnread("inbox-a"));- fireEvent.click(rowB!);+ searchParams = new URLSearchParams("issue=issue-b");+ rerender(<InboxPage />);markReadMutate.mockClear();- fireEvent.click(rowA!);+ searchParams = new URLSearchParams("issue=issue-a");+ rerender(<InboxPage />);expect(markReadMutate).toHaveBeenCalledWith("inbox-a", expect.anything());});@@ -937,32 +963,33 @@ describe("InboxPage", () => {expect(screen.queryByTestId("list")).toBeNull();});- it.each([TABLET, FOLD_INNER_LANDSCAPE])("keeps both panes at %spx", (width) => {- // 768px is the first width that keeps the two-pane layout. The nav- // auto-collapses there instead (see the sidebar), so the list has to stay- // on screen next to an open item — on a foldable's inner screen held- // sideways as much as on a tablet.+ it.each([TABLET, FOLD_INNER_LANDSCAPE])("hands the list to the Work panel at %spx", (width) => {+ // 768px is the first width with the Work panel beside the page, so the+ // page shows the notification picked there and keeps no list of its own.reset();layout.width = width;+ searchParams = new URLSearchParams("issue=issue-a");listData.active = [item({ id: "inbox-a", issue_id: "issue-a" })];render(<InboxPage />);- fireEvent.click(screen.getByTestId("row"));- expect(screen.queryByTestId("list")).not.toBeNull();+ expect(screen.queryByTestId("list")).toBeNull();+ expect(screen.getByTestId("issue-detail")).toHaveTextContent("issue-a");});+ // Phone width, where the page's own list carries the row actions.function renderWithActiveItem() {reset();- layout.width = DESKTOP;listData.active = [item({ id: "inbox-a", issue_id: "issue-a" })];return render(<InboxPage />);}function renderWithOpenItem() {- const view = renderWithActiveItem();- fireEvent.click(screen.getByTestId("row"));- return view;+ reset();+ layout.width = DESKTOP;+ searchParams = new URLSearchParams("issue=issue-a");+ listData.active = [item({ id: "inbox-a", issue_id: "issue-a" })];+ return render(<InboxPage />);}describe("archive shortcut", () => {@@ -986,13 +1013,12 @@ describe("InboxPage", () => {it("restores the open notification while reading the archive", () => {reset();layout.width = DESKTOP;- searchParams = new URLSearchParams("view=archived");+ searchParams = new URLSearchParams("view=archived&issue=issue-9");listData.archived = [item({ id: "archived-1", issue_id: "issue-9", archived: true }),];render(<InboxPage />);- fireEvent.click(screen.getByTestId("row"));pressArchiveKey();expect(unarchiveMutate).toHaveBeenCalledWith("archived-1", expect.anything());@@ -1002,13 +1028,13 @@ describe("InboxPage", () => {it("leaves the selection on the next notification", () => {reset();layout.width = DESKTOP;+ searchParams = new URLSearchParams("issue=issue-a");listData.active = [item({ id: "inbox-a", issue_id: "issue-a" }),item({ id: "inbox-b", issue_id: "issue-b" }),];render(<InboxPage />);- fireEvent.click(screen.getAllByTestId("row")[0]!);replace.mockClear();pressArchiveKey();@@ -1130,7 +1156,6 @@ describe("InboxPage", () => {it("confirms a restore", () => {reset();- layout.width = DESKTOP;searchParams = new URLSearchParams("view=archived");listData.archived = [item({ id: "archived-1", issue_id: "issue-9", archived: true }),diff --git a/packages/views/inbox/components/inbox-page.tsx b/packages/views/inbox/components/inbox-page.tsxindex 20e4f735db..2dbfc8c72a 100644--- a/packages/views/inbox/components/inbox-page.tsx+++ b/packages/views/inbox/components/inbox-page.tsx@@ -98,8 +98,8 @@ import { cn } from "@multica/ui/lib/utils";import { CollapsedNavTrigger, PAGE_GUTTER, PageHeader } from "../../layout/page-header";import { PanelHeader } from "../../layout/panel-nav";import { useListColumnCollapsed } from "../../layout/app-shell-context";-import { InboxDeleteDialog } from "./inbox-delete-dialog";import { ListColumn } from "../../layout/list-column";+import { InboxDeleteDialog } from "./inbox-delete-dialog";import { useTimeAgo } from "./inbox-list-item";import { InboxList } from "./inbox-list";import { InboxFilterMenu } from "./inbox-filter-menu";@@ -250,13 +250,20 @@ export function InboxPage() {});const lookupItems = useMemo(() => deduplicateArchivedInboxItems(lookup.data?.items ?? []), [lookup.data]);const presenceItems = lookupMissed ? presence.data?.items ?? [] : [];+ const isCompact = useIsCompact();+ // On desktop the live list is the Work panel's Inbox section, which applies+ // the filters itself. The page only opens the notification the URL names,+ // as the issue page does for an issue notification, so a filter can never+ // refuse to open a row the section offered.+ const opensAnyLiveRow = !isCompact && !isArchivedView;const selectionItems = useMemo(() => {+ if (opensAnyLiveRow) return items;if (!isArchivedView || selectedOnPage) return filteredItems;return deduplicateArchivedInboxItems([...filteredItems,...filterInboxItems(lookupItems, effectiveFilters, filterContext),]);- }, [isArchivedView, selectedOnPage, filteredItems, lookupItems, effectiveFilters, filterContext]);+ }, [opensAnyLiveRow, items, isArchivedView, selectedOnPage, filteredItems, lookupItems, effectiveFilters, filterContext]);const visibleItems = isArchivedView && pinnedKey ? selectionItems : filteredItems;// Inbox zero: the bleeding m rises once, at the moment the last notification@@ -374,8 +381,10 @@ export function InboxPage() {setSelectedKey,]);- const isCompact = useIsCompact();const listCollapsed = useListColumnCollapsed();+ // Desktop shows the live Inbox in the Work panel; only the archive needs+ // a list of its own on the page.+ const archiveSplit = !isCompact && isArchivedView;const unreadCount = useInboxUnreadCount(wsId);const markReadMutation = useMarkInboxRead();@@ -485,9 +494,7 @@ export function InboxPage() {// keeps the entry and does NOT re-jump.if (item.issue_id) {writeViewState(issueHighlightMementoKey(item.issue_id), undefined);- if (nextKey === selectedKey) {- setHighlightRequestToken((t) => t + 1);- }+ if (nextKey === selectedKey) setHighlightRequestToken((t) => t + 1);}setSelectedKey(nextKey);};@@ -524,6 +531,9 @@ export function InboxPage() {// from, so both have to move the selection off it first. `list` is whichever// list the row came from — the main one for archive, the archived one for// unarchive.+ // The rows in the order the user sees them: on desktop the Work panel+ // section's, which applies the same filters.+ const listedItems = opensAnyLiveRow ? filteredItems : selectionItems;const advanceSelectionPast = (id: string, list: InboxItem[]) => {const idx = list.findIndex((i) => i.id === id);const target = idx >= 0 ? list[idx] : null;@@ -538,7 +548,7 @@ export function InboxPage() {// Toasts live in these shared handlers so every archive surface confirms alike.const handleArchive = (id: string) => {- advanceSelectionPast(id, selectionItems);+ advanceSelectionPast(id, listedItems);archiveMutation.mutate(id, {onSuccess: () => toast.success(t(($) => $.toasts.archived)),onError: (err) =>@@ -551,7 +561,7 @@ export function InboxPage() {};const handleUnarchive = (id: string) => {- advanceSelectionPast(id, selectionItems);+ advanceSelectionPast(id, listedItems);unarchiveMutation.mutate(id, {onSuccess: () => toast.success(t(($) => $.toasts.unarchived)),onError: (err) =>@@ -818,7 +828,7 @@ export function InboxPage() {view={view}onClose={() => setDeleteTarget(null)}onDeleted={(id) => {- advanceSelectionPast(id, selectionItems);+ advanceSelectionPast(id, listedItems);toast.success(t(($) => $.toasts.deleted));}}/>@@ -910,10 +920,10 @@ export function InboxPage() {// The inbox reads the row it selected itself (see the auto-read// effect above), and must keep a row marked unread while it is open.readsInbox={false}- // The split layout already has a nav trigger in the list header.- // Explicit false suppresses the detail header's fallback trigger,- // which is the way back once the list column is collapsed.- leadingAction={compactBackAction ?? (listCollapsed ? undefined : false)}+ // The archive's list header already has a nav trigger. Explicit+ // false suppresses the detail header's fallback trigger, which is+ // the way back once the list column is collapsed.+ leadingAction={compactBackAction ?? (archiveSplit && !listCollapsed ? false : undefined)}onDelete={() => {// Issue deletion CASCADE-deletes the inbox item server-side, and the// issue:deleted WS event prunes it from the inbox cache. Just clear@@ -1105,67 +1115,84 @@ export function InboxPage() {return <div className="flex flex-1 flex-col min-h-0">{listPanel}</div>;}- // -- Desktop layout: list column + detail ----------------------------------+ // -- Desktop layout ----------------------------------------------------------+ // The live list is the Inbox section of the Work panel beside this page, so+ // the page shows only the detail. The archive keeps its own list column.- if (viewLoading) {+ const emptyDetail = (+ <>+ {(!archiveSplit || listCollapsed) && (+ <PageHeader>+ <h1 className="text-body font-semibold">+ {isArchivedView ? t(($) => $.list.archived_title) : t(($) => $.page.title)}+ </h1>+ </PageHeader>+ )}+ <div className="relative flex min-h-0 flex-1 flex-col items-center justify-center overflow-hidden text-muted-foreground">+ {inboxZeroCount === 0 ? (+ <MulticaBleedMark+ key={inboxZeroRises ? "rise" : "rest"}+ enterDelay={inboxZeroRises ? 0.2 : undefined}+ className="pointer-events-none absolute -right-[14%] -bottom-[26%] w-[min(560px,58%)] text-muted"+ />+ ) : (+ <Inbox className="mb-3 h-10 w-10 text-faint-foreground" />+ )}+ <p className="relative text-body">+ {visibleItems.length > 0+ ? t(($) => $.detail.select_prompt)+ : isArchivedView+ ? t(($) => $.list.archived_empty)+ : t(($) => $.detail.empty)}+ </p>+ </div>+ </>+ );++ if (archiveSplit) {return (<div className="flex min-h-0 flex-1"><ListColumn collapsed={listCollapsed} width="list">- <div className="flex h-12 shrink-0 items-center pl-5 pr-2.5">- <Skeleton className="h-5 w-16" />- </div>- <div className="flex-1 min-h-0 overflow-y-auto space-y-1 p-2">- {Array.from({ length: 5 }).map((_, i) => (- <div key={i} className="flex items-center gap-3 px-2 py-2.5">- <Skeleton className="h-7 w-7 shrink-0 rounded-full" />- <div className="flex-1 space-y-2">- <Skeleton className="h-4 w-3/4" />- <Skeleton className="h-3 w-1/2" />- </div>+ {viewLoading ? (+ <>+ <div className="flex h-12 shrink-0 items-center pl-5 pr-2.5">+ <Skeleton className="h-5 w-16" /></div>- ))}- </div>+ <div className="flex-1 min-h-0 overflow-y-auto space-y-1 p-2">+ {Array.from({ length: 5 }).map((_, i) => (+ <div key={i} className="flex items-center gap-3 px-2 py-2.5">+ <Skeleton className="h-7 w-7 shrink-0 rounded-full" />+ <div className="flex-1 space-y-2">+ <Skeleton className="h-4 w-3/4" />+ <Skeleton className="h-3 w-1/2" />+ </div>+ </div>+ ))}+ </div>+ </>+ ) : (+ listPanel+ )}</ListColumn>- <div className="min-w-0 flex-1 p-6">- <Skeleton className="h-6 w-48" />- <Skeleton className="mt-4 h-4 w-32" />+ <div className="flex h-full min-h-0 min-w-0 flex-1 flex-col">+ {viewLoading ? null : (detailContent ?? emptyDetail)}</div></div>);}- return (- <div className="flex min-h-0 flex-1">- <ListColumn collapsed={listCollapsed} width="list">{listPanel}</ListColumn>- <div className="flex h-full min-h-0 min-w-0 flex-1 flex-col">- {detailContent ?? (- <>- {listCollapsed && (- <PageHeader>- <h1 className="text-body font-semibold">{t(($) => $.page.title)}</h1>- </PageHeader>- )}- <div className="relative flex min-h-0 flex-1 flex-col items-center justify-center overflow-hidden text-muted-foreground">- {inboxZeroCount === 0 ? (- <MulticaBleedMark- key={inboxZeroRises ? "rise" : "rest"}- enterDelay={inboxZeroRises ? 0.2 : undefined}- className="pointer-events-none absolute -right-[14%] -bottom-[26%] w-[min(560px,58%)] text-muted"- />- ) : (- <Inbox className="mb-3 h-10 w-10 text-faint-foreground" />- )}- <p className="relative text-body">- {visibleItems.length > 0- ? t(($) => $.detail.select_prompt)- : isArchivedView- ? t(($) => $.list.archived_empty)- : t(($) => $.detail.empty)}- </p>- </div>- </>- )}+ if (viewLoading) {+ return (+ <div className="min-w-0 flex-1 p-6">+ <Skeleton className="h-6 w-48" />+ <Skeleton className="mt-4 h-4 w-32" /></div>+ );+ }++ return (+ <div className="flex h-full min-h-0 min-w-0 flex-1 flex-col">+ {detailContent ?? emptyDetail}</div>);}diff --git a/packages/views/inbox/components/use-filtered-inbox-rows.ts b/packages/views/inbox/components/use-filtered-inbox-rows.tsnew file mode 100644index 0000000000..3a97fabe82--- /dev/null+++ b/packages/views/inbox/components/use-filtered-inbox-rows.ts@@ -0,0 +1,71 @@+"use client";++import { useMemo } from "react";+import { useQuery } from "@tanstack/react-query";+import { agentTaskSnapshotOptions } from "@multica/core/agents";+import { inboxListOptions } from "@multica/core/inbox/queries";+import {+ effectiveInboxFilters,+ filterInboxItems,+ inboxFilterCount,+ inboxIssueFieldsSupport,+ inboxPriorityFilterSupport,+ useInboxFilters,+} from "@multica/core/inbox/filter-store";+import type { AgentTask, InboxItem } from "@multica/core/types";+import { deriveIssueSurfaceActivity } from "../../issues/surface/activity";++const EMPTY_INBOX: InboxItem[] = [];+const EMPTY_TASKS: AgentTask[] = [];++/**+ * The live Inbox as the Work panel lists it: one row per issue, newest first,+ * under the workspace's Inbox filters (the same ones the phone's Inbox page+ * sets).+ *+ * `openKey` is the notification open beside the list (`issue_id ?? id`). As+ * on the Inbox page, it survives the unread and agent filters: opening it+ * reads it, and replying can start or stop an agent, and neither should take+ * the row the user is working in out of the list.+ *+ * `enabled: false` reads nothing, for a caller that may not need the list.+ */+export function useFilteredInboxRows(wsId: string, openKey: string | null, enabled = true) {+ const { data: raw = EMPTY_INBOX } = useQuery({ ...inboxListOptions(wsId), enabled: enabled && !!wsId });+ const stored = useInboxFilters(wsId);+ // Every notification, not one per issue: the notification filters match any+ // notification of an issue.+ const notifications = useMemo(() => raw.filter((item) => !item.archived), [raw]);+ const priorityFilterSupport = inboxPriorityFilterSupport(raw);+ const issueFieldsSupport = inboxIssueFieldsSupport(raw);+ const filters = useMemo(+ () => effectiveInboxFilters(stored, { priority: priorityFilterSupport, issueFields: issueFieldsSupport }),+ [stored, priorityFilterSupport, issueFieldsSupport],+ );+ // "Active" is the running-or-queued rule the Inbox page and the row badges use.+ const { data: tasks = EMPTY_TASKS } = useQuery({ ...agentTaskSnapshotOptions(wsId), enabled: enabled && !!wsId });+ const activeIssueIds = useMemo(+ () => new Set(deriveIssueSurfaceActivity(tasks).activityByIssueId.keys()),+ [tasks],+ );+ // Only an agent filter reads the snapshot, so task churn leaves the list alone while it is off.+ const agentIssueIds = filters.agent ? activeIssueIds : undefined;+ const rows = useMemo(+ () =>+ filterInboxItems(notifications, filters, {+ activeIssueIds: agentIssueIds,+ pinnedUnreadKey: openKey,+ pinnedAgentKey: openKey,+ }),+ [notifications, filters, agentIssueIds, openKey],+ );++ return {+ rows,+ notifications,+ filtered: inboxFilterCount(filters) > 0,+ priorityFilterSupport,+ issueFieldsSupport,+ activeIssueIds,+ };+}diff --git a/packages/views/issue-views/all-views-page.test.tsx b/packages/views/issue-views/all-views-page.test.tsxindex 134cf9d426..114fb38fc0 100644--- a/packages/views/issue-views/all-views-page.test.tsx+++ b/packages/views/issue-views/all-views-page.test.tsx@@ -172,17 +172,21 @@ describe("AllViewsPage", () => {expect(useActiveIssueViewStore.getState().active[WORKSPACE_KEY]).toBe("v2");});- it("lists Unread as a built-in that is starred on demand and opens its view", async () => {+ it.each([+ ["My work", "my_work"],+ ["Working", "working"],+ ["Subscribed", "subscribed"],+ ])("lists %s as a built-in that is starred on demand and opens its view", async (name, id) => {const user = userEvent.setup();const { push } = renderPage();- await user.click(screen.getByRole("button", { name: "Add Unread to sidebar" }));- expect(mocks.star).toHaveBeenCalledWith("builtin:unread");+ await user.click(screen.getByRole("button", { name: `Add ${name} to sidebar` }));+ expect(mocks.star).toHaveBeenCalledWith(`builtin:${id}`);expect(push).not.toHaveBeenCalled();- await user.click(screen.getByText("Unread"));- expect(push).toHaveBeenCalledWith("/acme/issues?view=unread");- expect(useActiveIssueViewStore.getState().active[WORKSPACE_KEY]).toBe("unread");+ await user.click(screen.getByText(name));+ expect(push).toHaveBeenCalledWith(`/acme/issues?view=${id}`);+ expect(useActiveIssueViewStore.getState().active[WORKSPACE_KEY]).toBe(id);});it("opens a view in place for a shift-click, which rows never hand to the browser", async () => {@@ -214,23 +218,17 @@ describe("AllViewsPage", () => {expect(useActiveIssueViewStore.getState().active[WORKSPACE_KEY]).toBe("v-open");});- it("gives My Issues and My agents' work their own URLs", async () => {+ it("opens a built-in view's own URL in a new tab", async () => {const user = userEvent.setup();const openInNewTab = vi.fn();- const { push } = renderPage({ openInNewTab });- const row = (name: string) =>- screen- .getByRole("button", { name: new RegExp(`^(Add ${name} to|Remove ${name} from) sidebar$`) })- .closest('[role="row"]')!;+ renderPage({ openInNewTab });+ const row = screen+ .getByRole("button", { name: /^(Add My work to|Remove My work from) sidebar$/ })+ .closest('[role="row"]')!;await user.keyboard("{Meta>}");- await user.click(row("My Issues"));- await user.click(row("My agents' work"));+ await user.click(row);await user.keyboard("{/Meta}");- expect(openInNewTab).toHaveBeenCalledWith("/acme/my-issues", "My Issues");- expect(openInNewTab).toHaveBeenCalledWith("/acme/my-issues?scope=agents", "My agents' work");-- await user.click(row("My agents' work"));- expect(push).toHaveBeenCalledWith("/acme/my-issues?scope=agents");+ expect(openInNewTab).toHaveBeenCalledWith("/acme/issues?view=my_work", "My work");});});diff --git a/packages/views/issue-views/all-views-page.tsx b/packages/views/issue-views/all-views-page.tsxindex 3c35a61430..aded8e1494 100644--- a/packages/views/issue-views/all-views-page.tsx+++ b/packages/views/issue-views/all-views-page.tsx@@ -3,12 +3,9 @@import { useMemo, useState } from "react";import { useQuery } from "@tanstack/react-query";import {- Bot,- CircleUser,Copy,Layers,Link2,- ListTodo,Plus,Star,Trash2,@@ -52,9 +49,8 @@ import {type CollectionColumn,} from "../layout/collection-list";import { useT } from "../i18n";-import { useBuiltinViewNavigation } from "./builtin-views";+import { BUILTIN_VIEW_ICON, useBuiltinViewNavigation } from "./builtin-views";import { DeleteViewDialog } from "./delete-view-dialog";-import { UnreadViewIcon } from "./unread-view-icon";import { useIssueViewActions } from "./use-view-actions";type DirectoryScope = "all" | "builtin" | "mine" | "shared";@@ -67,13 +63,6 @@ type DirectoryRow =| { kind: "builtin"; id: string; key: BuiltinViewKey; name: string }| { kind: "view"; id: string; view: IssueView };-const BUILTIN_ICON: Record<BuiltinViewKey, React.ReactNode> = {- my_issues: <CircleUser className="size-4 shrink-0 text-muted-foreground" />,- my_agents: <Bot className="size-4 shrink-0 text-muted-foreground" />,- all_issues: <ListTodo className="size-4 shrink-0 text-muted-foreground" />,- unread: <UnreadViewIcon />,-};-/** Every view the user can open, and the switch that puts it in the sidebar. */export function AllViewsPage() {const { t } = useT("issues");@@ -155,7 +144,7 @@ export function AllViewsPage() {<CollectionNameCellicon={row.kind === "builtin" ? (- BUILTIN_ICON[row.key]+ <span className="flex text-muted-foreground">{BUILTIN_VIEW_ICON[row.key]}</span>) : (<Layers className="size-4 shrink-0 text-muted-foreground" />)diff --git a/packages/views/issue-views/builtin-views.ts b/packages/views/issue-views/builtin-views.tsdeleted file mode 100644index d067bae72d..0000000000--- a/packages/views/issue-views/builtin-views.ts+++ /dev/null@@ -1,47 +0,0 @@-"use client";--import { useCallback } from "react";-import { useWorkspaceId } from "@multica/core/hooks";-import { useWorkspacePaths } from "@multica/core/paths";-import { issueViewContainerKey, useActiveIssueViewStore } from "@multica/core/issue-views/active-view-store";-import type { BuiltinViewKey } from "@multica/core/issue-views/sidebar-views";-import { UNREAD_VIEW, UNREAD_VIEW_ID } from "@multica/core/issue-views/unread-view";-import { issueViewTarget } from "@multica/core/issue-views/view-target";--const WORKSPACE_SCOPE = { scope_type: "workspace" } as const;-const MY_SCOPE = { scope_type: "my" } as const;--/**- * Where a built-in view lives, and the store write that makes its page show- * it rather than whichever saved view was left open.- */-export function useBuiltinViewNavigation() {- const wsId = useWorkspaceId();- const p = useWorkspacePaths();- const setActive = useActiveIssueViewStore((s) => s.setActive);-- const hrefFor = useCallback(- (key: BuiltinViewKey) =>- key === "unread"- ? issueViewTarget(wsId, UNREAD_VIEW, p).href- : key === "all_issues"- ? p.issues()- : key === "my_agents"- ? p.myAgents()- : p.myIssues(),- [p, wsId],- );-- const prepare = useCallback(- (key: BuiltinViewKey) => {- if (key === "unread" || key === "all_issues") {- setActive(issueViewContainerKey(wsId, WORKSPACE_SCOPE), key === "unread" ? UNREAD_VIEW_ID : null);- return;- }- setActive(issueViewContainerKey(wsId, MY_SCOPE), null);- },- [setActive, wsId],- );-- return { hrefFor, prepare };-}diff --git a/packages/views/issue-views/builtin-views.tsx b/packages/views/issue-views/builtin-views.tsxnew file mode 100644index 0000000000..dff8fd5e17--- /dev/null+++ b/packages/views/issue-views/builtin-views.tsx@@ -0,0 +1,50 @@+"use client";++import { useCallback } from "react";+import { Bell, Bot, CircleUser, ListTodo } from "@multica/ui/icons";+import { useWorkspaceId } from "@multica/core/hooks";+import { useWorkspacePaths } from "@multica/core/paths";+import { issueViewContainerKey, useActiveIssueViewStore } from "@multica/core/issue-views/active-view-store";+import { FILTERED_BUILTIN_VIEWS } from "@multica/core/issue-views/builtin-issue-views";+import type { BuiltinViewKey } from "@multica/core/issue-views/sidebar-views";+import { issueViewTarget } from "@multica/core/issue-views/view-target";+import { useT } from "../i18n";++const WORKSPACE_SCOPE = { scope_type: "workspace" } as const;++export const BUILTIN_VIEW_ICON: Record<BuiltinViewKey, React.ReactNode> = {+ all_issues: <ListTodo className="size-4 shrink-0" />,+ my_work: <CircleUser className="size-4 shrink-0" />,+ working: <Bot className="size-4 shrink-0" />,+ subscribed: <Bell className="size-4 shrink-0" />,+};++export function useBuiltinViewLabel() {+ const { t } = useT("issues");+ return useCallback((key: BuiltinViewKey) => t(($) => $.views.builtin[key]), [t]);+}++/**+ * Where a built-in view lives, and the store write that makes its page show+ * it rather than whichever saved view was left open. Every built-in is the+ * workspace issues page; all but All issues open it under their filter.+ */+export function useBuiltinViewNavigation() {+ const wsId = useWorkspaceId();+ const p = useWorkspacePaths();+ const setActive = useActiveIssueViewStore((s) => s.setActive);++ const hrefFor = useCallback(+ (key: BuiltinViewKey) =>+ key === "all_issues" ? p.issues() : issueViewTarget(wsId, FILTERED_BUILTIN_VIEWS[key], p).href,+ [p, wsId],+ );++ const prepare = useCallback(+ (key: BuiltinViewKey) =>+ setActive(issueViewContainerKey(wsId, WORKSPACE_SCOPE), key === "all_issues" ? null : key),+ [setActive, wsId],+ );++ return { hrefFor, prepare };+}diff --git a/packages/views/issue-views/unread-view-icon.tsx b/packages/views/issue-views/unread-view-icon.tsxdeleted file mode 100644index 7251da6d4f..0000000000--- a/packages/views/issue-views/unread-view-icon.tsx+++ /dev/null@@ -1,8 +0,0 @@-/** The built-in Unread view's icon: the same dot the sidebar puts on an unread issue. */-export function UnreadViewIcon() {- return (- <span className="flex size-4 shrink-0 items-center justify-center">- <span className="size-2 rounded-full bg-brand" />- </span>- );-}diff --git a/packages/views/issue-views/view-header.tsx b/packages/views/issue-views/view-header.tsxindex 598693d902..40c7aca8ff 100644--- a/packages/views/issue-views/view-header.tsx+++ b/packages/views/issue-views/view-header.tsx@@ -53,7 +53,7 @@ import {type BuiltinViewKey,} from "@multica/core/issue-views/sidebar-views";import { issueViewTarget } from "@multica/core/issue-views/view-target";-import { isUnreadView } from "@multica/core/issue-views/unread-view";+import { isFilteredBuiltinViewKey } from "@multica/core/issue-views/builtin-issue-views";import {isIssueViewModified,isIssueViewUndefined,@@ -91,7 +91,7 @@ import type { IssueSurfaceController } from "../issues/surface/use-issue-surfaceimport { useT } from "../i18n";import { useMyIssuesScope } from "../my-issues/use-my-issues-scope";import { DeleteViewDialog } from "./delete-view-dialog";-import { UnreadViewIcon } from "./unread-view-icon";+import { BUILTIN_VIEW_ICON, useBuiltinViewLabel } from "./builtin-views";import { useIssueViewActions } from "./use-view-actions";import { ViewNameInput } from "./view-name-input";@@ -165,6 +165,7 @@ export function IssueViewHeader({const setAssigneeTypeForPage = useIssuesScopeStore((s) => s.setScope);const setAssigneeType = (next: IssuesScope) => setAssigneeTypeForPage(scopePage, next);const myScope = useMyIssuesScope();+ const builtinLabel = useBuiltinViewLabel();const setMyScope = useStore(myIssuesViewStore, (s) => s.setScope);const storeApi = useViewStoreApi();@@ -174,19 +175,20 @@ export function IssueViewHeader({const agentRunningFilter = useViewStore((s) => s.agentRunningFilter);const toggleAgentRunningFilter = useViewStore((s) => s.toggleAgentRunningFilter);- const builtinKey: BuiltinViewKey | null =- base.kind === "workspace" ? "all_issues" : base.kind === "my" ? (myScope === "agents" ? "my_agents" : "my_issues") : null;+ const builtinKey: BuiltinViewKey | null = base.kind === "workspace" ? "all_issues" : null;const baseName =base.kind === "project"? base.project.title- : t(($) => $.views.builtin[builtinKey!]);+ : base.kind === "my"+ ? myScope === "agents"+ ? t(($) => $.views.builtin.my_agents)+ : t(($) => $.views.builtin.my_issues)+ : builtinLabel("all_issues");const baseIcon =base.kind === "project" ? (<ProjectIcon project={base.project} size="sm" />- ) : builtinKey === "my_agents" ? (- <Bot className="size-4" />- ) : builtinKey === "my_issues" ? (- <CircleUser className="size-4" />+ ) : base.kind === "my" ? (+ myScope === "agents" ? <Bot className="size-4" /> : <CircleUser className="size-4" />) : (<ListTodo className="size-4" />);@@ -209,10 +211,10 @@ export function IssueViewHeader({if (needsSetup) setSetupFilterOpen(true);else setFilterOpen(true);}, [activeView, editViewId, needsSetup, stopEdit]);- const unreadView = isUnreadView(activeView);- const activeViewName = unreadView ? t(($) => $.views.builtin.unread) : activeView?.name;- const starId = unreadView- ? builtinViewItemId("unread")+ const activeBuiltin = isFilteredBuiltinViewKey(activeView?.id) ? activeView.id : null;+ const activeViewName = activeBuiltin ? builtinLabel(activeBuiltin) : activeView?.name;+ const starId = activeBuiltin+ ? builtinViewItemId(activeBuiltin): activeView? savedViewItemId(activeView.id): builtinKey@@ -366,7 +368,7 @@ export function IssueViewHeader({const title = (<><RefreshablePageIcon refreshing={controller.isRefreshing}>- {unreadView ? <UnreadViewIcon /> : activeView ? <Layers className="size-4" /> : baseIcon}+ {activeBuiltin ? BUILTIN_VIEW_ICON[activeBuiltin] : activeView ? <Layers className="size-4" /> : baseIcon}</RefreshablePageIcon><span className="min-w-0 truncate">{activeView ? activeViewName : baseName}</span>{!activeView && baseBadge}@@ -478,7 +480,7 @@ export function IssueViewHeader({<DropdownMenuItemonClick={() =>actions.copyLink(- builtinKey === "my_agents"+ base.kind === "my" && myScope === "agents"? paths.myAgents(): base.kind === "my"? paths.myIssues()diff --git a/packages/views/issues/actions/__tests__/issue-inbox-actions.test.tsx b/packages/views/issues/actions/__tests__/issue-inbox-actions.test.tsxnew file mode 100644index 0000000000..42bcebef00--- /dev/null+++ b/packages/views/issues/actions/__tests__/issue-inbox-actions.test.tsx@@ -0,0 +1,168 @@+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { cleanup, fireEvent, screen } from "@testing-library/react";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { agentTaskSnapshotOptions } from "@multica/core/agents";+import { useInboxFilterStore } from "@multica/core/inbox/filter-store";+import { inboxListOptions } from "@multica/core/inbox/queries";+import { useInboxSelectionStore } from "@multica/core/inbox/selection-store";+import type { InboxItem } from "@multica/core/types";+import { renderWithI18n } from "../../../test/i18n";+import { NavigationProvider, type NavigationAdapter } from "../../../navigation";+import { IssueInboxActions } from "../issue-inbox-actions";++const state = vi.hoisted(() => ({+ markRead: vi.fn(),+ markUnread: vi.fn(),+ archive: vi.fn(),+}));++vi.mock("sonner", () => ({ toast: { success: vi.fn(), error: vi.fn() } }));+vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => "ws" }));+vi.mock("@multica/core/paths", async (importOriginal) => {+ const actual = await importOriginal<typeof import("@multica/core/paths")>();+ return { ...actual, useWorkspacePaths: () => actual.paths.workspace("acme") };+});+vi.mock("@multica/core/inbox/mutations", () => ({+ useMarkInboxRead: () => ({ mutate: state.markRead }),+ useMarkInboxUnread: () => ({ mutate: state.markUnread }),+ useArchiveInbox: () => ({ mutate: state.archive }),+}));++function item(overrides: Partial<InboxItem> & { id: string }): InboxItem {+ return {+ workspace_id: "ws",+ recipient_type: "member",+ recipient_id: "member-1",+ actor_type: "agent",+ actor_id: "agent-1",+ type: "new_comment",+ severity: "info",+ issue_id: null,+ title: "Issue title",+ body: null,+ issue_status: "in_progress",+ issue_priority: "none",+ read: true,+ archived: false,+ created_at: "2026-11-10T08:00:00Z",+ details: null,+ ...overrides,+ };+}++const ROWS = [+ item({ id: "n-1", issue_id: "issue-1", created_at: "2026-11-12T08:00:00Z" }),+ item({ id: "n-2", issue_id: "issue-2", created_at: "2026-11-11T08:00:00Z", details: { comment_id: "c-9" } }),+];++function setup({+ rows = ROWS,+ issueId = "issue-1",+ onMarkDone,+}: { rows?: InboxItem[]; issueId?: string; onMarkDone?: (onSaved: () => void) => void } = {}) {+ const nav: NavigationAdapter = {+ push: vi.fn(),+ replace: vi.fn(),+ back: vi.fn(),+ pathname: `/acme/issues/${issueId}`,+ searchParams: new URLSearchParams(),+ hash: "",+ getShareableUrl: (path) => path,+ };+ const qc = new QueryClient({ defaultOptions: { queries: { retry: false, staleTime: Infinity } } });+ qc.setQueryData(inboxListOptions("ws").queryKey, rows);+ qc.setQueryData(agentTaskSnapshotOptions("ws").queryKey, []);+ renderWithI18n(+ <QueryClientProvider client={qc}>+ <NavigationProvider value={nav}>+ <IssueInboxActions issueId={issueId} onMarkDone={onMarkDone} />+ </NavigationProvider>+ </QueryClientProvider>,+ );+ return nav;+}++beforeEach(() => {+ vi.clearAllMocks();+ useInboxSelectionStore.setState({ sidebarIssueByWorkspace: { ws: "issue-1" } });+ useInboxFilterStore.getState().clearFilters("ws");+});+afterEach(cleanup);++describe("IssueInboxActions", () => {+ it("stays out of an issue that was not opened from the Inbox", () => {+ useInboxSelectionStore.setState({ sidebarIssueByWorkspace: { ws: "issue-2" } });+ setup();+ expect(screen.queryByRole("button", { name: "Archive" })).toBeNull();+ });++ it("stays out once the issue has left the Inbox", () => {+ setup({ rows: [ROWS[1]!] });+ expect(screen.queryByRole("button", { name: "Archive" })).toBeNull();+ });++ it("toggles the read state of the issue's notification", () => {+ setup();+ fireEvent.click(screen.getByRole("button", { name: "Mark as unread" }));+ expect(state.markUnread).toHaveBeenCalledWith("n-1", expect.anything());+ cleanup();++ setup({ rows: [{ ...ROWS[0]!, read: false }, ROWS[1]!] });+ fireEvent.click(screen.getByRole("button", { name: "Mark as read" }));+ expect(state.markRead).toHaveBeenCalledWith("n-1", expect.anything());+ });++ it("archives and moves on to the next notification", () => {+ const nav = setup();+ fireEvent.click(screen.getByRole("button", { name: "Archive" }));+ expect(state.archive).toHaveBeenCalledWith("n-1", expect.anything());+ expect(nav.push).toHaveBeenCalledWith("/acme/issues/issue-2#comment-c-9");+ expect(useInboxSelectionStore.getState().sidebarIssueByWorkspace.ws).toBe("issue-2");+ });++ it("stays on the issue when it was the last notification", () => {+ const nav = setup({ rows: [ROWS[0]!] });+ fireEvent.click(screen.getByRole("button", { name: "Archive" }));+ expect(state.archive).toHaveBeenCalledWith("n-1", expect.anything());+ expect(nav.push).not.toHaveBeenCalled();+ });++ it("moves on to the next notification the Work panel lists under its filters", () => {+ useInboxFilterStore.getState().toggleUnreadOnly("ws");+ const nav = setup({+ rows: [+ ROWS[0]!,+ ROWS[1]!,+ item({ id: "n-3", issue_id: "issue-3", read: false, created_at: "2026-11-10T08:00:00Z" }),+ ],+ });+ fireEvent.click(screen.getByRole("button", { name: "Archive" }));+ expect(nav.push).toHaveBeenCalledWith("/acme/issues/issue-3");+ });++ it("marks the issue done, then archives and moves on once that is saved", () => {+ let saved: (() => void) | undefined;+ const onMarkDone = vi.fn((onSaved: () => void) => { saved = onSaved; });+ const nav = setup({ onMarkDone });++ fireEvent.click(screen.getByRole("button", { name: "Mark as done" }));+ expect(onMarkDone).toHaveBeenCalledTimes(1);+ expect(state.archive).not.toHaveBeenCalled();+ expect(nav.push).not.toHaveBeenCalled();++ saved!();+ expect(state.archive).toHaveBeenCalledWith("n-1", expect.anything());+ expect(nav.push).toHaveBeenCalledWith("/acme/issues/issue-2#comment-c-9");+ });++ it("offers no done button when the issue cannot be marked done", () => {+ setup();+ expect(screen.queryByRole("button", { name: "Mark as done" })).toBeNull();+ });++ it("archives with the Inbox shortcut", () => {+ setup();+ fireEvent.keyDown(document, { key: "e", code: "KeyE" });+ expect(state.archive).toHaveBeenCalledWith("n-1", expect.anything());+ });+});diff --git a/packages/views/issues/actions/index.ts b/packages/views/issues/actions/index.tsindex f2be709285..336adee9a8 100644--- a/packages/views/issues/actions/index.ts+++ b/packages/views/issues/actions/index.ts@@ -2,6 +2,7 @@ export { useIssueActions } from "./use-issue-actions";export type { UseIssueActionsResult } from "./use-issue-actions";export { IssueActionsDropdown, useIssuePageMenu } from "./issue-actions-dropdown";export { useArchivedInboxItemId } from "./inbox-restore";+export { IssueInboxActions } from "./issue-inbox-actions";export {IssueActionsContextMenu,IssueContextMenuProvider,diff --git a/packages/views/issues/actions/issue-inbox-actions.tsx b/packages/views/issues/actions/issue-inbox-actions.tsxnew file mode 100644index 0000000000..3dc2b5f9ad--- /dev/null+++ b/packages/views/issues/actions/issue-inbox-actions.tsx@@ -0,0 +1,152 @@+"use client";++import { useEffect, useRef } from "react";+import { toast } from "sonner";+import { Archive, Check, CircleCheck, CircleDot } from "@multica/ui/icons";+import { IconButton } from "@multica/ui/components/common/icon-button";+import { useWorkspaceId } from "@multica/core/hooks";+import { useWorkspacePaths } from "@multica/core/paths";+import { useModalStore } from "@multica/core/modals";+import { useArchiveInbox, useMarkInboxRead, useMarkInboxUnread } from "@multica/core/inbox/mutations";+import { useInboxSelectionStore } from "@multica/core/inbox/selection-store";+import {+ getShortcut,+ isEditableShortcutTarget,+ isPortalLayerShortcutTarget,+ shortcutMatchesEvent,+} from "@multica/core/shortcuts";+import { isImeComposing } from "@multica/core/utils";+import { ActionShortcutKeycaps } from "../../common/shortcut-keycaps";+import { inboxRowHref } from "../../inbox/components/inbox-display";+import { useFilteredInboxRows } from "../../inbox/components/use-filtered-inbox-rows";+import { useNavigation } from "../../navigation";+import { useT } from "../../i18n";++/**+ * The Inbox's actions in the header of an issue opened from the Work panel's+ * Inbox section, while the section still lists it. Marking it done or+ * archiving opens the next notification the section lists, so the Inbox can+ * be worked through without leaving the page.+ *+ * `onMarkDone` sets the issue done and calls back once that is saved; it is+ * offered while the issue is not done or closed.+ */+export function IssueInboxActions({+ issueId,+ onMarkDone,+}: {+ issueId: string;+ onMarkDone?: (onSaved: () => void) => void;+}) {+ const { t } = useT("inbox");+ const { t: tIssues } = useT("issues");+ const wsId = useWorkspaceId();+ const p = useWorkspacePaths();+ const { push } = useNavigation();+ const fromInbox = useInboxSelectionStore((s) => s.sidebarIssueByWorkspace[wsId] === issueId);+ const rememberSidebarIssue = useInboxSelectionStore((s) => s.rememberSidebarIssue);+ const { rows } = useFilteredInboxRows(wsId, issueId, fromInbox);+ const index = fromInbox ? rows.findIndex((row) => row.issue_id === issueId) : -1;+ const item = index >= 0 ? rows[index]! : null;+ const markRead = useMarkInboxRead();+ const markUnread = useMarkInboxUnread();+ const archive = useArchiveInbox();++ const failed = (fallback: string) => (err: unknown) =>+ toast.error(err instanceof Error && err.message ? err.message : fallback);++ // Rows run newest first: move on to the older one, else the newer one.+ const openNext = (next: (typeof rows)[number] | null) => {+ if (!next) return;+ rememberSidebarIssue(wsId, next.issue_id ?? null);+ push(inboxRowHref(p, next));+ };++ const archiveItem = () => {+ if (!item) return;+ const next = rows[index + 1] ?? rows[index - 1] ?? null;+ archive.mutate(item.id, {+ onSuccess: () => toast.success(t(($) => $.toasts.archived)),+ onError: failed(t(($) => $.errors.archive_failed)),+ });+ openNext(next);+ };++ // Done archives the issue's notifications on the server; archiving here as+ // well takes the row out at once instead of when that event arrives.+ const markDone = () => {+ if (!item || !onMarkDone) return;+ const next = rows[index + 1] ?? rows[index - 1] ?? null;+ onMarkDone(() => {+ archive.mutate(item.id, { onError: failed(t(($) => $.errors.archive_failed)) });+ openNext(next);+ });+ };++ const archiveRef = useRef<(() => void) | null>(null);+ useEffect(() => {+ archiveRef.current = item ? archiveItem : null;+ });+ useEffect(() => {+ const onKeyDown = (event: KeyboardEvent) => {+ if (event.defaultPrevented || event.repeat || isImeComposing(event)) return;+ if (isEditableShortcutTarget(event.target)) return;+ if (isPortalLayerShortcutTarget(event.target)) return;+ if (useModalStore.getState().modal) return;+ if (!shortcutMatchesEvent(getShortcut("archiveInboxItem"), event)) return;+ const run = archiveRef.current;+ if (!run) return;+ event.preventDefault();+ run();+ };+ document.addEventListener("keydown", onKeyDown);+ return () => document.removeEventListener("keydown", onKeyDown);+ }, []);++ if (!item) return null;+ const unread = item.read !== true;++ return (+ <>+ {unread ? (+ <IconButton+ label={t(($) => $.context_menu.mark_read)}+ tooltipSide="bottom"+ className="text-muted-foreground"+ onClick={() => markRead.mutate(item.id, { onError: failed(t(($) => $.errors.mark_read_failed)) })}+ >+ <Check />+ </IconButton>+ ) : (+ <IconButton+ label={t(($) => $.context_menu.mark_unread)}+ tooltipSide="bottom"+ className="text-muted-foreground"+ onClick={() => markUnread.mutate(item.id, { onError: failed(t(($) => $.errors.mark_unread_failed)) })}+ >+ <CircleDot />+ </IconButton>+ )}+ {onMarkDone && (+ <IconButton+ label={tIssues(($) => $.detail.mark_done_tooltip)}+ tooltipSide="bottom"+ className="text-muted-foreground"+ onClick={markDone}+ >+ <CircleCheck />+ </IconButton>+ )}+ <IconButton+ label={t(($) => $.context_menu.archive)}+ shortcut={<ActionShortcutKeycaps action="archiveInboxItem" />}+ tooltipSide="bottom"+ className="text-muted-foreground"+ onClick={archiveItem}+ >+ <Archive />+ </IconButton>+ <span aria-hidden className="mx-1 h-4 w-px shrink-0 bg-border" />+ </>+ );+}diff --git a/packages/views/issues/components/issue-detail-route.test.tsx b/packages/views/issues/components/issue-detail-route.test.tsxindex 97a32b925e..e478b0aa61 100644--- a/packages/views/issues/components/issue-detail-route.test.tsx+++ b/packages/views/issues/components/issue-detail-route.test.tsx@@ -10,6 +10,7 @@ import type { NavigationAdapter } from "../../navigation";import { IssueDetail, IssueDetailSkeleton } from "./issue-detail";import {IssueDetailRoute,+ parseAppRequestHighlightHash,parseCommentHighlightHash,useCanonicalIssueUrl,} from "./issue-detail-route";@@ -147,6 +148,16 @@ describe("parseCommentHighlightHash", () => {});});+describe("parseAppRequestHighlightHash", () => {+ it.each([+ ["#app-request-01a02814-f098-7309-8286-0b249c66884d", "01a02814-f098-7309-8286-0b249c66884d"],+ ["#comment-c1", undefined],+ ["#app-request-", undefined],+ ])("maps %s to %s", (hash, expected) => {+ expect(parseAppRequestHighlightHash(hash)).toBe(expected);+ });+});+describe("IssueDetailRoute with an identifier that names no issue", () => {// Regression: the route used to fall through to IssueDetail with the raw// identifier. IssueDetail mounted a second observer on the query that haddiff --git a/packages/views/issues/components/issue-detail-route.tsx b/packages/views/issues/components/issue-detail-route.tsxindex 91572e4839..a54e5be071 100644--- a/packages/views/issues/components/issue-detail-route.tsx+++ b/packages/views/issues/components/issue-detail-route.tsx@@ -4,6 +4,7 @@ import { useCallback, useEffect, useRef } from "react";import { useCanonicalIssue } from "@multica/core/issues/canonical-id";import { useWorkspaceId } from "@multica/core/hooks";import { useWorkspacePaths } from "@multica/core/paths";+import { useInboxSelectionStore } from "@multica/core/inbox/selection-store";import { useNavigation } from "../../navigation";import { IssueDetail, IssueDetailSkeleton, IssueNotFound, IssueLoadError } from "./issue-detail";import { IssuePeekHost } from "./issue-peek";@@ -61,10 +62,16 @@ export function parseCommentHighlightHash(hash: string): string | undefined {return match?.[1];}-function useCommentHighlightHash(): { hash: string; commentId?: string } {+/** `#app-request-<id>`: an app's confirmation request on the issue, as a notification links it. */+export function parseAppRequestHighlightHash(hash: string): string | undefined {+ const match = /^#app-request-([A-Za-z0-9_-]+)$/.exec(hash);+ return match?.[1];+}++function useHighlightHash(): { hash: string; commentId?: string; appRequestId?: string } {const { hash } = useNavigation();- return { hash, commentId: parseCommentHighlightHash(hash) };+ return { hash, commentId: parseCommentHighlightHash(hash), appRequestId: parseAppRequestHighlightHash(hash) };}/**@@ -83,7 +90,10 @@ export function IssueDetailRoute({ routeId, onDelete, deliverable }: IssueDetailconst {canonicalId, issue, isResolving, notFound, loadFailed, isRetrying, retry, hasLoaded,} = useCanonicalIssue(wsId, routeId);- const highlight = useCommentHighlightHash();+ const highlight = useHighlightHash();+ const landingToken = useInboxSelectionStore((s) =>+ s.landing && s.landing.issueId === canonicalId ? s.landing.token : 0,+ );const paths = useWorkspacePaths();const navigation = useNavigation();@@ -122,6 +132,8 @@ export function IssueDetailRoute({ routeId, onDelete, deliverable }: IssueDetailskipInitialRefetch={hasLoaded}onDelete={onDelete}highlightCommentId={highlight.commentId}+ highlightAppRequestId={highlight.appRequestId}+ highlightRequestToken={landingToken}openDeliverable={deliverable}onDeliverableLinkDone={deliverable ? onDeliverableLinkDone : undefined}/>diff --git a/packages/views/issues/components/issue-detail.tsx b/packages/views/issues/components/issue-detail.tsxindex 80de2819e9..d46caad1ce 100644--- a/packages/views/issues/components/issue-detail.tsx+++ b/packages/views/issues/components/issue-detail.tsx@@ -98,7 +98,7 @@ import { AssigneePicker } from "./pickers/assignee-picker";import { LabelPicker } from "./pickers/label-picker";import { CustomPropertyValueEditor, CustomPropertyValueDisplay } from "./pickers/custom-property-picker";import { Switch } from "@multica/ui/components/ui/switch";-import { IssueActionsDropdown, useIssuePageMenu, useIssueActions, useArchivedInboxItemId, IssueActionsContextMenu, IssueContextMenuProvider } from "../actions";+import { IssueActionsDropdown, useIssuePageMenu, useIssueActions, useArchivedInboxItemId, IssueActionsContextMenu, IssueContextMenuProvider, IssueInboxActions } from "../actions";import { LabelChip } from "../../labels/label-chip";import { IssueAgentActivityIndicator } from "./issue-agent-activity-indicator";import { SubIssuesAgentWorkingChip } from "./sub-issues-agent-working-chip";@@ -1228,10 +1228,9 @@ interface IssueDetailProps {/*** Bump to replay the `highlightCommentId` landing on an already-mounted* detail. A remount replays it by itself (fresh mount, cleared memento- * entry); this token is for the one path with neither remount nor- * guaranteed re-render — re-clicking the notification row that is already- * open (see InboxPage.handleSelect). The bump both re-arms the landing- * guard and forces the render that re-reads the cleared memento entry.+ * entry); this token is for a host that asks again with neither remount+ * nor guaranteed re-render. The bump both re-arms the landing guard and+ * forces the render that re-reads the cleared memento entry.*/highlightRequestToken?: number;/** The app confirmation an Inbox notification points at; its card scrolls@@ -3539,6 +3538,16 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = trIt self-hides when no agent is active. */}<IssueAgentHeaderChip issueId={id} onJumpToRun={jumpToRun} /><IssueWakeupHeaderChip issueId={id} onOpen={openWakeups} />+ {!onDone && !isPeek && (+ <IssueInboxActions+ issueId={id}+ onMarkDone={+ issueBehavesAsAny(issue, ["done", "closed"])+ ? undefined+ : (onSaved) => handleUpdateField({ status: "done" }, { onSuccess: onSaved })+ }+ />+ )}{onDone && !issueBehavesAsAny(issue, ["done", "closed"]) && (<IconButtonlabel={t(($) => $.detail.mark_done_tooltip)}diff --git a/packages/views/issues/components/issues-header.tsx b/packages/views/issues/components/issues-header.tsxindex b2453c0bbf..e427718db4 100644--- a/packages/views/issues/components/issues-header.tsx+++ b/packages/views/issues/components/issues-header.tsx@@ -1149,6 +1149,7 @@ export function IssueFilterMenu({viewBaseline,) > 0;const fixedTitle = viewBaseline ? t(($) => $.filters.in_view) : undefined;+ const relationsFixed = (viewBaseline?.relation.size ?? 0) > 0;const { chips: allChips } = useFilterChips(showDateFilter ? dateFilter : null, onDateFilterChange, viewBaseline);const chips = showRelation ? allChips : allChips.filter((chip) => chip.key !== "relation");const chipByKey = new Map(chips.map((chip) => [chip.key, chip]));@@ -1435,10 +1436,12 @@ export function IssueFilterMenu({{triggerValue("relation")}</DropdownMenuSubTrigger><DropdownMenuSubContent className="w-auto min-w-52">- <FilterOperatorSwitch dimension="relation" />+ {/* A view defined by relations owns the whole dimension:+ another value would widen it, not narrow it. */}+ {!relationsFixed && <FilterOperatorSwitch dimension="relation" />}{ISSUE_RELATION_FILTERS.map((relation) => {const checked = relationFilters.includes(relation);- const fixed = viewBaseline?.relation.has(relation) === true;+ const fixed = relationsFixed;const Icon = RELATION_ICONS[relation];return (<DropdownMenuCheckboxItem@@ -1629,6 +1632,7 @@ export function IssueFilterMenu({if (!viewBaseline) return false;if (value === "none" && field === "assignee") return viewBaseline.includeNoAssignee;if (value === "none" && field === "project") return viewBaseline.includeNoProject;+ if (field === "relation" && relationsFixed) return true;return viewBaseline[field].has(value);};const sectionKeys = [diff --git a/packages/views/issues/surface/issue-surface.test.tsx b/packages/views/issues/surface/issue-surface.test.tsxindex 79c6355065..b507a036bb 100644--- a/packages/views/issues/surface/issue-surface.test.tsx+++ b/packages/views/issues/surface/issue-surface.test.tsx@@ -29,7 +29,6 @@ import { IssueSurface, IssueSurfaceWithStore } from "./issue-surface";import { createIssueStatusListStore } from "@multica/core/issue-statuses";import { baselineFromQuery } from "@multica/core/issue-views/baseline";import { useActiveIssueViewStore } from "@multica/core/issue-views/active-view-store";-import { UNREAD_VIEW_ID } from "@multica/core/issue-views/unread-view";import { setCurrentWorkspace } from "@multica/core/platform";import { statusTableMethodsFromLegacy } from "./status-table-test-api";@@ -788,6 +787,7 @@ describe("IssueSurface — filtered empty state", () => {getWorkspaceWorkingAgents: vi.fn(() => Promise.resolve([])),getChildIssueProgress: vi.fn(() => never()),listIssueUnread: vi.fn(() => Promise.resolve([])),+ listSubscribedIssueIds: vi.fn(() => Promise.resolve([])),listIssueViews: vi.fn(() => Promise.resolve([])),} as unknown as ApiClient);pruneIssueSurfaceViewStates([]);@@ -850,8 +850,8 @@ describe("IssueSurface — filtered empty state", () => {expect(screen.queryByText("filtered_empty.title")).toBeNull();});- function unreadViewSurface() {- useActiveIssueViewStore.getState().setActive("ws-1:workspace", UNREAD_VIEW_ID);+ function subscribedViewSurface() {+ useActiveIssueViewStore.getState().setActive("ws-1:workspace", "subscribed");return (<QueryClientProvider client={qc}><IssueSurface@@ -864,42 +864,23 @@ describe("IssueSurface — filtered empty state", () => {);}- it("keeps the built-in Unread view's condition when its filters are cleared", async () => {- const store = getIssueSurfaceViewStore(`view:${UNREAD_VIEW_ID}`);- act(() => store.setState({ unreadFilter: true, agentRunningFilter: true }));+ it("keeps a built-in view's condition when its filters are cleared", async () => {+ const store = getIssueSurfaceViewStore("view:subscribed");+ act(() => store.setState({ relationFilters: ["subscribed"], agentRunningFilter: true }));- render(unreadViewSurface());+ render(subscribedViewSurface());fireEvent.click(await screen.findByRole("button", { name: "filtered_empty.clear_button" }));expect(store.getState().agentRunningFilter).toBe(false);- expect(store.getState().unreadFilter).toBe(true);- await screen.findByText("filtered_empty.unread_title");+ expect(store.getState().relationFilters).toEqual(["subscribed"]);+ await screen.findByText("filtered_empty.title");expect(screen.queryByRole("button", { name: "filtered_empty.clear_button" })).toBeNull();});it.each(["created_at", "updated_at"] as const)(- "offers recovery for an empty Unread view narrowed only by %s",+ "clears %s with other user filters while preserving the built-in view's condition and display",async (field) => {- const store = getIssueSurfaceViewStore(`view:${UNREAD_VIEW_ID}`);- act(() => store.getState().setDateFilter({ field, from: "2026-01-01", to: "2026-01-02" }));-- render(unreadViewSurface());-- await screen.findByText("filtered_empty.title");- expect(screen.queryByText("filtered_empty.unread_title")).toBeNull();- fireEvent.click(screen.getByRole("button", { name: "filtered_empty.clear_button" }));-- expect(store.getState().dateFilter).toBeNull();- expect(store.getState().unreadFilter).toBe(true);- await screen.findByText("filtered_empty.unread_title");- expect(screen.queryByRole("button", { name: "filtered_empty.clear_button" })).toBeNull();- },- );-- it.each(["created_at", "updated_at"] as const)(- "clears %s with other user filters while preserving Unread and display settings",- async (field) => {- const store = getIssueSurfaceViewStore(`view:${UNREAD_VIEW_ID}`);+ const store = getIssueSurfaceViewStore("view:subscribed");act(() => store.setState({dateFilter: { field, from: "2026-01-01", to: "2026-01-02" },priorityFilters: ["high"],@@ -909,7 +890,7 @@ describe("IssueSurface — filtered empty state", () => {showSubIssues: false,}));- render(unreadViewSurface());+ render(subscribedViewSurface());fireEvent.click(await screen.findByRole("button", { name: "filtered_empty.clear_button" }));@@ -917,16 +898,18 @@ describe("IssueSurface — filtered empty state", () => {dateFilter: null,priorityFilters: [],agentRunningFilter: false,- unreadFilter: true,+ relationFilters: ["subscribed"],sortBy: "title",sortDirection: "asc",showSubIssues: false,});- await screen.findByText("filtered_empty.unread_title");+ await waitFor(() =>+ expect(screen.queryByRole("button", { name: "filtered_empty.clear_button" })).toBeNull(),+ );},);- it("clears a date interval on an ordinary surface without adding Unread", async () => {+ it("clears a date interval on an ordinary surface without adding a relation", async () => {const store = getIssueSurfaceViewStore("project:pf");act(() => store.getState().setDateFilter({ field: "created_at", from: "2026-01-01", to: "2026-01-02" }));@@ -935,36 +918,85 @@ describe("IssueSurface — filtered empty state", () => {fireEvent.click(await screen.findByRole("button", { name: "filtered_empty.clear_button" }));expect(store.getState().dateFilter).toBeNull();- expect(store.getState().unreadFilter).toBe(false);+ expect(store.getState().relationFilters).toEqual([]);await screen.findByText("detail.empty_issues_title");});- it("keeps the built-in Unread view's condition when a workspace switch reloads its state", async () => {+ it("keeps a built-in view's condition when a workspace switch reloads its state", async () => {setCurrentWorkspace("acme", "ws-1");- const store = getIssueSurfaceViewStore(`view:${UNREAD_VIEW_ID}`);- render(unreadViewSurface());- await screen.findByText("filtered_empty.unread_title");+ const store = getIssueSurfaceViewStore("view:subscribed");+ render(subscribedViewSurface());+ await screen.findByText("filtered_empty.title");// The next workspace has no saved state for this view, so the reload- // resets the store to defaults, unread off.+ // resets the store to defaults, without the relation.await act(async () => {setCurrentWorkspace("beta", "ws-1");await new Promise((resolve) => setTimeout(resolve, 20));});- expect(store.getState().unreadFilter).toBe(true);- expect(screen.getByText("filtered_empty.unread_title")).toBeInTheDocument();+ expect(store.getState().relationFilters).toEqual(["subscribed"]);setCurrentWorkspace(null, null);});- it("restores the built-in Unread view's condition from state saved without it", async () => {- const store = getIssueSurfaceViewStore(`view:${UNREAD_VIEW_ID}`);- act(() => store.setState({ unreadFilter: false }));+ it("restores a built-in view's condition from state saved without it, and un-negates it", async () => {+ const store = getIssueSurfaceViewStore("view:subscribed");+ act(() => store.setState({ relationFilters: [], negatedFilters: ["relation"] }));++ render(subscribedViewSurface());++ await screen.findByText("filtered_empty.title");+ expect(store.getState().relationFilters).toEqual(["subscribed"]);+ expect(store.getState().negatedFilters).toEqual([]);+ });++ it("keeps a built-in view to exactly its relations: another one would widen it", async () => {+ const store = getIssueSurfaceViewStore("view:subscribed");+ render(subscribedViewSurface());+ await screen.findByText("filtered_empty.title");++ act(() => store.getState().toggleRelationFilter("assigned"));++ expect(store.getState().relationFilters).toEqual(["subscribed"]);+ });++ it("keeps Working to running agents: adding idle would list every issue", async () => {+ const store = getIssueSurfaceViewStore("view:working");+ useActiveIssueViewStore.getState().setActive("ws-1:workspace", "working");+ render(+ <QueryClientProvider client={qc}>+ <IssueSurface+ scope={{ type: "workspace", actorKind: "all" }}+ modes={["list"]}+ renderHeader={() => null}+ batchToolbar="never"+ />+ </QueryClientProvider>,+ );+ await waitFor(() => expect(store.getState().agentRunningFilter).toBe(true));++ act(() => store.setState({ agentIdleFilter: true }));++ expect(store.getState()).toMatchObject({ agentRunningFilter: true, agentIdleFilter: false });+ });++ it("puts back the agent filter Working is defined by", async () => {+ const store = getIssueSurfaceViewStore("view:working");+ act(() => store.setState({ agentRunningFilter: false, agentIdleFilter: true }));+ useActiveIssueViewStore.getState().setActive("ws-1:workspace", "working");- render(unreadViewSurface());+ render(+ <QueryClientProvider client={qc}>+ <IssueSurface+ scope={{ type: "workspace", actorKind: "all" }}+ modes={["list"]}+ renderHeader={() => null}+ batchToolbar="never"+ />+ </QueryClientProvider>,+ );- await screen.findByText("filtered_empty.unread_title");- expect(store.getState().unreadFilter).toBe(true);+ await waitFor(() => expect(store.getState()).toMatchObject({ agentRunningFilter: true, agentIdleFilter: false }));});});diff --git a/packages/views/issues/surface/issue-surface.tsx b/packages/views/issues/surface/issue-surface.tsxindex 8258275d6d..289b299848 100644--- a/packages/views/issues/surface/issue-surface.tsx+++ b/packages/views/issues/surface/issue-surface.tsx@@ -21,7 +21,7 @@ import {seedIssueSurfaceViewState,} from "@multica/core/issues/stores/surface-view-store";import { useActiveIssueView } from "@multica/core/issue-views/use-active-view";-import { UNREAD_VIEW_BASELINE, isUnreadView } from "@multica/core/issue-views/unread-view";+import { filteredBuiltinBaseline } from "@multica/core/issue-views/builtin-issue-views";import {issueViewDefinitionFromState,issueViewSeedDefinition,@@ -133,7 +133,7 @@ export function IssueSurface({: activeView && scope.type === "my"? { ...scope, relation: myRelationForViewVariant(activeView.scope_variant) }: scope;- const viewBaseline = isUnreadView(activeView) ? UNREAD_VIEW_BASELINE : null;+ const viewBaseline = filteredBuiltinBaseline(activeView);const store = useMemo(() => {// First-open seeding happens HERE, at store-creation time for this key:// no React component has subscribed to the new key's store yet, so the@@ -143,7 +143,7 @@ export function IssueSurface({seedIssueSurfaceViewState(resolvedSurfaceKey, seedDefinition);}const viewStore = getIssueSurfaceViewStore(resolvedSurfaceKey);- if (viewBaseline?.unread) keepUnreadFilter(viewStore);+ if (viewBaseline) keepFixedFilters(viewStore, viewBaseline);return viewStore;// eslint-disable-next-line react-hooks/exhaustive-deps -- seed identity follows the key}, [resolvedSurfaceKey]);@@ -151,9 +151,9 @@ export function IssueSurface({// a workspace switch reloads it from that workspace's preferences, which may// never have held the condition. Re-apply it whenever it goes missing.useEffect(() => {- if (!viewBaseline?.unread) return;- keepUnreadFilter(store);- return store.subscribe(() => keepUnreadFilter(store));+ if (!viewBaseline) return;+ keepFixedFilters(store, viewBaseline);+ return store.subscribe(() => keepFixedFilters(store, viewBaseline));}, [store, viewBaseline]);// Every change of this key tears down and remounts the ENTIRE surface@@ -202,8 +202,30 @@ export function IssueSurface({);}-function keepUnreadFilter(store: StoreApi<IssueViewState>) {- if (!store.getState().unreadFilter) store.setState({ unreadFilter: true });+/**+ * Holds a built-in view to its condition: exactly the relations and agent+ * filter it is defined by. Other dimensions narrow it; these would widen it,+ * since a dimension's values are ORed (Subscribed + Assigned is "subscribed+ * or assigned").+ */+function keepFixedFilters(store: StoreApi<IssueViewState>, baseline: IssueViewBaseline) {+ const state = store.getState();+ const patch: Partial<IssueViewState> = {};+ if (baseline.agentRunning && (!state.agentRunningFilter || state.agentIdleFilter)) {+ Object.assign(patch, { agentRunningFilter: true, agentIdleFilter: false });+ }+ const relations = baseline.raw.relationFilters;+ if (+ relations.length > 0 &&+ (relations.length !== state.relationFilters.length ||+ relations.some((relation) => !state.relationFilters.includes(relation)))+ ) {+ patch.relationFilters = [...relations];+ }+ if (relations.length > 0 && state.negatedFilters.includes("relation")) {+ patch.negatedFilters = state.negatedFilters.filter((dimension) => dimension !== "relation");+ }+ if (Object.keys(patch).length > 0) store.setState(patch);}function IssueSurfaceContent({diff --git a/packages/views/layout/app-rail.test.tsx b/packages/views/layout/app-rail.test.tsxindex 3e55e5d0c7..9b8e8f1d9e 100644--- a/packages/views/layout/app-rail.test.tsx+++ b/packages/views/layout/app-rail.test.tsx@@ -3,6 +3,10 @@ import { act, fireEvent, screen, waitFor, within } from "@testing-library/react"import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { useRailOrderStore } from "@multica/core/navigation";+import {+ DEFAULT_SIDEBAR_INBOX_SETTINGS,+ useSidebarTreeStore,+} from "@multica/core/issues/stores/sidebar-tree-store";import { SidebarProvider, useSidebar } from "@multica/ui/components/ui/sidebar";import { renderWithI18n } from "../test/i18n";import { AppRail } from "./app-rail";@@ -128,6 +132,7 @@ beforeEach(() => {state.chat = { activeSessionId: null, isOpen: false };state.stuck = [];useRailOrderStore.setState({ order: null });+ useSidebarTreeStore.setState({ inboxSettings: DEFAULT_SIDEBAR_INBOX_SETTINGS });});const railOrder = () =>@@ -150,11 +155,11 @@ describe("AppRail global actions", () => {describe("AppRail order", () => {it("lists the spaces in the default order", () => {renderRail();- expect(railOrder()).toEqual(["inbox", "work", "team", "chat", "autopilots"]);+ expect(railOrder()).toEqual(["work", "team", "chat", "autopilots"]);});it("follows the saved order", () => {- const order = ["chat", "inbox", "work", "team", "autopilots"] as const;+ const order = ["chat", "work", "team", "autopilots"] as const;useRailOrderStore.getState().setOrder(order);renderRail();expect(railOrder()).toEqual(order);@@ -182,7 +187,7 @@ describe("AppRail spaces", () => {state.pathname = "/acme/projects/p-1";renderRail();- for (const href of ["/acme/inbox", "/acme/issues", "/acme/agents", "/acme/chat", "/acme/autopilots"]) {+ for (const href of ["/acme/issues", "/acme/agents", "/acme/chat", "/acme/autopilots"]) {expect(link(href)).not.toBeNull();}// Projects belong to the work space, which links to Issues.@@ -190,6 +195,13 @@ describe("AppRail spaces", () => {expect(link("/acme/agents")).not.toHaveAttribute("aria-current");});+ it("has no Inbox space: the full Inbox lights Work", () => {+ state.pathname = "/acme/inbox";+ renderRail();+ expect(document.querySelector('a[data-space="inbox"]')).toBeNull();+ expect(document.querySelector('a[data-space="work"]')).toHaveAttribute("aria-current", "page");+ });+it("marks Settings in the footer while on a settings route", () => {state.pathname = "/acme/settings";renderRail();@@ -217,15 +229,15 @@ describe("AppRail label disclosure", () => {it("names a space whose label is cut off even when it is already the full name", async () => {renderRail();- const inbox = link("/acme/inbox")!;- clipLabel(within(inbox).getByText("Inbox"));- await act(async () => inbox.focus());- expect(tooltip()).toHaveTextContent("Inbox");+ const chat = link("/acme/chat")!;+ clipLabel(within(chat).getByText("Chat"));+ await act(async () => chat.focus());+ expect(tooltip()).toHaveTextContent("Chat");});it("stays quiet when the full-name label fits", async () => {renderRail();- await act(async () => link("/acme/inbox")!.focus());+ await act(async () => link("/acme/chat")!.focus());expect(tooltip()).toBeNull();});});@@ -241,56 +253,71 @@ function inboxItem(issueId: string, archived = false): InboxItem {}// Read by space: an href query string trips the attribute-selector lookup.-const inboxHref = () => document.querySelector('a[data-space="inbox"]')?.getAttribute("href");+const workHref = () => document.querySelector('a[data-space="work"]')?.getAttribute("href");describe("AppRail inbox return", () => {- it("returns to the notification last opened while it is still in the inbox", () => {+ it("returns Work to the notification last opened while it is still in the inbox", () => {state.inboxItems = [inboxItem("issue-x")];const { visit } = renderRail();visit("/acme/inbox", "issue=issue-x");- visit("/acme/issues/issue-x");- expect(inboxHref()).toBe("/acme/inbox?issue=issue-x");+ visit("/acme/agents");+ expect(workHref()).toBe("/acme/inbox?issue=issue-x");});// Regression: the inbox page replaces an unknown ?issue= with the issue// itself, so a remembered selection that was archived since turned the- // Inbox item into a flash back to the issue on every click.+ // rail item into a flash back to the issue on every click.it("drops a remembered notification that has left the inbox", async () => {state.inboxItems = [inboxItem("issue-x")];const { client, visit } = renderRail();visit("/acme/inbox", "issue=issue-x");- visit("/acme/issues/issue-x");+ visit("/acme/agents");act(() => {client.setQueryData(["inbox", "ws-1", "list"], [inboxItem("issue-x", true), inboxItem("issue-y")]);});- await waitFor(() => expect(inboxHref()).toBe("/acme/inbox"));+ await waitFor(() => expect(workHref()).toBe("/acme/inbox"));});it("leaves the selection to the inbox page when its list is not cached", () => {const { visit } = renderRail();visit("/acme/inbox", "issue=issue-x");- visit("/acme/issues/issue-x");- expect(inboxHref()).toBe("/acme/inbox?issue=issue-x");+ visit("/acme/agents");+ expect(workHref()).toBe("/acme/inbox?issue=issue-x");});it("keeps an archived-view selection, which resolves against its own list", () => {state.inboxItems = [];const { visit } = renderRail();visit("/acme/inbox", "view=archived&issue=issue-x");- visit("/acme/issues/issue-x");- expect(inboxHref()).toBe("/acme/inbox?view=archived&issue=issue-x");+ visit("/acme/agents");+ expect(workHref()).toBe("/acme/inbox?view=archived&issue=issue-x");+ });++ it("leaves other Work pages alone", () => {+ state.inboxItems = [];+ const { visit } = renderRail();+ visit("/acme/issues", "issue=issue-x");+ visit("/acme/agents");+ expect(workHref()).toBe("/acme/issues?issue=issue-x");});});describe("AppRail badges", () => {- it("counts inbox unread with a static counter", () => {+ it("counts inbox unread on Work with a static counter", () => {state.inboxUnread = 4;renderRail();- const badge = countBadge("/acme/inbox") as (HTMLElement & { animated?: boolean }) | null;+ const badge = countBadge("/acme/issues") as (HTMLElement & { animated?: boolean }) | null;expect(badge).toHaveAttribute("aria-label", "4");expect(badge?.animated).toBe(false);});+ it("leaves Work unbadged when the Inbox settings turn the badge off", () => {+ state.inboxUnread = 4;+ useSidebarTreeStore.setState({ inboxSettings: { ...DEFAULT_SIDEBAR_INBOX_SETTINGS, railBadge: false } });+ renderRail();+ expect(countBadge("/acme/issues")).toBeNull();+ });+it("shows no attention dot when nothing needs a look", () => {renderRail();expect(link("/acme/agents")?.querySelector(".bg-warning")).toBeNull();@@ -385,9 +412,9 @@ describe("AppRail panel peek", () => {});expect(peek).toBe("team");- // Inbox and Chat keep their lists in their pages but still preview.- hover("/acme/inbox");- expect(peek).toBe("inbox");+ // Chat keeps its list in its page but still previews.+ hover("/acme/chat");+ expect(peek).toBe("chat");});});diff --git a/packages/views/layout/app-rail.tsx b/packages/views/layout/app-rail.tsxindex 90d5b1c7fa..4676ee28f4 100644--- a/packages/views/layout/app-rail.tsx+++ b/packages/views/layout/app-rail.tsx@@ -24,6 +24,7 @@ import {useInboxUnreadCount,} from "@multica/core/inbox/queries";import { useMarkAllInboxRead } from "@multica/core/inbox/mutations";+import { useSidebarTreeStore } from "@multica/core/issues/stores/sidebar-tree-store";import { resolveRailOrder, useRailOrderStore } from "@multica/core/navigation";import {RAIL_SPACES,@@ -63,15 +64,18 @@ type RailBadge =| { kind: "dot" };/**- * Rail badges. Inbox and Chat count unread; Team only flags that something- * needs a look — the panel says what. A dot must be something the user can- * clear, so a failed autopilot run is shown in the Autopilots panel only.+ * Rail badges. Work counts unread notifications (its panel heads with the+ * Inbox) unless the Inbox settings turn that off, and Chat counts unread+ * messages; Team only flags that something needs a look — the panel says+ * what. A dot must be something the user can clear, so a failed autopilot run+ * is shown in the Autopilots panel only.*/function useRailBadges(): Partial<Record<RailSpaceId, RailBadge>> {const wsId = useCurrentWorkspace()?.id;const p = useWorkspacePaths();const { pathname } = useNavigation();const inboxUnread = useInboxUnreadCount(wsId);+ const inboxBadge = useSidebarTreeStore((s) => s.inboxSettings.railBadge);const { data: chatSessions = [] } = useQuery({...chatSessionsOptions(wsId ?? ""),@@ -98,7 +102,7 @@ function useRailBadges(): Partial<Record<RailSpaceId, RailBadge>> {const { stuck } = useTeamAgentStatus(wsId);const badges: Partial<Record<RailSpaceId, RailBadge>> = {};- if (inboxUnread > 0) badges.inbox = { kind: "count", value: inboxUnread, tone: "brand" };+ if (inboxBadge && inboxUnread > 0) badges.work = { kind: "count", value: inboxUnread, tone: "brand" };if (chatUnread > 0) badges.chat = { kind: "count", value: chatUnread, tone: "neutral" };if (stuck.length > 0) badges.team = { kind: "dot" };return badges;@@ -132,18 +136,19 @@ function RailBadgeMark({ badge }: { badge: RailBadge }) {}/**- * The Inbox item returns to the last notification opened there. Once that- * notification has left the active list (archived here, on another device, or- * by the server), the Inbox page treats `?issue=` as a shared link and- * replaces itself with the issue, so the click looks like it did nothing.+ * Work can return to the Inbox page at the last notification opened there.+ * Once that notification has left the active list (archived here, on another+ * device, or by the server), the Inbox page treats `?issue=` as a shared link+ * and replaces itself with the issue, so the click looks like it did nothing.* Drop a selection the cached list no longer holds; with no cached list the* page still decides.*/function useInboxReturnHref(href: string, wsId: string | undefined): string {+ const p = useWorkspacePaths();const { data: items } = useQuery({ ...inboxListOptions(wsId ?? ""), enabled: false });return useMemo(() => {const queryAt = href.indexOf("?");- if (!items || queryAt < 0) return href;+ if (!items || queryAt < 0 || href.slice(0, queryAt) !== p.inbox()) return href;const params = new URLSearchParams(href.slice(queryAt + 1));const key = params.get("issue");if (!key || params.has("view")) return href;@@ -152,7 +157,7 @@ function useInboxReturnHref(href: string, wsId: string | undefined): string {const query = params.toString();const path = href.slice(0, queryAt);return query ? `${path}?${query}` : path;- }, [href, items]);+ }, [href, items, p]);}/** Hover previews of a collapsed nav. Mouse only: a touch tap navigates. */@@ -211,7 +216,7 @@ function RailSpaceLink({// bubble through it; a press inside the menu must not start a drag.const menu = rowMenu.menu.point && (<span className="contents" onPointerDown={(event) => event.stopPropagation()}>- <RailSpaceMenu space={space} href={href} title={fullLabel} unread={badge?.kind === "count" ? badge.value : 0} state={rowMenu} />+ <RailSpaceMenu space={space} href={href} title={fullLabel} state={rowMenu} /></span>);// A label the same as the full name still needs the tooltip whenever a@@ -241,13 +246,11 @@ function RailSpaceMenu({space,href,title,- unread,state,}: {space: RailSpaceId;href: string;title: string;- unread: number;state: ReturnType<typeof useRowMenu>;}) {const { t } = useT("layout");@@ -258,6 +261,7 @@ function RailSpaceMenu({if (await copyText(getShareableUrl(href))) toast.success(t(($) => $.rail.link_copied));};const markAllRead = useMarkAllInboxRead();+ const inboxUnread = useInboxUnreadCount(useCurrentWorkspace()?.id);const customOrder = useRailOrderStore((s) => s.order !== null);const setOrder = useRailOrderStore((s) => s.setOrder);return (@@ -271,7 +275,7 @@ function RailSpaceMenu({<Link2 />{t(($) => $.rail.copy_link)}</DropdownMenuItem>- {space === "inbox" && unread > 0 && (+ {space === "work" && inboxUnread > 0 && (<><DropdownMenuSeparator /><DropdownMenuItem@@ -314,7 +318,7 @@ function SortableRailItem({ id, children }: { id: RailSpaceId; children: React.Rconst DRAG_MODIFIERS = [restrictToVerticalAxis, restrictToFirstScrollableAncestor];/**- * The app rail: workspaces, New issue and search, the five spaces in the+ * The app rail: workspaces, New issue and search, the four spaces in the* user's order (drag to reorder), then help, settings and the account. It* sits on the app shell, outside the content card, and stays put while the* panel beside it collapses. Desktop passes `globalActions={false}`: its@@ -335,7 +339,7 @@ export function AppRail({const badges = useRailBadges();const space = shell?.space ?? null;const wsId = useCurrentWorkspace()?.id;- const inboxHref = useInboxReturnHref(shell?.spaceHref("inbox", p.inbox()) ?? p.inbox(), wsId);+ const workHref = useInboxReturnHref(shell?.spaceHref("work", p.issues()) ?? p.issues(), wsId);const settingsPeek = usePeekHandlers("settings", space === "settings");const savedOrder = useRailOrderStore((s) => s.order);const setOrder = useRailOrderStore((s) => s.setOrder);@@ -356,12 +360,6 @@ export function AppRail({);const items: Record<RailSpaceId, { href: string; icon: IconComponent; label: string; fullLabel: string }> = {- inbox: {- href: p.inbox(),- icon: routeIconForPath(p.inbox()),- label: t(($) => $.rail.inbox),- fullLabel: t(($) => $.nav.inbox),- },work: {href: p.issues(),icon: routeIconForPath(p.issues()),@@ -427,7 +425,7 @@ export function AppRail({<RailSpaceLinkspace={id}{...items[id]}- href={id === "inbox" ? inboxHref : (shell?.spaceHref(id, items[id].href) ?? items[id].href)}+ href={id === "work" ? workHref : (shell?.spaceHref(id, items[id].href) ?? items[id].href)}active={space === id}badge={badges[id]}/>diff --git a/packages/views/layout/app-shell-context.test.tsx b/packages/views/layout/app-shell-context.test.tsxindex 37352244bf..fd07f31560 100644--- a/packages/views/layout/app-shell-context.test.tsx+++ b/packages/views/layout/app-shell-context.test.tsx@@ -74,7 +74,7 @@ describe("AppShellProvider", () => {["/acme/my-issues", "work", true],["/acme/squads/s-1", "team", true],["/acme/autopilots", "autopilots", true],- ["/acme/inbox", "inbox", false],+ ["/acme/inbox", "work", true],["/acme/chat", "chat", false],["/acme/settings", "settings", false],["/acme/attachments/a-1", null, false],@@ -145,7 +145,7 @@ describe("AppShellProvider", () => {act(() => shell!.toggleNav());expect(sidebarState).toBe("collapsed");- visit("/acme/inbox");+ visit("/acme/chat");expect(listColumnCollapsed).toBe(true);act(() => shell!.toggleNav());@@ -155,7 +155,7 @@ describe("AppShellProvider", () => {});it("collapses a list column the md–lg auto-collapse left open", () => {- navigation.pathname = "/acme/inbox";+ navigation.pathname = "/acme/chat";renderNavShell();act(() => setSidebarOpen!(false));expect(listColumnCollapsed).toBe(false);@@ -185,7 +185,7 @@ describe("AppShellProvider", () => {expect(shell!.spaceHref("team", "/acme/agents")).toBe("/acme/agents");// Memory is per workspace.- visit("/beta/inbox");+ visit("/beta/chat");expect(shell!.spaceHref("work", "/beta/issues")).toBe("/beta/issues");});@@ -197,17 +197,17 @@ describe("AppShellProvider", () => {);const { rerender } = render(shellAt("/acme/issues"));- // Leaving Work for Inbox: the issues page is still mounted, so it keeps- // its panel until the inbox page commits.- navigation.pathname = "/acme/inbox";+ // Leaving Work for Chat: the issues page is still mounted, so it keeps+ // its panel until the chat page commits.+ navigation.pathname = "/acme/chat";rerender(shellAt("/acme/issues"));expect(shell!.space).toBe("work");expect(shell!.hasPanel).toBe(true);// Space memory follows the navigation, not the lagging page.- expect(shell!.spaceHref("inbox", "/acme/inbox")).toBe("/acme/inbox");+ expect(shell!.spaceHref("chat", "/acme/chat")).toBe("/acme/chat");- rerender(shellAt("/acme/inbox"));- expect(shell!.space).toBe("inbox");+ rerender(shellAt("/acme/chat"));+ expect(shell!.space).toBe("chat");expect(shell!.hasPanel).toBe(false);expect(shell!.spaceHref("work", "/acme/issues")).toBe("/acme/issues");});diff --git a/packages/views/layout/app-shell-context.tsx b/packages/views/layout/app-shell-context.tsxindex d9902078dd..82fe10baea 100644--- a/packages/views/layout/app-shell-context.tsx+++ b/packages/views/layout/app-shell-context.tsx@@ -6,8 +6,8 @@ import { useSidebarSafe } from "@multica/ui/components/ui/sidebar";import { useNavigation } from "../navigation";/**- * Spaces whose navigation lives in the shell panel. Inbox, Chat and Settings- * are list-and-detail pages that already render their own list column in the+ * Spaces whose navigation lives in the shell panel. Chat and Settings are+ * list-and-detail pages that already render their own list column in the* same card, so the shell adds no panel for them.*/export const PANEL_SPACES: ReadonlySet<AppSpaceId> = new Set(["work", "team", "autopilots"]);@@ -23,7 +23,7 @@ interface AppShellContextValue {/** The current space has a shell panel (collapsible with the sidebar toggle). */hasPanel: boolean;/**- * Inbox, Chat and Settings keep their own list column, which collapses with+ * Chat and Settings keep their own list column, which collapses with* the space panel. Tracked apart from the panel's open state so the md–lg* auto-collapse never hides a list the page needs.*/@@ -192,7 +192,7 @@ export function useAppShell(): AppShellContextValue | null {}/**- * Whether a list-and-detail page (Inbox, Chat, Settings) hides its list+ * Whether a list-and-detail page (Chat, Settings) hides its list* column. Below `md` those pages manage the list themselves.*/export function useListColumnCollapsed(): boolean {diff --git a/packages/views/layout/list-column.test.tsx b/packages/views/layout/list-column.test.tsxindex 58707be69b..5793a85087 100644--- a/packages/views/layout/list-column.test.tsx+++ b/packages/views/layout/list-column.test.tsx@@ -6,7 +6,7 @@ import { AppShellProvider, useAppShell } from "./app-shell-context";import { ListColumn } from "./list-column";vi.mock("../navigation", () => ({- useNavigation: () => ({ pathname: "/acme/inbox" }),+ useNavigation: () => ({ pathname: "/acme/chat" }),}));let shell: ReturnType<typeof useAppShell> = null;@@ -106,7 +106,7 @@ describe("ListColumn", () => {</SidebarProvider>,);const column = container.querySelector("[data-slot='list-column']");- act(() => shell!.requestPeek("inbox"));+ act(() => shell!.requestPeek("chat"));act(() => vi.advanceTimersByTime(200));expect(column).not.toHaveAttribute("inert");expect(column).toHaveClass("w-0");diff --git a/packages/views/layout/list-column.tsx b/packages/views/layout/list-column.tsxindex 4a61fa4f12..a6254b3334 100644--- a/packages/views/layout/list-column.tsx+++ b/packages/views/layout/list-column.tsx@@ -13,10 +13,10 @@ const WIDTH_CLASS: Record<PanelWidth, string> = {};/**- * The list column of a list-and-detail page (Inbox, Chat, Settings). It takes+ * The list column of a list-and-detail page (Chat, Settings). It takes* the space panel's resize edge and collapse motion. A `nav` column (Settings)* also takes the panel's width, so its divider stays put when switching- * spaces; a `list` column (Inbox, Chat) shares the wider list width instead,+ * spaces; a `list` column (Chat) shares the wider list width instead,* because its rows carry far more than the nav's labels. It stays mounted* while collapsed, keeping the list's scroll position.*/diff --git a/packages/views/layout/page-header.test.tsx b/packages/views/layout/page-header.test.tsxindex 741d27bf6a..bc3659c7ff 100644--- a/packages/views/layout/page-header.test.tsx+++ b/packages/views/layout/page-header.test.tsx@@ -184,10 +184,10 @@ describe("CollapsedNavTrigger in the app shell", () => {expect(trigger()).not.toHaveClass("md:hidden");});- // Inbox brings its own list column, so the panel's open state is not what+ // Chat brings its own list column, so the panel's open state is not what// the trigger reopens there; the collapsed list column is.it("follows the list column in spaces without a shell panel", () => {- const trigger = renderInShell("/acme/inbox");+ const trigger = renderInShell("/acme/chat");act(() => sidebar!.setOpen(false));expect(trigger()).toHaveClass("md:hidden");diff --git a/packages/views/layout/panels/inbox-section.test.tsx b/packages/views/layout/panels/inbox-section.test.tsxnew file mode 100644index 0000000000..240383d5c3--- /dev/null+++ b/packages/views/layout/panels/inbox-section.test.tsx@@ -0,0 +1,362 @@+import type { ReactNode } from "react";+import { fireEvent, screen, within } from "@testing-library/react";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { beforeEach, describe, expect, it, vi } from "vitest";+import {+ DEFAULT_SIDEBAR_INBOX_SETTINGS,+ useSidebarTreeStore,+} from "@multica/core/issues/stores/sidebar-tree-store";+import { useInboxFilterStore } from "@multica/core/inbox/filter-store";+import { useInboxSelectionStore } from "@multica/core/inbox/selection-store";+import { agentTaskSnapshotOptions } from "@multica/core/agents";+import type { InboxItem } from "@multica/core/types";+import { renderWithI18n } from "../../test/i18n";+import { NavigationProvider, type NavigationAdapter } from "../../navigation";+import { InboxSection, useInboxSectionRows } from "./inbox-section";++const state = vi.hoisted(() => ({+ unread: 0,+ compact: false,+ archive: vi.fn(),+ markAllRead: vi.fn(),+ archiveAll: vi.fn(),+ archiveAllRead: vi.fn(),+ archiveCompleted: vi.fn(),+ markRead: vi.fn(),+ markUnread: vi.fn(),+}));++vi.mock("@multica/core/paths", async (importOriginal) => {+ const actual = await importOriginal<typeof import("@multica/core/paths")>();+ return { ...actual, useWorkspacePaths: () => actual.paths.workspace("acme") };+});+vi.mock("@multica/core/inbox/queries", async (importOriginal) => ({+ ...(await importOriginal<typeof import("@multica/core/inbox/queries")>()),+ useInboxUnreadCount: () => state.unread,+}));+vi.mock("@multica/core/inbox/mutations", () => ({+ useArchiveInbox: () => ({ mutate: state.archive }),+ useMarkAllInboxRead: () => ({ mutate: state.markAllRead }),+ useArchiveAllInbox: () => ({ mutate: state.archiveAll }),+ useArchiveAllReadInbox: () => ({ mutate: state.archiveAllRead }),+ useArchiveCompletedInbox: () => ({ mutate: state.archiveCompleted }),+ useMarkInboxRead: () => ({ mutate: state.markRead }),+ useMarkInboxUnread: () => ({ mutate: state.markUnread }),+}));+vi.mock("@multica/core/hooks", async (importOriginal) => ({+ ...(await importOriginal<typeof import("@multica/core/hooks")>()),+ useWorkspaceId: () => "ws-1",+}));+vi.mock("@multica/core/workspace/hooks", () => ({+ useActorName: () => ({ getActorName: () => "Leo Park", getActorInitials: () => "LP", getActorAvatarUrl: () => null }),+}));+vi.mock("../../common/actor-avatar", () => ({ ActorAvatar: () => null }));+vi.mock("@multica/ui/hooks/use-mobile", async (importOriginal) => ({+ ...(await importOriginal<typeof import("@multica/ui/hooks/use-mobile")>()),+ useIsCompact: () => state.compact,+}));+vi.mock("@multica/ui/components/common/tooltip-hint", () => ({+ TooltipHint: ({ children }: { children: ReactNode }) => <>{children}</>,+}));++function item(overrides: Partial<InboxItem> & { id: string }): InboxItem {+ return {+ workspace_id: "ws-1",+ recipient_type: "member",+ recipient_id: "member-1",+ actor_type: "agent",+ actor_id: "agent-1",+ type: "new_comment",+ severity: "info",+ issue_id: null,+ title: "Issue title",+ body: null,+ issue_status: "in_progress",+ issue_priority: "none",+ read: false,+ archived: false,+ created_at: "2026-11-10T08:00:00Z",+ details: null,+ ...overrides,+ };+}++function adapter(url: string): NavigationAdapter {+ const [pathname, search = ""] = url.split("?");+ return {+ push: vi.fn(),+ replace: vi.fn(),+ back: vi.fn(),+ pathname: pathname!,+ searchParams: new URLSearchParams(search),+ hash: "",+ getShareableUrl: (path) => path,+ };+}++function Harness({ activeIssueId, pathname, openKey }: { activeIssueId: string | null; pathname: string; openKey: string | null }) {+ const rows = useInboxSectionRows("ws-1", openKey);+ return <InboxSection wsId="ws-1" rows={rows} pathname={pathname} activeIssueId={activeIssueId} />;+}++function renderSection(items: InboxItem[], activeIssueId: string | null = null, url = "/acme/issues") {+ const client = new QueryClient({ defaultOptions: { queries: { retry: false, staleTime: Infinity } } });+ client.setQueryData(["inbox", "ws-1", "list"], items);+ client.setQueryData(agentTaskSnapshotOptions("ws-1").queryKey, []);+ const nav = adapter(url);+ // As the Work panel keys it: the issue opened from the section, or the Inbox page's notification.+ const openKey = nav.pathname === "/acme/inbox" ? nav.searchParams.get("issue") : activeIssueId;+ const result = renderWithI18n(+ <QueryClientProvider client={client}>+ <NavigationProvider value={nav}>+ <Harness activeIssueId={activeIssueId} pathname={nav.pathname} openKey={openKey} />+ </NavigationProvider>+ </QueryClientProvider>,+ );+ return { ...result, nav };+}++const rows = () => Array.from(document.querySelectorAll<HTMLElement>("[data-inbox-row]"));++beforeEach(() => {+ state.unread = 0;+ state.compact = false;+ for (const spy of [+ state.archive,+ state.markAllRead,+ state.archiveAll,+ state.archiveAllRead,+ state.archiveCompleted,+ state.markRead,+ state.markUnread,+ ]) {+ spy.mockReset();+ }+ useSidebarTreeStore.setState({ inboxCollapsed: false, inboxSettings: DEFAULT_SIDEBAR_INBOX_SETTINGS });+ useInboxFilterStore.getState().clearFilters("ws-1");+ useInboxSelectionStore.setState({ landing: null });+});++describe("InboxSection", () => {+ it("lists read and unread notifications, one row per issue, newest first", () => {+ renderSection([+ item({ id: "n1", issue_id: "issue-a", title: "Older issue", read: true, created_at: "2026-11-09T08:00:00Z" }),+ item({ id: "n2", issue_id: "issue-b", title: "Newer issue", created_at: "2026-11-10T09:00:00Z" }),+ item({ id: "n3", issue_id: "issue-b", title: "Newer issue", created_at: "2026-11-10T08:00:00Z" }),+ item({ id: "n4", issue_id: "issue-c", title: "Archived issue", archived: true }),+ ]);++ expect(rows().map((row) => row.textContent)).toEqual([+ expect.stringContaining("Newer issue"),+ expect.stringContaining("Older issue"),+ ]);+ expect(rows().map((row) => row.dataset.read)).toEqual(["false", "true"]);+ expect(rows()[0]!.querySelector("[data-mc='unread-dot']")).not.toBeNull();+ expect(rows()[1]!.querySelector("[data-mc='unread-dot']")).toBeNull();+ });++ it("opens the issue at the comment it is about, and an issue-less notice on the Inbox page", () => {+ renderSection([+ item({ id: "n1", issue_id: "issue-a", title: "Commented", details: { comment_id: "c-1" } }),+ item({ id: "n2", issue_id: "issue-b", title: "Assigned", type: "issue_assigned", created_at: "2026-11-09T08:00:00Z" }),+ item({ id: "n3", issue_id: null, title: "Autopilot paused", type: "autopilot_paused", created_at: "2026-11-08T08:00:00Z" }),+ ]);++ expect(screen.getByRole("link", { name: /^Commented/ })).toHaveAttribute("href", "/acme/issues/issue-a#comment-c-1");+ expect(screen.getByRole("link", { name: /^Assigned/ })).toHaveAttribute("href", "/acme/issues/issue-b");+ expect(screen.getByRole("link", { name: /^Autopilot paused/ })).toHaveAttribute("href", "/acme/inbox?issue=n3");+ });++ it("opens an app's request on its issue at that request", () => {+ renderSection([+ item({ id: "n1", issue_id: "issue-a", title: "Confirm deploy", type: "app_action_requested", details: { request_id: "r-1" } }),+ ]);++ expect(screen.getByRole("link", { name: /^Confirm deploy/ })).toHaveAttribute("href", "/acme/issues/issue-a#app-request-r-1");+ });++ it("lands an app's request over an older comment notification on the same issue", () => {+ renderSection([+ item({ id: "app-n", issue_id: "issue-a", title: "Confirm deploy", type: "app_action_requested", details: { request_id: "r-1" }, created_at: "2026-11-10T09:00:00Z" }),+ item({ id: "comment-n", issue_id: "issue-a", title: "Older comment", type: "new_comment", details: { comment_id: "c-1" }, created_at: "2026-11-10T08:00:00Z" }),+ ]);++ expect(screen.getByRole("link", { name: /^Confirm deploy/ })).toHaveAttribute("href", "/acme/issues/issue-a#app-request-r-1");+ });++ it("asks the issue page to land again on every click, even on the issue already open", () => {+ renderSection([item({ id: "n1", issue_id: "issue-a", title: "Commented", details: { comment_id: "c-1" } })], "issue-a");++ fireEvent.click(screen.getByRole("link", { name: /^Commented/ }));+ const first = useInboxSelectionStore.getState().landing;+ fireEvent.click(screen.getByRole("link", { name: /^Commented/ }));++ expect(first?.issueId).toBe("issue-a");+ expect(useInboxSelectionStore.getState().landing).toEqual({ issueId: "issue-a", token: first!.token + 1 });+ });++ it("lists under the Inbox filters, keeping the open row once reading it", () => {+ useInboxFilterStore.getState().toggleUnreadOnly("ws-1");+ renderSection(+ [+ item({ id: "n1", issue_id: "issue-a", title: "Open one", read: true }),+ item({ id: "n2", issue_id: "issue-b", title: "Read one", read: true, created_at: "2026-11-09T08:00:00Z" }),+ item({ id: "n3", issue_id: "issue-c", title: "Unread one", created_at: "2026-11-08T08:00:00Z" }),+ ],+ "issue-a",+ );++ expect(rows().map((row) => row.textContent)).toEqual([+ expect.stringContaining("Open one"),+ expect.stringContaining("Unread one"),+ ]);+ expect(screen.getByRole("button", { name: "1 active filter" })).toBeInTheDocument();+ });++ it("says when the filters hide everything, and clears them from there", () => {+ useInboxFilterStore.getState().toggleFilterValue("ws-1", "type", "mentions");+ renderSection([item({ id: "n1", issue_id: "issue-a", title: "Commented" })]);++ expect(rows()).toHaveLength(0);+ fireEvent.click(screen.getByRole("button", { name: "Clear filters" }));++ expect(rows()).toHaveLength(1);+ expect(screen.getByRole("button", { name: "Filter inbox" })).toBeInTheDocument();+ });++ it("puts who did what under the title, or keeps one line when compact", () => {+ const items = [item({ id: "n1", issue_id: "issue-a", title: "Commented", body: "Ship it on Friday" })];+ const { unmount } = renderSection(items);+ expect(rows()[0]).toHaveTextContent("Leo Park Ship it on Friday");+ unmount();++ useSidebarTreeStore.setState({ inboxSettings: { ...DEFAULT_SIDEBAR_INBOX_SETTINGS, compact: true } });+ renderSection(items);+ expect(rows()[0]).toHaveTextContent("Commented");+ expect(rows()[0]).not.toHaveTextContent("Leo Park");+ expect(rows()[0]!.querySelector("[data-mc='unread-dot']")).not.toBeNull();+ });++ it("shows the whole notification on hover, with its actions", async () => {+ renderSection([item({ id: "n1", issue_id: "issue-a", title: "Commented", body: "Ship it on Friday" })]);+ fireEvent.mouseEnter(rows()[0]!.firstElementChild!);+ const card = await screen.findByText("Ship it on Friday", { selector: "[data-inbox-card] p" }, { timeout: 2000 });+ const actions = within(card.closest<HTMLElement>("[data-inbox-card]")!);++ expect(actions.getByRole("link", { name: "Open" })).toHaveAttribute("href", "/acme/issues/issue-a");+ fireEvent.click(actions.getByRole("button", { name: "Mark as read" }));+ expect(state.markRead).toHaveBeenCalledWith("n1");+ fireEvent.click(actions.getByRole("button", { name: "Archive" }));+ expect(state.archive).toHaveBeenCalledWith("n1");+ });++ it("archives a row from its hover button", () => {+ renderSection([item({ id: "n1", issue_id: "issue-a", title: "Commented" })]);+ fireEvent.click(within(rows()[0]!).getByRole("button", { name: "Archive" }));+ expect(state.archive).toHaveBeenCalledWith("n1");+ });++ it("caps the list at the chosen number of rows, with the rest behind Show more", () => {+ useSidebarTreeStore.setState({ inboxSettings: { ...DEFAULT_SIDEBAR_INBOX_SETTINGS, limit: 5 } });+ renderSection(+ Array.from({ length: 7 }, (_, i) =>+ item({ id: `n${i}`, issue_id: `issue-${i}`, title: `Issue ${i}`, created_at: `2026-11-0${i + 1}T08:00:00Z` }),+ ),+ );+ expect(rows()).toHaveLength(5);++ fireEvent.click(screen.getByRole("button", { name: "Show 2 more…" }));+ expect(rows()).toHaveLength(7);+ });++ it("lights only the row of the issue opened from it", () => {+ renderSection(+ [+ item({ id: "n1", issue_id: "issue-a", title: "Open one" }),+ item({ id: "n2", issue_id: "issue-b", title: "Other one", created_at: "2026-11-09T08:00:00Z" }),+ ],+ "issue-a",+ );+ expect(screen.getByRole("link", { name: /^Open one/ })).toHaveAttribute("aria-current", "page");+ expect(screen.getByRole("link", { name: /^Other one/ })).not.toHaveAttribute("aria-current");+ });++ it("shows the unread count beside the label unless turned off", () => {+ state.unread = 3;+ const { unmount } = renderSection([item({ id: "n1", issue_id: "issue-a" })]);+ const header = () => screen.getByRole("button", { name: "Inbox" }).closest("div")!;+ expect(header()).toHaveTextContent("3");+ unmount();++ useSidebarTreeStore.setState({ inboxSettings: { ...DEFAULT_SIDEBAR_INBOX_SETTINGS, showCount: false } });+ renderSection([item({ id: "n1", issue_id: "issue-a" })]);+ expect(header()).not.toHaveTextContent("3");+ });++ it("collapses from the section label", () => {+ renderSection([item({ id: "n1", issue_id: "issue-a" })]);+ fireEvent.click(screen.getByRole("button", { name: "Inbox" }));+ expect(useSidebarTreeStore.getState().inboxCollapsed).toBe(true);+ expect(rows()).toHaveLength(0);+ });++ it("is the whole list on a wide screen: no link out to another one, and a plain line when empty", () => {+ const { unmount } = renderSection([item({ id: "n1", issue_id: "issue-a", title: "Only one" })]);+ expect(screen.queryByRole("link", { name: "All notifications" })).toBeNull();+ expect(screen.getAllByRole("link").map((link) => link.getAttribute("href"))).toEqual(["/acme/issues/issue-a"]);+ unmount();++ renderSection([]);+ expect(rows()).toHaveLength(0);+ expect(screen.getByText("No notifications")).not.toHaveAttribute("href");+ expect(screen.queryByRole("link")).toBeNull();+ });++ it("links to the full list on a phone, where the sidebar sits behind a drawer", () => {+ state.compact = true;+ const { unmount } = renderSection([item({ id: "n1", issue_id: "issue-a" })]);+ expect(screen.getByRole("link", { name: "All notifications" })).toHaveAttribute("href", "/acme/inbox");+ unmount();++ renderSection([], null, "/acme/inbox");+ expect(screen.getByRole("link", { name: "All notifications" })).toHaveAttribute("aria-current", "page");+ });++ it("lights the row the Inbox page has open", () => {+ renderSection(+ [+ item({ id: "n1", issue_id: null, title: "Autopilot paused", type: "autopilot_paused" }),+ item({ id: "n2", issue_id: "issue-b", title: "Other one", created_at: "2026-11-09T08:00:00Z" }),+ ],+ null,+ "/acme/inbox?issue=n1",+ );+ expect(screen.getByRole("link", { name: /^Autopilot paused/ })).toHaveAttribute("aria-current", "page");+ expect(screen.getByRole("link", { name: /^Other one/ })).not.toHaveAttribute("aria-current");+ });++ it("offers the bulk actions from the section header", async () => {+ renderSection([item({ id: "n1", issue_id: "issue-a" })]);+ const open = async () => {+ fireEvent.click(screen.getByRole("button", { name: "Inbox actions" }));+ return screen.findByRole("menu");+ };++ fireEvent.click(within(await open()).getByRole("menuitem", { name: "Mark all as read" }));+ expect(state.markAllRead).toHaveBeenCalledTimes(1);+ fireEvent.click(within(await open()).getByRole("menuitem", { name: "Archive all read" }));+ expect(state.archiveAllRead).toHaveBeenCalledTimes(1);+ fireEvent.click(within(await open()).getByRole("menuitem", { name: "Archive completed" }));+ expect(state.archiveCompleted).toHaveBeenCalledTimes(1);+ fireEvent.click(within(await open()).getByRole("menuitem", { name: "Archive all" }));+ expect(state.archiveAll).toHaveBeenCalledTimes(1);+ });++ it("opens the archive from the section header", async () => {+ const { nav } = renderSection([item({ id: "n1", issue_id: "issue-a" })]);++ fireEvent.click(screen.getByRole("button", { name: "Inbox actions" }));+ fireEvent.click(within(await screen.findByRole("menu")).getByRole("menuitem", { name: "View archived" }));+ expect(nav.push).toHaveBeenCalledWith("/acme/inbox?view=archived");+ });+});diff --git a/packages/views/layout/panels/inbox-section.tsx b/packages/views/layout/panels/inbox-section.tsxnew file mode 100644index 0000000000..d62cae8a40--- /dev/null+++ b/packages/views/layout/panels/inbox-section.tsx@@ -0,0 +1,523 @@+"use client";++import { type ReactNode, useMemo, useState } from "react";+import { useQuery } from "@tanstack/react-query";+import { toast } from "sonner";+import { Archive, BookCheck, CheckCheck, History, ListChecks, MoreHorizontal } from "@multica/ui/icons";+import { cn } from "@multica/ui/lib/utils";+import { useIsCompact } from "@multica/ui/hooks/use-mobile";+import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";+import { Button, buttonVariants } from "@multica/ui/components/ui/button";+import { HoverCard, HoverCardContent, HoverCardTrigger } from "@multica/ui/components/ui/hover-card";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuSeparator,+ DropdownMenuTrigger,+} from "@multica/ui/components/ui/dropdown-menu";+import { inboxTypeGroup, useInboxFilterStore } from "@multica/core/inbox/filter-store";+import {+ useArchiveAllInbox,+ useArchiveAllReadInbox,+ useArchiveCompletedInbox,+ useArchiveInbox,+ useMarkAllInboxRead,+ useMarkInboxRead,+ useMarkInboxUnread,+} from "@multica/core/inbox/mutations";+import { useInboxUnreadCount } from "@multica/core/inbox/queries";+import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";+import { issueDetailOptions } from "@multica/core/issues/queries";+import { useSidebarTreeStore } from "@multica/core/issues/stores/sidebar-tree-store";+import { useInboxSelectionStore } from "@multica/core/inbox/selection-store";+import { useWorkspacePaths } from "@multica/core/paths";+import type { InboxItem } from "@multica/core/types";+import { useActorName } from "@multica/core/workspace/hooks";+import { AppLink, useNavigation } from "../../navigation";+import { useViewStateWriter } from "../../platform";+import { issueHighlightMementoKey } from "../../issues/components/issue-detail";+import { useT } from "../../i18n";+import { INBOX_TYPE_ICONS } from "../../inbox/components/inbox-filter-options";+import { getInboxDisplayTitle, inboxRowHref, isAutopilotQuotaNotice } from "../../inbox/components/inbox-display";+import { ARCHIVED_VIEW_PARAM } from "../../inbox/components/inbox-view";+import { ActorAvatar } from "../../common/actor-avatar";+import { InboxDetailLabel, useTypeLabels } from "../../inbox/components/inbox-detail-label";+import { InboxFilterMenu } from "../../inbox/components/inbox-filter-menu";+import { useFilteredInboxRows } from "../../inbox/components/use-filtered-inbox-rows";+import { useTimeAgo } from "../../inbox/components/inbox-list-item";+import { StatusIcon } from "../../issues/components";+import { useStatusLabel } from "../../issues/utils/status-label";+import {+ PANEL_ROW_CLASS,+ PanelCount,+ PanelLink,+ PanelList,+ PanelSection,+ panelRowAnchor,+ panelRowStateClass,+} from "../panel-nav";+import { InboxSectionSettings, SECTION_SETTINGS_REVEAL_CLASS } from "./sidebar-settings";+import { ISSUE_ROW_LINK_CLASS, TREE_ROW_BUTTON_CLASS } from "./sidebar-tree";++/**+ * The unread count sits in the panel's number column (the rows' trailing+ * edge, 12px in from the label row's) and yields that spot to the section's+ * buttons while they show. Where they always show (coarse pointers) it stays+ * in line before them.+ */+const HEADER_COUNT_CLASS = cn(+ "pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 font-medium text-brand transition-opacity duration-150",+ "group-hover/section:opacity-0 group-focus-within/section:opacity-0",+ "[@media(pointer:coarse)]:pointer-events-auto [@media(pointer:coarse)]:static [@media(pointer:coarse)]:translate-y-0 [@media(pointer:coarse)]:px-1 [@media(pointer:coarse)]:group-focus-within/section:opacity-100",+);++/** The Inbox rows' place in the clicked-issue record, apart from every sidebar source. */+export const INBOX_LIST = "inbox";++/**+ * The Inbox section's rows: one per issue, newest first, read and unread+ * alike, under the Inbox filters. A row leaves only when archived, by hand or+ * by its issue reaching Done. Lifted out of the section so the panel knows+ * which issues it shows. `openKey`: see `useFilteredInboxRows`.+ */+export function useInboxSectionRows(wsId: string | undefined, openKey: string | null) {+ const list = useFilteredInboxRows(wsId ?? "", openKey);+ const { rows } = list;+ const limit = useSidebarTreeStore((s) => s.inboxSettings.limit);+ const collapsed = useSidebarTreeStore((s) => s.inboxCollapsed);+ const [expandedWsId, setExpandedWsId] = useState<string | null>(null);+ const expanded = expandedWsId === (wsId ?? null);+ const displayed = useMemo(() => (expanded ? rows : rows.slice(0, limit)), [expanded, rows, limit]);+ // A collapsed section shows no rows, so it lights none.+ const shownIssueIds = useMemo(+ () => new Set(collapsed ? [] : displayed.flatMap((item) => (item.issue_id ? [item.issue_id] : []))),+ [collapsed, displayed],+ );++ return {+ list,+ rows,+ displayed,+ expanded,+ limit,+ shownIssueIds,+ setExpanded: (next: boolean) => setExpandedWsId(next ? (wsId ?? null) : null),+ };+}++type InboxSectionRows = ReturnType<typeof useInboxSectionRows>;++export function InboxSection({+ wsId,+ rows,+ pathname,+ activeIssueId,+}: {+ wsId: string;+ rows: InboxSectionRows;+ pathname: string;+ /** The open issue, when it was opened from this section. */+ activeIssueId: string | null;+}) {+ const { t } = useT("layout");+ const { t: tInbox } = useT("inbox");+ const p = useWorkspacePaths();+ const collapsed = useSidebarTreeStore((s) => s.inboxCollapsed);+ const setCollapsed = useSidebarTreeStore((s) => s.setInboxCollapsed);+ const showCount = useSidebarTreeStore((s) => s.inboxSettings.showCount);+ const compact = useSidebarTreeStore((s) => s.inboxSettings.compact);+ const unread = useInboxUnreadCount(wsId);+ const archive = useArchiveInbox();+ const { searchParams } = useNavigation();+ const isCompact = useIsCompact();+ const { list, rows: all, displayed, expanded, limit, setExpanded } = rows;+ const clearFilters = useInboxFilterStore((state) => state.clearFilters);+ // The notification the Inbox page has open, keyed as it groups rows.+ const openKey = pathname === p.inbox() ? searchParams.get("issue") : null;++ return (+ <PanelSection+ label={t(($) => $.nav.inbox)}+ collapsed={collapsed}+ onCollapsedChange={setCollapsed}+ action={+ <div className="relative flex items-center gap-1">+ {showCount && <PanelCount value={unread} className={HEADER_COUNT_CLASS} />}+ <InboxFilterMenu+ wsId={wsId}+ items={list.notifications}+ priorityFilterSupport={list.priorityFilterSupport}+ issueFieldsSupport={list.issueFieldsSupport}+ activeIssueIds={list.activeIssueIds}+ sectionTrigger={{+ className: cn(TREE_ROW_BUTTON_CLASS, "text-muted-foreground", SECTION_SETTINGS_REVEAL_CLASS),+ // A filtered list says so even while the section is not hovered.+ activeClassName: "w-auto gap-0.5 px-1 text-brand opacity-100 hover:text-brand",+ }}+ />+ <InboxSectionSettings className={SECTION_SETTINGS_REVEAL_CLASS} />+ <InboxSectionActions className={SECTION_SETTINGS_REVEAL_CLASS} />+ </div>+ }+ >+ {displayed.length > 0 ? (+ <PanelList data-sidebar-list={INBOX_LIST}>+ {displayed.map((item) => (+ <InboxRow+ key={item.id}+ item={item}+ href={inboxRowHref(p, item)}+ active={+ (!!item.issue_id && item.issue_id === activeIssueId) ||+ (!!openKey && (item.issue_id ?? item.id) === openKey)+ }+ compact={compact}+ onArchive={() => archive.mutate(item.id)}+ />+ ))}+ </PanelList>+ ) : list.filtered ? (+ <div className={cn(PANEL_ROW_CLASS, "pl-[2.375rem] text-caption text-faint-foreground")}>+ <span className="min-w-0 flex-1 truncate">{tInbox(($) => $.filters.empty)}</span>+ <button+ type="button"+ className="shrink-0 rounded-md px-1 font-medium text-muted-foreground outline-none hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring"+ onClick={() => clearFilters(wsId)}+ >+ {tInbox(($) => $.filters.clear)}+ </button>+ </div>+ ) : (+ <p className={cn(PANEL_ROW_CLASS, "pl-[2.375rem] text-caption text-faint-foreground")}>+ {t(($) => $.panels.work.inbox_empty)}+ </p>+ )}+ {all.length > limit && (+ <button+ type="button"+ aria-expanded={expanded}+ className={cn(PANEL_ROW_CLASS, panelRowStateClass(false), "pl-[2.375rem] text-caption")}+ onClick={() => setExpanded(!expanded)}+ >+ {expanded+ ? t(($) => $.sidebar.show_fewer_pins)+ : t(($) => $.sidebar.show_more_pins, { count: all.length - limit })}+ </button>+ )}+ {/* The sidebar sits behind a drawer on a phone, so the full list keeps its page there. */}+ {isCompact && (+ <PanelList>+ <PanelLink+ href={p.inbox()}+ icon={<span className="size-4" aria-hidden />}+ label={t(($) => $.panels.work.inbox_all)}+ active={+ pathname === p.inbox() && !openKey && searchParams.get("view") !== ARCHIVED_VIEW_PARAM+ }+ className="text-caption"+ />+ </PanelList>+ )}+ </PanelSection>+ );+}++function InboxSectionActions({ className }: { className?: string }) {+ const { t } = useT("layout");+ const { t: tInbox } = useT("inbox");+ const markAllRead = useMarkAllInboxRead();+ const archiveAll = useArchiveAllInbox();+ const archiveAllRead = useArchiveAllReadInbox();+ const archiveCompleted = useArchiveCompletedInbox();+ const { push } = useNavigation();+ const p = useWorkspacePaths();+ const label = t(($) => $.panels.work.inbox_actions);+ const onError = (fallback: string) => (err: unknown) =>+ toast.error(err instanceof Error && err.message ? err.message : fallback);++ return (+ <DropdownMenu>+ <DropdownMenuTrigger+ render={+ <button+ type="button"+ aria-label={label}+ className={cn(+ TREE_ROW_BUTTON_CLASS,+ // The slot of the other sections' create button.+ "size-[var(--button-height-xs)]",+ "text-muted-foreground data-popup-open:bg-surface-selected data-popup-open:text-foreground data-popup-open:opacity-100",+ className,+ )}+ />+ }+ >+ <MoreHorizontal className="size-3.5" />+ </DropdownMenuTrigger>+ <DropdownMenuContent side="right" align="start" className="w-auto min-w-48">+ <DropdownMenuItem onClick={() => push(`${p.inbox()}?${new URLSearchParams({ view: ARCHIVED_VIEW_PARAM })}`)}>+ <History className="size-4" />+ {t(($) => $.panels.work.inbox_view_archived)}+ </DropdownMenuItem>+ <DropdownMenuSeparator />+ <DropdownMenuItem+ onClick={() =>+ markAllRead.mutate(undefined, { onError: onError(tInbox(($) => $.errors.mark_all_read_failed)) })+ }+ >+ <CheckCheck className="size-4" />+ {tInbox(($) => $.menu.mark_all_read)}+ </DropdownMenuItem>+ <DropdownMenuSeparator />+ <DropdownMenuItem+ onClick={() =>+ archiveAllRead.mutate(undefined, { onError: onError(tInbox(($) => $.errors.archive_all_read_failed)) })+ }+ >+ <BookCheck className="size-4" />+ {tInbox(($) => $.menu.archive_all_read)}+ </DropdownMenuItem>+ <DropdownMenuItem+ onClick={() =>+ archiveCompleted.mutate(undefined, { onError: onError(tInbox(($) => $.errors.archive_completed_failed)) })+ }+ >+ <ListChecks className="size-4" />+ {tInbox(($) => $.menu.archive_completed)}+ </DropdownMenuItem>+ <DropdownMenuItem+ onClick={() =>+ archiveAll.mutate(undefined, { onError: onError(tInbox(($) => $.errors.archive_all_failed)) })+ }+ >+ <Archive className="size-4" />+ {tInbox(($) => $.menu.archive_all)}+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ );+}++function InboxRow({+ item,+ href,+ active,+ compact,+ onArchive,+}: {+ item: InboxItem;+ href: string;+ active: boolean;+ /** One line (type icon, title, dot or time) instead of the actor line under the title. */+ compact: boolean;+ onArchive: () => void;+}) {+ const { t } = useT("inbox");+ const typeLabels = useTypeLabels();+ const timeAgo = useTimeAgo();+ const Icon = INBOX_TYPE_ICONS[inboxTypeGroup(item.type)];+ const title = inboxRowTitle(item, typeLabels);+ const writeViewState = useViewStateWriter();+ const requestLanding = useInboxSelectionStore((s) => s.requestLanding);+ // Every click is a fresh intent to land on what the notification is about,+ // even on the issue already open, or one whose landing ran before.+ const land = () => {+ if (!item.issue_id) return;+ writeViewState(issueHighlightMementoKey(item.issue_id), undefined);+ requestLanding(item.issue_id);+ };+ const unread = item.read !== true;+ const archiveLabel = t(($) => $.list.archive_tooltip);+ // Hidden while the archive button stands in its place.+ const yields = "group-hover/inbox:invisible group-focus-within/inbox:invisible";+ const time = (+ <span className={cn("shrink-0 text-caption tabular-nums text-faint-foreground", yields)}>+ {timeAgo(item.created_at)}+ </span>+ );+ const dot = <span data-mc="unread-dot" aria-hidden className="size-1.5 shrink-0 rounded-full bg-brand" />;+ const titleText = (+ <span className={cn("min-w-0 flex-1 truncate", unread && "font-medium text-foreground")}>{title}</span>+ );++ return (+ <li data-inbox-row data-read={unread ? "false" : "true"} className="group/inbox relative">+ <HoverCard>+ <HoverCardTrigger+ delay={500}+ closeDelay={100}+ render={<div />}+ {...panelRowAnchor(active)}+ className={cn(PANEL_ROW_CLASS, panelRowStateClass(active), "relative", !compact && "items-start py-[5px]")}+ >+ {compact ? (+ <span title={typeLabels[item.type]} className="flex shrink-0 items-center">+ <Icon aria-hidden className="size-4" />+ </span>+ ) : (+ <span className="mt-0.5 flex shrink-0">+ <InboxActorAvatar item={item} size="xs" />+ </span>+ )}+ <AppLink+ href={href}+ newTabTitle={title}+ draggable={false}+ aria-current={active ? "page" : undefined}+ onNavigateInPlace={land}+ className={cn(ISSUE_ROW_LINK_CLASS, compact ? "gap-2.5" : "flex-col items-stretch gap-0")}+ >+ {compact ? (+ <>+ {titleText}+ {unread ? <span className={cn("flex shrink-0 items-center", yields)}>{dot}</span> : time}+ </>+ ) : (+ <>+ <span className="flex min-w-0 items-center gap-2 leading-5">+ {titleText}+ {time}+ </span>+ <span className="flex min-w-0 items-center gap-2 text-caption leading-4 text-muted-foreground">+ <span className="min-w-0 flex-1 truncate">+ <InboxActorLine item={item} />+ </span>+ {unread && dot}+ </span>+ </>+ )}+ </AppLink>+ </HoverCardTrigger>+ <HoverCardContent side="right" align="start" sideOffset={12} alignOffset={-8} className="w-72 p-3">+ <InboxRowCard item={item} href={href} title={title} onOpen={land} onArchive={onArchive} />+ </HoverCardContent>+ </HoverCard>+ <TooltipHint label={archiveLabel}>+ <button+ type="button"+ aria-label={archiveLabel}+ className={cn(+ "absolute right-1.5 z-10 hidden size-5 items-center justify-center rounded-md text-muted-foreground group-hover/inbox:flex group-focus-within/inbox:flex hover:bg-surface-selected hover:text-foreground",+ // On the title's line, where the time was.+ compact ? "top-1/2 -translate-y-1/2" : "top-[5px]",+ )}+ onClick={(event) => {+ event.preventDefault();+ event.stopPropagation();+ onArchive();+ }}+ >+ <Archive className="size-3" />+ </button>+ </TooltipHint>+ </li>+ );+}++function inboxRowTitle(item: InboxItem, typeLabels: ReturnType<typeof useTypeLabels>) {+ return isAutopilotQuotaNotice(item.type) ? typeLabels[item.type] : getInboxDisplayTitle(item);+}++function InboxActorAvatar({ item, size }: { item: InboxItem; size: "xs" | "sm" }) {+ return (+ <ActorAvatar+ actorType={item.actor_type ?? item.recipient_type}+ actorId={item.actor_id ?? item.recipient_id}+ size={size}+ />+ );+}++/** Who did what: the actor's name, then what the notification says happened. */+function InboxActorLine({ item, detail }: { item: InboxItem; detail?: ReactNode }) {+ const { getActorName } = useActorName();+ const name =+ item.actor_type && item.actor_type !== "system" && item.actor_id+ ? getActorName(item.actor_type, item.actor_id)+ : null;+ return (+ <>+ {name && <span className="font-medium">{name} </span>}+ {detail ?? <InboxDetailLabel item={item} />}+ </>+ );+}++/** The whole notification, shown while a row is hovered. */+function InboxRowCard({+ item,+ href,+ title,+ onOpen,+ onArchive,+}: {+ item: InboxItem;+ href: string;+ title: string;+ onOpen: () => void;+ onArchive: () => void;+}) {+ const { t } = useT("layout");+ const { t: tInbox } = useT("inbox");+ const typeLabels = useTypeLabels();+ const timeAgo = useTimeAgo();+ const { categoryOf, colorOf, iconOf } = useIssueStatuses(item.workspace_id);+ const statusLabelOf = useStatusLabel(item.workspace_id);+ const markRead = useMarkInboxRead();+ const markUnread = useMarkInboxUnread();+ const { data: issue } = useQuery({ ...issueDetailOptions(item.workspace_id, item.issue_id ?? ""), enabled: !!item.issue_id });+ const unread = item.read !== true;+ // A comment gets its own block, so the line above names only the kind.+ const comment = item.type === "new_comment" && item.body ? item.body : null;+ const status = item.issue_status;++ return (+ <div data-inbox-card className="flex flex-col gap-2">+ <div className="flex min-w-0 items-center gap-2 text-caption text-muted-foreground">+ <InboxActorAvatar item={item} size="sm" />+ <span className="min-w-0 flex-1 truncate">+ <InboxActorLine item={item} detail={comment ? typeLabels[item.type] : undefined} />+ </span>+ <span className="shrink-0 tabular-nums">{timeAgo(item.created_at)}</span>+ </div>+ <p className="font-medium leading-snug">{title}</p>+ {comment && (+ <p className="line-clamp-4 rounded-md bg-muted px-2 py-1.5 text-caption leading-5 whitespace-pre-wrap">+ {comment}+ </p>+ )}+ {status && (+ <div className="flex items-center gap-1.5 text-caption text-muted-foreground">+ <StatusIcon+ status={status}+ category={categoryOf(status)}+ color={colorOf(status)}+ icon={iconOf(status)}+ className="size-3.5 shrink-0"+ />+ <span className="truncate">+ {issue?.identifier ? `${issue.identifier} · ` : ""}+ {statusLabelOf(status)}+ </span>+ </div>+ )}+ <div className="-mx-1 mt-1 flex items-center gap-1 border-t border-border pt-2">+ <AppLink href={href} onNavigateInPlace={onOpen} className={buttonVariants({ size: "sm", variant: "secondary" })}>+ {t(($) => $.panels.work.inbox_open)}+ </AppLink>+ <Button+ size="sm"+ variant="ghost"+ className="text-muted-foreground"+ onClick={() => (unread ? markRead.mutate(item.id) : markUnread.mutate(item.id))}+ >+ {unread ? tInbox(($) => $.context_menu.mark_read) : tInbox(($) => $.context_menu.mark_unread)}+ </Button>+ <Button size="sm" variant="ghost" className="text-muted-foreground" onClick={onArchive}>+ {tInbox(($) => $.context_menu.archive)}+ </Button>+ </div>+ </div>+ );+}diff --git a/packages/views/layout/panels/list-space-peeks.tsx b/packages/views/layout/panels/list-space-peeks.tsxindex 65834a37d1..625732299d 100644--- a/packages/views/layout/panels/list-space-peeks.tsx+++ b/packages/views/layout/panels/list-space-peeks.tsx@@ -1,83 +1,21 @@"use client";-import { useMemo } from "react";import { useQuery } from "@tanstack/react-query";import { useChatStore } from "@multica/core/chat";import { useSetChatSessionArchived } from "@multica/core/chat/mutations";import { chatSessionsOptions } from "@multica/core/chat/queries";import { useWorkspaceId } from "@multica/core/hooks";-import {- effectiveInboxFilters,- filterInboxItems,- inboxIssueFieldsSupport,- inboxPriorityFilterSupport,- useInboxFilters,-} from "@multica/core/inbox/filter-store";-import { useArchiveInbox } from "@multica/core/inbox/mutations";-import {- inboxListOptions,- useInboxUnreadCount,-} from "@multica/core/inbox/queries";import { useWorkspacePaths } from "@multica/core/paths";-import type { Agent, ChatSession, InboxItem } from "@multica/core/types";+import type { Agent, ChatSession } from "@multica/core/types";import { agentListOptions } from "@multica/core/workspace/queries";import { ChatThreadList } from "../../chat/components/chat-thread-list";import { useT } from "../../i18n";-import { InboxList } from "../../inbox/components/inbox-list";-import { useIssueSurfaceActivity } from "../../issues/surface/activity";import { useNavigation } from "../../navigation";-import { PanelCount, PanelHeader } from "../panel-nav";+import { PanelHeader } from "../panel-nav";-const EMPTY_INBOX: InboxItem[] = [];const EMPTY_SESSIONS: ChatSession[] = [];const EMPTY_AGENTS: Agent[] = [];-/**- * Inbox previewed from another space: the list the Inbox page shows, under- * the same saved filters. Opening a row lands on it in the Inbox.- */-export function InboxPeek() {- const { t } = useT("inbox");- const wsId = useWorkspaceId();- const p = useWorkspacePaths();- const { push } = useNavigation();- const { data: rawItems = EMPTY_INBOX } = useQuery(inboxListOptions(wsId));- const filters = useInboxFilters(wsId);- const { activityByIssueId } = useIssueSurfaceActivity();- const unreadCount = useInboxUnreadCount(wsId);- const archive = useArchiveInbox();-- const items = useMemo(() => {- const effective = effectiveInboxFilters(filters, {- priority: inboxPriorityFilterSupport(rawItems),- issueFields: inboxIssueFieldsSupport(rawItems),- });- return filterInboxItems(rawItems.filter((item) => !item.archived), effective, {- activeIssueIds: effective.agent ? new Set(activityByIssueId.keys()) : undefined,- });- }, [rawItems, filters, activityByIssueId]);-- const open = (params: Record<string, string>) =>- push(`${p.inbox()}?${new URLSearchParams(params).toString()}`);-- return (- <>- <PanelHeader- title={t(($) => $.page.title)}- meta={<PanelCount value={unreadCount} className="text-muted-foreground" />}- />- <InboxList- items={items}- view="inbox"- selectedKey=""- scrollRestoration={false}- onSelect={(item) => open({ issue: item.issue_id ?? item.id })}- onAction={(id) => archive.mutate(id)}- />- </>- );-}-/** Chat previewed from another space. Opening a thread lands on it in Chat. */export function ChatPeek() {const { t } = useT("chat");diff --git a/packages/views/layout/panels/pinned-section.tsx b/packages/views/layout/panels/pinned-section.tsxindex 78328987e9..22b0d0ad34 100644--- a/packages/views/layout/panels/pinned-section.tsx+++ b/packages/views/layout/panels/pinned-section.tsx@@ -33,6 +33,7 @@ import { ProjectIcon } from "../../projects/components/project-icon";import { useT } from "../../i18n";import { PANEL_ROW_CLASS, PanelList, PanelSection, isPathWithin, panelRowAnchor, panelRowStateClass } from "../panel-nav";import { useDragClickGuard } from "../use-drag-click-guard";+import { PinnedSectionSettings, SECTION_SETTINGS_REVEAL_CLASS } from "./sidebar-settings";import {ISSUE_ROW_LINK_CLASS,IssueAgentBadge,@@ -48,7 +49,6 @@ import {// Stable empty default: an inline `= []` on useQuery is a new reference every// render while the query is disabled, which re-fires the sync effect below.const EMPTY_PINS: PinnedItem[] = [];-const PINNED_PREVIEW_LIMIT = 5;function pinHref(p: WorkspacePaths, pin: PinnedItem): string {return pin.item_type === "issue" ? p.issueDetail(pin.item_id) : p.projectDetail(pin.item_id);@@ -95,7 +95,8 @@ export function usePanelPins(const visible = localPinnedWsId === (wsId ?? null) ? localPinned : EMPTY_PINS;const expanded = expandedWsId === (wsId ?? null);- const displayed = expanded ? visible : visible.slice(0, PINNED_PREVIEW_LIMIT);+ const limit = useSidebarTreeStore((s) => s.pinnedLimit);+ const displayed = expanded ? visible : visible.slice(0, limit);const isPinActive = (pin: PinnedItem) =>pin.item_type === "issue"? pin.item_id === currentIssueId@@ -108,6 +109,7 @@ export function usePanelPins(visible,displayed,expanded,+ limit,isActivePinnedRoute,isPinActive,setExpanded: (next: boolean) => setExpandedWsId(next ? wsId ?? null : null),@@ -125,7 +127,7 @@ export function PinnedSection({ pins, wsId }: { pins: PanelPins; wsId: string })const deletePin = useDeletePin();const reorderPins = useReorderPins();const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 5 } }));- const { visible, displayed, expanded, setExpanded, setLocalPinned, isDraggingRef, viewPins, isPinActive } = pins;+ const { visible, displayed, expanded, limit, setExpanded, setLocalPinned, isDraggingRef, viewPins, isPinActive } = pins;const collapsed = useSidebarTreeStore((s) => s.pinnedCollapsed);const setCollapsed = useSidebarTreeStore((s) => s.setPinnedCollapsed);const { arm: armClickGuard, release: releaseClickGuard } = useDragClickGuard();@@ -161,6 +163,7 @@ export function PinnedSection({ pins, wsId }: { pins: PanelPins; wsId: string })label={t(($) => $.sidebar.pinned_label)}collapsed={collapsed}onCollapsedChange={setCollapsed}+ action={<PinnedSectionSettings className={SECTION_SETTINGS_REVEAL_CLASS} />}><DndContextsensors={sensors}@@ -184,7 +187,7 @@ export function PinnedSection({ pins, wsId }: { pins: PanelPins; wsId: string })</PanelList></SortableContext></DndContext>- {visible.length > PINNED_PREVIEW_LIMIT && (+ {visible.length > limit && (<buttontype="button"aria-expanded={expanded}@@ -193,7 +196,7 @@ export function PinnedSection({ pins, wsId }: { pins: PanelPins; wsId: string })>{expanded? t(($) => $.sidebar.show_fewer_pins)- : t(($) => $.sidebar.show_more_pins, { count: visible.length - PINNED_PREVIEW_LIMIT })}+ : t(($) => $.sidebar.show_more_pins, { count: visible.length - limit })}</button>)}</PanelSection>diff --git a/packages/views/layout/panels/section-settings.test.tsx b/packages/views/layout/panels/section-settings.test.tsxnew file mode 100644index 0000000000..cf80db30fe--- /dev/null+++ b/packages/views/layout/panels/section-settings.test.tsx@@ -0,0 +1,147 @@+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { fireEvent, screen } from "@testing-library/react";+import { beforeEach, describe, expect, it, vi } from "vitest";+import {+ DEFAULT_SIDEBAR_INBOX_SETTINGS,+ useSidebarTreeStore,+} from "@multica/core/issues/stores/sidebar-tree-store";+import { notificationPreferenceOptions } from "@multica/core/notification-preferences/queries";+import { renderWithI18n } from "../../test/i18n";+import { NavigationProvider, type NavigationAdapter } from "../../navigation";+import type { IssueViewActions } from "../../issue-views/use-view-actions";+import { InboxSectionSettings, PinnedSectionSettings, ViewsSectionSettings } from "./sidebar-settings";++const preferences = vi.hoisted(() => ({ mutate: vi.fn() }));++vi.mock("@multica/core/hooks", async (importOriginal) => ({+ ...(await importOriginal<typeof import("@multica/core/hooks")>()),+ useWorkspaceId: () => "ws-1",+}));+vi.mock("@multica/core/paths", async (importOriginal) => {+ const actual = await importOriginal<typeof import("@multica/core/paths")>();+ return { ...actual, useWorkspacePaths: () => actual.paths.workspace("acme") };+});+vi.mock("@multica/core/notification-preferences/mutations", () => ({+ useUpdateNotificationPreferences: () => ({ mutate: preferences.mutate }),+}));++const adapter: NavigationAdapter = {+ push: vi.fn(),+ replace: vi.fn(),+ back: vi.fn(),+ pathname: "/acme/issues",+ searchParams: new URLSearchParams(),+ hash: "",+ getShareableUrl: (path) => path,+};++function render(ui: React.ReactNode) {+ const qc = new QueryClient({ defaultOptions: { queries: { staleTime: Infinity, retry: false } } });+ qc.setQueryData(notificationPreferenceOptions("ws-1").queryKey, {+ workspace_id: "ws-1",+ preferences: { comments: "muted" },+ });+ return renderWithI18n(+ <QueryClientProvider client={qc}>+ <NavigationProvider value={adapter}>{ui}</NavigationProvider>+ </QueryClientProvider>,+ );+}++const toggle = (name: string) => screen.getByRole("switch", { name });++beforeEach(() => {+ preferences.mutate.mockReset();+ useSidebarTreeStore.setState({+ inboxSettings: DEFAULT_SIDEBAR_INBOX_SETTINGS,+ pinnedLimit: 5,+ viewsShowCount: true,+ });+});++describe("InboxSectionSettings", () => {+ function open() {+ render(<InboxSectionSettings />);+ fireEvent.click(screen.getByRole("button", { name: "Inbox display" }));+ }++ it("shows each notification kind as delivered unless muted", () => {+ open();+ expect(toggle("Comments")).not.toBeChecked();+ expect(toggle("Mentions")).toBeChecked();+ });++ it("mutes a kind at write time through the notification preferences", () => {+ open();+ fireEvent.click(toggle("Mentions"));+ expect(preferences.mutate).toHaveBeenCalledWith({ comments: "muted", mentions: "muted" }, expect.anything());+ });++ it("drops a kind from the stored preferences when it is turned back on", () => {+ open();+ fireEvent.click(toggle("Comments"));+ expect(preferences.mutate).toHaveBeenCalledWith({}, expect.anything());+ });++ it("turns off the section count and the Work badge", () => {+ open();+ fireEvent.click(toggle("Unread count"));+ fireEvent.click(toggle("Unread badge on Work"));+ expect(useSidebarTreeStore.getState().inboxSettings).toEqual({+ ...DEFAULT_SIDEBAR_INBOX_SETTINGS,+ showCount: false,+ railBadge: false,+ });+ });++ it("links to the full notification settings", () => {+ open();+ expect(screen.getByRole("link", { name: "All notification settings" })).toHaveAttribute(+ "href",+ "/acme/settings?tab=notifications",+ );+ });+});++describe("PinnedSectionSettings", () => {+ it("offers a reset once the row limit moves off the default", () => {+ useSidebarTreeStore.setState({ pinnedLimit: 10 });+ render(<PinnedSectionSettings />);+ fireEvent.click(screen.getByRole("button", { name: "Pinned display" }));++ fireEvent.click(screen.getByRole("button", { name: "Reset" }));+ expect(useSidebarTreeStore.getState().pinnedLimit).toBe(5);+ });+});++describe("ViewsSectionSettings", () => {+ const sidebar = {+ isStarred: (id: string) => id === "builtin:my_work",+ star: vi.fn(),+ unstar: vi.fn(),+ };++ function open() {+ render(<ViewsSectionSettings sidebar={sidebar as unknown as IssueViewActions["sidebar"]} />);+ fireEvent.click(screen.getByRole("button", { name: "Views display" }));+ }++ it("stars and unstars the built-in views", () => {+ open();+ expect(toggle("My work")).toBeChecked();+ expect(toggle("All issues")).not.toBeChecked();+ expect(toggle("Working")).not.toBeChecked();+ expect(toggle("Subscribed")).not.toBeChecked();++ fireEvent.click(toggle("Subscribed"));+ expect(sidebar.star).toHaveBeenCalledWith("builtin:subscribed");+ fireEvent.click(toggle("My work"));+ expect(sidebar.unstar).toHaveBeenCalledWith("builtin:my_work");+ });++ it("turns the row counts off", () => {+ open();+ fireEvent.click(toggle("Counts"));+ expect(useSidebarTreeStore.getState().viewsShowCount).toBe(false);+ });+});diff --git a/packages/views/layout/panels/show-in-sidebar.test.tsx b/packages/views/layout/panels/show-in-sidebar.test.tsxindex 519501dc74..2c7eef42ea 100644--- a/packages/views/layout/panels/show-in-sidebar.test.tsx+++ b/packages/views/layout/panels/show-in-sidebar.test.tsx@@ -4,8 +4,12 @@ import { renderHook } from "@testing-library/react";import { beforeEach, describe, expect, it, vi } from "vitest";import { EMPTY_ISSUE_VIEW_PREFERENCE } from "@multica/core/api/schemas";import { issueViewPreferenceOptions } from "@multica/core/issue-views/preferences";+import { NO_PROJECT_SIDEBAR_SOURCE } from "@multica/core/issues/sidebar-list";import { SIDEBAR_PROJECTS_SCOPE } from "@multica/core/issues/sidebar-project-prefs";-import { useSidebarTreeStore } from "@multica/core/issues/stores/sidebar-tree-store";+import {+ DEFAULT_SIDEBAR_PROJECT_SETTINGS,+ useSidebarTreeStore,+} from "@multica/core/issues/stores/sidebar-tree-store";import { projectListOptions } from "@multica/core/projects/queries";import type { Project } from "@multica/core/types";import { NavigationProvider, type NavigationAdapter } from "../../navigation";@@ -65,7 +69,7 @@ function render(pathname: string, projectId: string | null) {}beforeEach(() => {- useSidebarTreeStore.setState({ locate: null });+ useSidebarTreeStore.setState({ locate: null, projectSettings: DEFAULT_SIDEBAR_PROJECT_SETTINGS });layout.shell = null;layout.sidebar = null;});@@ -98,8 +102,14 @@ describe("useShowInSidebar", () => {expect(render("/acme/inbox", PROJECT.id).current).toBeNull();});- it("is not offered for an issue without a project, or one the sidebar leaves out", () => {- expect(render(`/acme/issues/${ISSUE_ID}`, null).current).toBeNull();+ it("shows an issue without a project under No project", () => {+ render(`/acme/issues/${ISSUE_ID}`, null).current?.();+ expect(useSidebarTreeStore.getState().locate).toEqual({ issueId: ISSUE_ID, source: NO_PROJECT_SIDEBAR_SOURCE });+ });++ it("is not offered for an issue whose row the sidebar leaves out", () => {expect(render(`/acme/issues/${ISSUE_ID}`, DONE_PROJECT.id).current).toBeNull();+ useSidebarTreeStore.setState({ projectSettings: { ...DEFAULT_SIDEBAR_PROJECT_SETTINGS, showNoProject: false } });+ expect(render(`/acme/issues/${ISSUE_ID}`, null).current).toBeNull();});});diff --git a/packages/views/layout/panels/show-in-sidebar.ts b/packages/views/layout/panels/show-in-sidebar.tsindex a4f14ada3e..ffa5de3fd3 100644--- a/packages/views/layout/panels/show-in-sidebar.ts+++ b/packages/views/layout/panels/show-in-sidebar.ts@@ -3,7 +3,7 @@import { useQuery } from "@tanstack/react-query";import { useAuthStore } from "@multica/core/auth";import { useWorkspaceId } from "@multica/core/hooks";-import { projectSidebarSource, sidebarProjects } from "@multica/core/issues/sidebar-list";+import { NO_PROJECT_SIDEBAR_SOURCE, projectSidebarSource, sidebarProjects } from "@multica/core/issues/sidebar-list";import { useSidebarProjectPrefs } from "@multica/core/issues/sidebar-project-prefs";import { useSidebarTreeStore } from "@multica/core/issues/stores/sidebar-tree-store";import { useWorkspacePaths } from "@multica/core/paths";@@ -14,9 +14,9 @@ import { useNavigation } from "../../navigation";import { useAppShell } from "../app-shell-context";/**- * Opens the issue's project row in the Work panel and scrolls to the issue,- * or `null` off an issue route (the panel only marks the route's issue) or- * when the panel does not list its project.+ * Opens the issue's project row, or "No project", in the Work panel and+ * scrolls to the issue, or `null` off an issue route (the panel only marks+ * the route's issue) or when the panel does not show that row.*/export function useShowInSidebar(issue: Pick<Issue, "id" | "project_id"> | null | undefined): (() => void) | null {const wsId = useWorkspaceId();@@ -28,15 +28,23 @@ export function useShowInSidebar(issue: Pick<Issue, "id" | "project_id"> | nullconst { data: projects } = useQuery({ ...projectListOptions(wsId), enabled: !!issue?.project_id });const { projectSettings, projectOrder } = useSidebarProjectPrefs(wsId);const projectId = issue?.project_id;- if (!issue || !projectId || !projects || !pathname.startsWith(paths.issues() + "/")) return null;- const listed = sidebarProjects(projects, projectSettings, projectOrder, userId).some(- (project) => project.id === projectId,- );- if (!listed) return null;+ if (!issue || !pathname.startsWith(paths.issues() + "/")) return null;+ let source: string;+ if (projectId) {+ if (!projects) return null;+ const listed = sidebarProjects(projects, projectSettings, projectOrder, userId).some(+ (project) => project.id === projectId,+ );+ if (!listed) return null;+ source = projectSidebarSource(projectId);+ } else {+ if (!projectSettings.showNoProject) return null;+ source = NO_PROJECT_SIDEBAR_SOURCE;+ }return () => {// `navCollapsed` is always false in the compact layout, where the nav is a sheet.if (sidebar?.isCompact) sidebar.setOpenMobile(true);else if (shell?.navCollapsed) shell.toggleNav();- useSidebarTreeStore.getState().requestLocate({ issueId: issue.id, source: projectSidebarSource(projectId) });+ useSidebarTreeStore.getState().requestLocate({ issueId: issue.id, source });};}diff --git a/packages/views/layout/panels/sidebar-settings.tsx b/packages/views/layout/panels/sidebar-settings.tsxindex 46f5b06e79..f81dd2622a 100644--- a/packages/views/layout/panels/sidebar-settings.tsx+++ b/packages/views/layout/panels/sidebar-settings.tsx@@ -1,32 +1,49 @@"use client";+import { useQuery } from "@tanstack/react-query";+import { toast } from "sonner";import { SlidersHorizontal } from "@multica/ui/icons";import { cn } from "@multica/ui/lib/utils";import { Button } from "@multica/ui/components/ui/button";import { Popover, PopoverContent, PopoverTrigger } from "@multica/ui/components/ui/popover";import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@multica/ui/components/ui/select";import { Switch } from "@multica/ui/components/ui/switch";+import { useWorkspaceId } from "@multica/core/hooks";import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";+import { BUILTIN_VIEW_KEYS, builtinViewItemId } from "@multica/core/issue-views/sidebar-views";import { shownSidebarStatuses } from "@multica/core/issues/sidebar-list";import { useSidebarProjectPrefs, useUpdateSidebarProjectPrefs } from "@multica/core/issues/sidebar-project-prefs";import {+ DEFAULT_SIDEBAR_INBOX_SETTINGS,DEFAULT_SIDEBAR_ISSUE_SETTINGS,DEFAULT_SIDEBAR_PROJECT_SETTINGS,+ useSidebarTreeStore,+ type SidebarSectionLimit,type SidebarIssueAssignee,type SidebarIssueSettings,type SidebarIssueSort,type SidebarProjectOrdering,type SidebarProjectSettings,} from "@multica/core/issues/stores/sidebar-tree-store";+import { notificationPreferenceOptions } from "@multica/core/notification-preferences/queries";+import { useUpdateNotificationPreferences } from "@multica/core/notification-preferences/mutations";+import { useWorkspacePaths } from "@multica/core/paths";import { PROJECT_STATUS_CONFIG, PROJECT_STATUS_ORDER } from "@multica/core/projects/config";-import type { ProjectStatus } from "@multica/core/types";+import type { NotificationGroupKey, NotificationPreferences, ProjectStatus } from "@multica/core/types";import { DisplayChip, SortDirectionButton } from "../../issues/components/display-parts";import { StatusIcon } from "../../issues/components/status-icon";import { sortDirectionLabelKey } from "../../issues/utils/sort-direction";import { useProjectStatusLabels } from "../../projects/components/labels";+import type { IssueViewActions } from "../../issue-views/use-view-actions";+import { useBuiltinViewLabel } from "../../issue-views/builtin-views";import { useT } from "../../i18n";+import { AppLink } from "../../navigation";import { TREE_ROW_BUTTON_CLASS } from "./sidebar-tree";+/** A section's settings button shows while the pointer or focus is in the section. */+export const SECTION_SETTINGS_REVEAL_CLASS =+ "opacity-0 group-hover/section:opacity-100 group-focus-within/section:opacity-100 [@media(pointer:coarse)]:opacity-100";+const ISSUE_SORTS: {value: SidebarIssueSort;label: "sort_updated" | "sort_created" | "sort_priority" | "sort_status" | "sort_title" | "sort_due_date";@@ -39,6 +56,18 @@ const ISSUE_SORTS: {{ value: "due_date", label: "sort_due_date" },];const PROJECT_ORDERINGS: SidebarProjectOrdering[] = ["manual", "name", "updated", "created"];+const SECTION_LIMITS: SidebarSectionLimit[] = [5, 10, 20];+const LIMIT_OPTIONS = SECTION_LIMITS.map((limit) => ({ value: String(limit), label: String(limit) }));+/** The notification kinds a member can turn off, as in Settings → Notifications. */+const INBOX_NOTIFICATION_GROUPS = [+ "assignments",+ "status_changes",+ "comments",+ "mentions",+ "updates",+ "new_issues",+ "agent_activity",+] as const satisfies readonly NotificationGroupKey[];const sameSettings = <T,>(a: T, b: T) => JSON.stringify(a) === JSON.stringify(b);@@ -155,6 +184,11 @@ function ProjectsGroup({checked={settings.onlyMine}onChange={(onlyMine) => update({ onlyMine })}/>+ <SwitchField+ label={t(($) => $.panels.work.projects_show_no_project)}+ checked={settings.showNoProject}+ onChange={(showNoProject) => update({ showNoProject })}+ /><SwitchFieldlabel={t(($) => $.panels.work.projects_show_count)}checked={settings.showCount}@@ -263,13 +297,43 @@ export function ProjectsSectionSettings({ wsId, className }: { wsId: string; claconst reset = () =>update({ projectSettings: DEFAULT_SIDEBAR_PROJECT_SETTINGS, issueSettings: DEFAULT_SIDEBAR_ISSUE_SETTINGS });+ return (+ <SectionSettingsPopover+ label={t(($) => $.panels.work.projects_settings)}+ className={className}+ onReset={changed ? reset : undefined}+ >+ <ProjectsGroup settings={projectSettings} update={(patch) => update({ projectSettings: patch })} />+ <ProjectIssuesGroup+ wsId={wsId}+ settings={issueSettings}+ update={(patch) => update({ issueSettings: patch })}+ />+ </SectionSettingsPopover>+ );+}++/** The sliders button at the end of a section's label row, and its popover. */+function SectionSettingsPopover({+ label,+ className,+ onReset,+ children,+}: {+ label: string;+ className?: string;+ /** Offered while the section's settings differ from the defaults. */+ onReset?: () => void;+ children: React.ReactNode;+}) {+ const { t } = useT("layout");return (<Popover><PopoverTriggerrender={<buttontype="button"- aria-label={t(($) => $.panels.work.projects_settings)}+ aria-label={label}className={cn(TREE_ROW_BUTTON_CLASS,"text-muted-foreground data-popup-open:bg-surface-selected data-popup-open:text-foreground data-popup-open:opacity-100",@@ -287,15 +351,10 @@ export function ProjectsSectionSettings({ wsId, className }: { wsId: string; claclassName="max-h-(--available-height) w-80 gap-0 overflow-y-auto p-3">{/* Spacing separates sections — no dividers, as in the Display panel. */}- <ProjectsGroup settings={projectSettings} update={(patch) => update({ projectSettings: patch })} />- <ProjectIssuesGroup- wsId={wsId}- settings={issueSettings}- update={(patch) => update({ issueSettings: patch })}- />- {changed && (+ {children}+ {onReset && (<div className="-mr-1.5 mt-4 flex justify-end">- <Button variant="ghost" size="sm" className="text-muted-foreground" onClick={reset}>+ <Button variant="ghost" size="sm" className="text-muted-foreground" onClick={onReset}>{t(($) => $.panels.work.reset)}</Button></div>@@ -304,3 +363,163 @@ export function ProjectsSectionSettings({ wsId, className }: { wsId: string; cla</Popover>);}++function LimitField({ value, onChange }: { value: SidebarSectionLimit; onChange: (limit: SidebarSectionLimit) => void }) {+ const { t } = useT("layout");+ return (+ <Field label={t(($) => $.panels.work.section_limit)}>+ <SortSelect+ label={t(($) => $.panels.work.section_limit)}+ value={String(value)}+ options={LIMIT_OPTIONS}+ onChange={(next) => onChange(Number(next) as SidebarSectionLimit)}+ className="w-20"+ />+ </Field>+ );+}++/**+ * Which notifications reach the inbox at all: the account's notification+ * preferences for this workspace. A kind turned off is not delivered while it+ * is off; turning it back on does not bring those back. Mounted only while+ * the popover is open.+ */+function InboxNotificationTypes() {+ const { t } = useT("layout");+ const { t: ts } = useT("settings");+ const p = useWorkspacePaths();+ const wsId = useWorkspaceId();+ const { data } = useQuery(notificationPreferenceOptions(wsId));+ const updatePreferences = useUpdateNotificationPreferences();+ const preferences = data?.preferences ?? {};+ const toggleGroup = (key: NotificationGroupKey, enabled: boolean) => {+ const next: NotificationPreferences = { ...preferences, [key]: enabled ? "all" : "muted" };+ // "all" is the default; the stored object keeps only muted kinds.+ if (enabled) delete next[key];+ updatePreferences.mutate(next, {+ onError: (err) =>+ toast.error(err instanceof Error && err.message ? err.message : ts(($) => $.notifications.toast_failed)),+ });+ };++ return (+ <section className="mt-5 space-y-3">+ <div className="space-y-1">+ <h3 className="text-label font-medium text-foreground">{t(($) => $.panels.work.inbox_types)}</h3>+ <p className="text-caption text-muted-foreground">{t(($) => $.panels.work.inbox_types_hint)}</p>+ </div>+ {INBOX_NOTIFICATION_GROUPS.map((key) => (+ <SwitchField+ key={key}+ label={ts(($) => $.notifications.groups[key].label)}+ checked={preferences[key] !== "muted"}+ onChange={(enabled) => toggleGroup(key, enabled)}+ />+ ))}+ <AppLink+ href={`${p.settings()}?tab=notifications`}+ className="inline-block text-caption text-muted-foreground underline-offset-2 hover:text-foreground hover:underline"+ >+ {t(($) => $.panels.work.inbox_more_settings)}+ </AppLink>+ </section>+ );+}++/** The Inbox section's display, and which notifications reach the inbox. */+export function InboxSectionSettings({ className }: { className?: string }) {+ const { t } = useT("layout");+ const settings = useSidebarTreeStore((s) => s.inboxSettings);+ const update = useSidebarTreeStore((s) => s.setInboxSettings);++ return (+ <SectionSettingsPopover+ label={t(($) => $.panels.work.inbox_settings)}+ className={className}+ onReset={sameSettings(settings, DEFAULT_SIDEBAR_INBOX_SETTINGS) ? undefined : () => update(DEFAULT_SIDEBAR_INBOX_SETTINGS)}+ >+ <section className="space-y-3">+ <h3 className="text-label font-medium text-foreground">{t(($) => $.nav.inbox)}</h3>+ <LimitField value={settings.limit} onChange={(limit) => update({ limit })} />+ <SwitchField+ label={t(($) => $.panels.work.inbox_compact)}+ checked={settings.compact}+ onChange={(compact) => update({ compact })}+ />+ <SwitchField+ label={t(($) => $.panels.work.inbox_show_count)}+ checked={settings.showCount}+ onChange={(showCount) => update({ showCount })}+ />+ <SwitchField+ label={t(($) => $.panels.work.inbox_rail_badge)}+ checked={settings.railBadge}+ onChange={(railBadge) => update({ railBadge })}+ />+ </section>+ <InboxNotificationTypes />+ </SectionSettingsPopover>+ );+}++export function PinnedSectionSettings({ className }: { className?: string }) {+ const { t } = useT("layout");+ const limit = useSidebarTreeStore((s) => s.pinnedLimit);+ const setLimit = useSidebarTreeStore((s) => s.setPinnedLimit);+ return (+ <SectionSettingsPopover+ label={t(($) => $.panels.work.pinned_settings)}+ className={className}+ onReset={limit === 5 ? undefined : () => setLimit(5)}+ >+ <section className="space-y-3">+ <h3 className="text-label font-medium text-foreground">{t(($) => $.sidebar.pinned_label)}</h3>+ <LimitField value={limit} onChange={setLimit} />+ </section>+ </SectionSettingsPopover>+ );+}++/** Which built-in views the Views section lists. Mounted only while the popover is open. */+function BuiltinViewSwitches({ sidebar }: { sidebar: IssueViewActions["sidebar"] }) {+ const { t } = useT("layout");+ const builtinLabel = useBuiltinViewLabel();+ return (+ <section className="space-y-3">+ <h3 className="text-label font-medium text-foreground">{t(($) => $.panels.work.views_builtin)}</h3>+ {BUILTIN_VIEW_KEYS.map((key) => {+ const id = builtinViewItemId(key);+ return (+ <SwitchField+ key={key}+ label={builtinLabel(key)}+ checked={sidebar.isStarred(id)}+ onChange={(on) => (on ? sidebar.star(id) : sidebar.unstar(id))}+ />+ );+ })}+ </section>+ );+}++/** Which built-in views the Views section lists, and whether its rows show counts. */+export function ViewsSectionSettings({+ sidebar,+ className,+}: {+ sidebar: IssueViewActions["sidebar"];+ className?: string;+}) {+ const { t } = useT("layout");+ const showCount = useSidebarTreeStore((s) => s.viewsShowCount);+ const setShowCount = useSidebarTreeStore((s) => s.setViewsShowCount);+ return (+ <SectionSettingsPopover label={t(($) => $.panels.work.views_settings)} className={className}>+ <BuiltinViewSwitches sidebar={sidebar} />+ <section className="mt-5 space-y-3">+ <SwitchField label={t(($) => $.panels.work.views_show_count)} checked={showCount} onChange={setShowCount} />+ </section>+ </SectionSettingsPopover>+ );+}diff --git a/packages/views/layout/panels/sidebar-tree.tsx b/packages/views/layout/panels/sidebar-tree.tsxindex 475afc2053..b28158f448 100644--- a/packages/views/layout/panels/sidebar-tree.tsx+++ b/packages/views/layout/panels/sidebar-tree.tsx@@ -62,6 +62,90 @@ interface TreeRowProps extends React.ComponentProps<"div"> {rowRef?: React.Ref<HTMLDivElement>;}+// A step below the selected row: no fill, so it marks the place without+// competing with a lit row.+const TREE_ROW_LOCATED_CLASS =+ "data-located:font-medium data-located:text-foreground data-located:[&_svg_.icon-body]:fill-current data-located:[&_svg_.icon-body]:[fill-opacity:0.2]";++function treeRowKeyHandler(expanded: boolean, onExpandedChange: ((expanded: boolean) => void) | undefined) {+ return (event: React.KeyboardEvent) => {+ if (!onExpandedChange) return;+ if (event.key === "ArrowRight" && !expanded) {+ event.preventDefault();+ onExpandedChange(true);+ } else if (event.key === "ArrowLeft" && expanded) {+ event.preventDefault();+ onExpandedChange(false);+ }+ };+}++interface TreeToggleRowProps extends React.ComponentProps<"div"> {+ label: string;+ icon: React.ReactNode;+ located?: boolean;+ expanded: boolean;+ onExpandedChange: (expanded: boolean) => void;+ listId: string;+ onPrefetch?: () => void;+ trailing?: React.ReactNode;+ rowRef?: React.Ref<HTMLDivElement>;+}++/**+ * A tree row with no page of its own: the whole row expands it in place, and+ * the chevron takes the icon's place on hover as on `TreeRow`.+ */+export const TreeToggleRow = forwardRef<HTMLButtonElement, TreeToggleRowProps>(function TreeToggleRow(+ { label, icon, located = false, expanded, onExpandedChange, listId, onPrefetch, trailing, rowRef, className, ...rowProps },+ buttonRef,+) {+ const onKeyDown = treeRowKeyHandler(expanded, onExpandedChange);+ return (+ <div+ {...rowProps}+ ref={rowRef}+ data-located={located ? "" : undefined}+ className={cn(+ PANEL_ROW_CLASS,+ panelRowStateClass(false),+ "group/row relative",+ expanded && "text-foreground",+ TREE_ROW_LOCATED_CLASS,+ className,+ )}+ >+ <span className="relative flex size-4 shrink-0 items-center justify-center">+ <span className="flex group-hover/row:opacity-0 group-has-[:focus-visible]/row:opacity-0 [@media(pointer:coarse)]:opacity-0">+ {icon}+ </span>+ <ChevronRight+ aria-hidden+ className={cn(+ "absolute size-3.5 text-muted-foreground opacity-0 transition-transform duration-150 ease-out group-hover/row:opacity-100 group-has-[:focus-visible]/row:opacity-100 motion-reduce:transition-none [@media(pointer:coarse)]:opacity-100",+ expanded && "rotate-90",+ )}+ />+ </span>+ <TruncatedTooltip content={label}>+ <button+ ref={buttonRef}+ type="button"+ aria-expanded={expanded}+ aria-controls={expanded ? listId : undefined}+ onClick={() => onExpandedChange(!expanded)}+ onKeyDown={onKeyDown}+ onPointerEnter={onPrefetch}+ className="min-w-0 flex-1 truncate text-left outline-none after:absolute after:inset-0 after:rounded-lg focus-visible:after:outline-2 focus-visible:after:outline-ring"+ >+ {label}+ </button>+ </TruncatedTooltip>+ {trailing}+ </div>+ );+});+/*** A nav row that expands in place. The link stretches over the whole row so* the row still opens its page; the chevron, shown in the icon's place on@@ -89,16 +173,7 @@ export const TreeRow = forwardRef<HTMLAnchorElement, TreeRowProps>(function Tree},linkRef,) {- const onKeyDown = (event: React.KeyboardEvent) => {- if (!onExpandedChange) return;- if (event.key === "ArrowRight" && !expanded) {- event.preventDefault();- onExpandedChange(true);- } else if (event.key === "ArrowLeft" && expanded) {- event.preventDefault();- onExpandedChange(false);- }- };+ const onKeyDown = treeRowKeyHandler(!!expanded, onExpandedChange);return (<div@@ -111,9 +186,7 @@ export const TreeRow = forwardRef<HTMLAnchorElement, TreeRowProps>(function TreepanelRowStateClass(active),"group/row relative",expanded && !active && "text-foreground",- // A step below the selected row: no fill, so it marks the place- // without competing with a lit row.- "data-located:font-medium data-located:text-foreground data-located:[&_svg_.icon-body]:fill-current data-located:[&_svg_.icon-body]:[fill-opacity:0.2]",+ TREE_ROW_LOCATED_CLASS,className,)}>diff --git a/packages/views/layout/panels/views-section.tsx b/packages/views/layout/panels/views-section.tsxindex 326ff0d9b2..1a7c947531 100644--- a/packages/views/layout/panels/views-section.tsx+++ b/packages/views/layout/panels/views-section.tsx@@ -2,12 +2,11 @@import { useCallback, useId, useRef, useState } from "react";import { useQuery, useQueryClient } from "@tanstack/react-query";-import { useStore } from "zustand";import { DndContext, PointerSensor, closestCenter, useSensor, useSensors, type DragEndEvent } from "@dnd-kit/core";import { SortableContext, arrayMove, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";import { restrictToFirstScrollableAncestor, restrictToVerticalAxis } from "@dnd-kit/modifiers";import { CSS } from "@dnd-kit/utilities";-import { Bot, CircleUser, Copy, EyeOff, Filter, Layers, Link2, ListTodo, MoreHorizontal, Pencil, Plus, Trash2 } from "@multica/ui/icons";+import { Copy, EyeOff, Filter, Layers, Link2, MoreHorizontal, Pencil, Plus, Trash2 } from "@multica/ui/icons";import { cn } from "@multica/ui/lib/utils";import { IconButton } from "@multica/ui/components/common/icon-button";import {@@ -18,8 +17,9 @@ import {DropdownMenuTrigger,} from "@multica/ui/components/ui/dropdown-menu";import type { IssueView } from "@multica/core/api/schemas";-import { isMyAgentsSearch, useWorkspacePaths } from "@multica/core/paths";+import { useWorkspacePaths } from "@multica/core/paths";import { sidebarIssuesOptions } from "@multica/core/issues/queries";+import { workspaceWorkingAgentsOptions } from "@multica/core/agents";import {SIDEBAR_FIRST_PAGE,builtinSidebarRequest,@@ -35,11 +35,6 @@ import { filterDependencyState, statusCatalogSource } from "@multica/core/issuesimport { useIssueStatuses } from "@multica/core/issue-statuses/hooks";import { useSidebarProjectPrefs } from "@multica/core/issues/sidebar-project-prefs";import { useSidebarTreeStore } from "@multica/core/issues/stores/sidebar-tree-store";-import {- myIssuesRelationFromScope,- myIssuesScopeFor,- myIssuesViewStore,-} from "@multica/core/issues/stores/my-issues-view-store";import {issueViewContainerKey,useActiveIssueViewStore,@@ -54,24 +49,20 @@ import {type SidebarViewItem,} from "@multica/core/issue-views/sidebar-views";import { issueViewTarget } from "@multica/core/issue-views/view-target";-import { UNREAD_VIEW, UNREAD_VIEW_ID } from "@multica/core/issue-views/unread-view";import type { IssueViewActions } from "../../issue-views/use-view-actions";import { DeleteViewDialog } from "../../issue-views/delete-view-dialog";import { ViewNameInput } from "../../issue-views/view-name-input";-import { UnreadViewIcon } from "../../issue-views/unread-view-icon";-import { useBuiltinViewNavigation } from "../../issue-views/builtin-views";-import { useNavigation } from "../../navigation";+import { BUILTIN_VIEW_ICON, useBuiltinViewLabel, useBuiltinViewNavigation } from "../../issue-views/builtin-views";import { shouldOpenRowMenu, useRowMenu } from "../../common/point-menu";import { useT } from "../../i18n";import { PANEL_ROW_CLASS, PanelCount, PanelLink, PanelList, PanelSection, isPathWithin, panelRowAnchor, panelRowStateClass } from "../panel-nav";import { useDragClickGuard } from "../use-drag-click-guard";+import { SECTION_SETTINGS_REVEAL_CLASS, ViewsSectionSettings } from "./sidebar-settings";import { SidebarIssueList, TREE_ROW_BUTTON_CLASS, TreeRow } from "./sidebar-tree";const DRAG_MODIFIERS = [restrictToVerticalAxis, restrictToFirstScrollableAncestor];const EMPTY_VIEWS: IssueView[] = [];const WORKSPACE_SCOPE = { scope_type: "workspace" } as const;-const MY_SCOPE = { scope_type: "my" } as const;-const NO_SEARCH = new URLSearchParams();const ROW_MENU_CLASS = cn(TREE_ROW_BUTTON_CLASS,"text-muted-foreground opacity-0 group-hover/row:opacity-100 data-[popup-open]:opacity-100 [@media(pointer:coarse)]:opacity-100",@@ -91,8 +82,7 @@ interface ViewsSectionProps {/** The sidebar source of a starred view's issue list. */export function sidebarViewItemSource(item: SidebarViewItem): string {- if (item.kind === "view") return viewSidebarSource(item.view.id);- return item.key === "unread" ? viewSidebarSource(UNREAD_VIEW_ID) : builtinSidebarSource(item.key);+ return item.kind === "view" ? viewSidebarSource(item.view.id) : builtinSidebarSource(item.key);}/**@@ -116,6 +106,7 @@ export function ViewsSection({const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 5 } }));const collapsed = useSidebarTreeStore((s) => s.viewsCollapsed);const setCollapsed = useSidebarTreeStore((s) => s.setViewsCollapsed);+ const showCount = useSidebarTreeStore((s) => s.viewsShowCount);const { arm: armClickGuard, release: releaseClickGuard } = useDragClickGuard();const onDragEnd = useCallback(@@ -137,24 +128,27 @@ export function ViewsSection({collapsed={collapsed}onCollapsedChange={setCollapsed}action={- <IconButton- label={t(($) => $.panels.work.new_view)}- size="icon-xs"- className="text-muted-foreground"- onClick={() => {- // The new view lands in this list, so it has to be open. It is- // named in the page header, next to where its filters are set.- setCollapsed(false);- actions.create({- scope: WORKSPACE_SCOPE,- scopeVariant: null,- definition: issueViewSeedDefinition({ query: {}, display: {} }),- renameIn: "header",- });- }}- >- <Plus />- </IconButton>+ <>+ <ViewsSectionSettings sidebar={actions.sidebar} className={SECTION_SETTINGS_REVEAL_CLASS} />+ <IconButton+ label={t(($) => $.panels.work.new_view)}+ size="icon-xs"+ className="text-muted-foreground"+ onClick={() => {+ // The new view lands in this list, so it has to be open. It is+ // named in the page header, next to where its filters are set.+ setCollapsed(false);+ actions.create({+ scope: WORKSPACE_SCOPE,+ scopeVariant: null,+ definition: issueViewSeedDefinition({ query: {}, display: {} }),+ renameIn: "header",+ });+ }}+ >+ <Plus />+ </IconButton>+ </>}><DndContext@@ -181,15 +175,6 @@ export function ViewsSection({onDelete={setDeleteTarget}drag={drag}/>- ) : item.key === "unread" ? (- <UnreadViewRow- wsId={wsId}- pathname={pathname}- plainRowsLit={plainRowsLit}- activeIssueId={litSource === sidebarViewItemSource(item) ? activeIssueId : null}- actions={actions}- drag={drag}- />) : (<BuiltinViewRowwsId={wsId}@@ -214,7 +199,7 @@ export function ViewsSection({icon={<span className="size-4" aria-hidden />}label={t(($) => $.panels.work.all_views)}active={pathname === p.views()}- trailing={<PanelCount value={allViews.length + BUILTIN_VIEW_KEYS.length} />}+ trailing={showCount && <PanelCount value={allViews.length + BUILTIN_VIEW_KEYS.length} />}className="text-caption"/></PanelList>@@ -296,14 +281,6 @@ function RowMenu({);}-type ScopeBuiltinViewKey = Exclude<BuiltinViewKey, "unread">;--const BUILTIN_ICON: Record<ScopeBuiltinViewKey, React.ReactNode> = {- my_issues: <CircleUser className="size-4 shrink-0" />,- my_agents: <Bot className="size-4 shrink-0" />,- all_issues: <ListTodo className="size-4 shrink-0" />,-};-function BuiltinViewRow({wsId,builtin,@@ -315,7 +292,7 @@ function BuiltinViewRow({drag,}: {wsId: string;- builtin: ScopeBuiltinViewKey;+ builtin: BuiltinViewKey;pathname: string;plainRowsLit: boolean;issueInAllIssues: boolean;@@ -329,39 +306,40 @@ function BuiltinViewRow({const linkRef = useRef<HTMLAnchorElement>(null);const rowMenu = useRowMenu();const builtinNav = useBuiltinViewNavigation();- const { searchParams } = useNavigation();- const myScope = useStore(myIssuesViewStore, (s) => myIssuesScopeFor(NO_SEARCH, s.scope));const workspaceKey = issueViewContainerKey(wsId, WORKSPACE_SCOPE);- const myKey = issueViewContainerKey(wsId, MY_SCOPE);const activeWorkspaceView = useActiveIssueViewStore((s) => s.active[workspaceKey] ?? null);- const activeMyView = useActiveIssueViewStore((s) => s.active[myKey] ?? null);+ const showCount = useSidebarTreeStore((s) => s.viewsShowCount);- const onMyIssues = pathname === p.myIssues();const href = builtinNav.hrefFor(builtin);- const label =- builtin === "my_issues"- ? t(($) => $.nav.my_issues)- : builtin === "my_agents"- ? t(($) => $.panels.work.my_agents)- : t(($) => $.panels.work.all_issues);+ const label = useBuiltinViewLabel()(builtin);const active =plainRowsLit &&(builtin === "all_issues"? pathname === p.issues()? activeWorkspaceView === null: issueInAllIssues && isPathWithin(pathname, p.issues())- : onMyIssues && activeMyView === null && (builtin === "my_agents") === isMyAgentsSearch(searchParams));+ : pathname === p.issues() && activeWorkspaceView === builtin);const source = builtinSidebarSource(builtin);const expanded = useSidebarTreeStore((s) => s.expanded.includes(source));const setExpanded = useSidebarTreeStore((s) => s.setExpanded);const statusCatalog = useIssueStatuses(wsId);const { issueSettings } = useSidebarProjectPrefs(wsId);- const catalogDependency = filterDependencyState(true, [statusCatalogSource(statusCatalog)]);- const request = catalogDependency.unresolved+ // Working lists, and counts, the issues agents are running on right now.+ const working = useQuery({+ ...workspaceWorkingAgentsOptions(wsId, "issue"),+ enabled: builtin === "working",+ select: workingIssueIds,+ });+ const dependency = filterDependencyState(true, [+ statusCatalogSource(statusCatalog),+ ...(builtin === "working" ? [working] : []),+ ]);+ const request = dependency.unresolved? undefined- : builtinSidebarRequest(builtin, myIssuesRelationFromScope(myScope), issueSettings, statusCatalog.statuses);+ : builtinSidebarRequest(builtin, issueSettings, statusCatalog.statuses, working.data);const prefetch = usePrefetch(wsId, source, request);+ const count = builtin === "working" && showCount ? (working.data?.length ?? 0) : 0;return (<>@@ -371,7 +349,7 @@ function BuiltinViewRow({{...drag.listeners}href={href}label={label}- icon={BUILTIN_ICON[builtin]}+ icon={BUILTIN_VIEW_ICON[builtin]}active={active}expanded={expanded}onExpandedChange={(next) => setExpanded(source, next)}@@ -382,117 +360,24 @@ function BuiltinViewRow({if (shouldOpenRowMenu(event)) rowMenu.openAtPointer(event);}}onNavigateInPlace={() => builtinNav.prepare(builtin)}- trailing={- <RowMenu label={t(($) => $.panels.work.view_actions, { name: label })} state={rowMenu}>- <DropdownMenuItem onClick={() => actions.copyLink(href)}>- <Link2 className="size-3.5" />- {t(($) => $.panels.work.view_copy_link)}- </DropdownMenuItem>- <DropdownMenuSeparator />- <DropdownMenuItem onClick={() => actions.sidebar.unstar(builtinViewItemId(builtin))}>- <EyeOff className="size-3.5" />- {t(($) => $.panels.work.view_remove)}- </DropdownMenuItem>- </RowMenu>- }- />- {expanded && (- <SidebarIssueList- id={listId}- wsId={wsId}- source={source}- params={request}- paramsError={catalogDependency.error}- onRetry={catalogDependency.retry}- activeIssueId={activeIssueId}- onCollapse={() => {- setExpanded(source, false);- linkRef.current?.focus();- }}- />- )}- </>- );-}--/**- * The built-in Unread view, once the user stars it. The row stays when- * nothing is unread; only the count goes.- */-function UnreadViewRow({- wsId,- pathname,- plainRowsLit,- activeIssueId,- actions,- drag,-}: {- wsId: string;- pathname: string;- plainRowsLit: boolean;- activeIssueId: string | null;- actions: IssueViewActions;- drag: DragBindings;-}) {- const { t } = useT("layout");- const p = useWorkspacePaths();- const listId = useId();- const linkRef = useRef<HTMLAnchorElement>(null);- const rowMenu = useRowMenu();- const target = issueViewTarget(wsId, UNREAD_VIEW, p);- const open = useActiveIssueViewStore(- (s) => pathname === target.path && s.active[target.containerKey] === UNREAD_VIEW_ID,- );- const setActive = useActiveIssueViewStore((s) => s.setActive);- const source = viewSidebarSource(UNREAD_VIEW_ID);- const expanded = useSidebarTreeStore((s) => s.expanded.includes(source));- const setExpanded = useSidebarTreeStore((s) => s.setExpanded);- const unread = useIssueUnreadIds(wsId);- const unreadDependency = filterDependencyState(true, [unread]);- const count = unread.data?.length ?? 0;- const request = unreadDependency.unresolved- ? undefined- : viewSidebarRequest(UNREAD_VIEW, todayDateOnly(), unread.data);- const prefetch = usePrefetch(wsId, source, request);- const label = t(($) => $.panels.work.unread);-- return (- <>- <TreeRow- ref={linkRef}- rowRef={drag.rowRef}- {...drag.listeners}- href={target.href}- label={label}- icon={<UnreadViewIcon />}- active={plainRowsLit && open}- expanded={expanded}- onExpandedChange={(next) => setExpanded(source, next)}- listId={listId}- toggleLabel={t(($) => $.panels.work.project_issues, { name: label })}- onPrefetch={prefetch}- onContextMenu={(event) => {- if (shouldOpenRowMenu(event)) rowMenu.openAtPointer(event);- }}- onNavigateInPlace={() => setActive(target.containerKey, UNREAD_VIEW_ID)}trailing={// The menu button takes the count's place, so the row never reflows.<span className="relative flex h-5 min-w-5 items-center justify-end"><PanelCountvalue={count}- className="font-medium text-brand transition-opacity group-focus-within/row:opacity-0 group-hover/row:opacity-0 group-has-[[data-popup-open]]/row:opacity-0 [@media(pointer:coarse)]:opacity-0"+ className="transition-opacity group-focus-within/row:opacity-0 group-hover/row:opacity-0 group-has-[[data-popup-open]]/row:opacity-0 [@media(pointer:coarse)]:opacity-0"/><RowMenulabel={t(($) => $.panels.work.view_actions, { name: label })}state={rowMenu}className="absolute right-0">- <DropdownMenuItem onClick={() => actions.copyLink(target.href)}>+ <DropdownMenuItem onClick={() => actions.copyLink(href)}><Link2 className="size-3.5" />{t(($) => $.panels.work.view_copy_link)}</DropdownMenuItem><DropdownMenuSeparator />- <DropdownMenuItem onClick={() => actions.sidebar.unstar(builtinViewItemId("unread"))}>+ <DropdownMenuItem onClick={() => actions.sidebar.unstar(builtinViewItemId(builtin))}><EyeOff className="size-3.5" />{t(($) => $.panels.work.view_remove)}</DropdownMenuItem>@@ -506,8 +391,8 @@ function UnreadViewRow({wsId={wsId}source={source}params={request}- paramsError={unreadDependency.error}- onRetry={unreadDependency.retry}+ paramsError={dependency.error}+ onRetry={dependency.retry}activeIssueId={activeIssueId}onCollapse={() => {setExpanded(source, false);@@ -519,6 +404,10 @@ function UnreadViewRow({);}+function workingIssueIds(agents: readonly { issue_ids: readonly string[] }[]): string[] {+ return [...new Set(agents.flatMap((agent) => agent.issue_ids))].sort();+}+function SavedViewRow({wsId,item,diff --git a/packages/views/layout/panels/views-section.unread.test.tsx b/packages/views/layout/panels/views-section.unread.test.tsxindex f7a11414d7..b5b00c73c4 100644--- a/packages/views/layout/panels/views-section.unread.test.tsx+++ b/packages/views/layout/panels/views-section.unread.test.tsx@@ -6,9 +6,7 @@ import { setApiInstance } from "@multica/core/api";import type { ApiClient } from "@multica/core/api/client";import { useSidebarTreeStore } from "@multica/core/issues/stores/sidebar-tree-store";import { builtinSidebarSource, viewSidebarSource } from "@multica/core/issues/sidebar-list";-import { issueUnreadOptions } from "@multica/core/issues/unread";import { issueViewContainerKey, useActiveIssueViewStore } from "@multica/core/issue-views/active-view-store";-import { UNREAD_VIEW_ID } from "@multica/core/issue-views/unread-view";import { renderWithI18n } from "../../test/i18n";import { NavigationProvider, type NavigationAdapter } from "../../navigation";import { ViewsSection } from "./views-section";@@ -71,6 +69,7 @@ const UNREAD_VIEW = {let listIssueUnread: ReturnType<typeof vi.fn>;let listIssueTableRows: ReturnType<typeof vi.fn>;let listIssueStatuses: ReturnType<typeof vi.fn>;+let getWorkspaceWorkingAgents: ReturnType<typeof vi.fn>;function renderSection({ activeIssueId = null }: { activeIssueId?: string | null } = {}) {const qc = new QueryClient({ defaultOptions: { queries: { retry: false } } });@@ -83,7 +82,7 @@ function renderSection({ activeIssueId = null }: { activeIssueId?: string | nullplainRowsLitissueInAllIssues={false}activeIssueId={issueId}- litSource={viewSidebarSource(UNREAD_VIEW_ID)}+ litSource={null}actions={actions as unknown as IssueViewActions}/></NavigationProvider>@@ -104,10 +103,12 @@ beforeEach(() => {parent_id: null,}));listIssueStatuses = vi.fn(async () => ({ statuses: [], categories: [], total: 0 }));+ getWorkspaceWorkingAgents = vi.fn(async () => []);setApiInstance({listIssueUnread,listIssueTableRows,listIssueStatuses,+ getWorkspaceWorkingAgents,listIssueViews: vi.fn(async () => []),getIssueViewPreference: vi.fn(() => new Promise(() => {})),} as unknown as ApiClient);@@ -181,76 +182,80 @@ const TODO_STATUS = {updated_at: "",};-const mark = (issueId: string) => ({- issue_id: issueId,- outcome: "completed",- agent_id: null,- created_at: "2026-01-01T00:00:00Z",-});+describe("ViewsSection built-in filtered views", () => {+ const items = (...keys: string[]) => keys.map((key) => ({ id: `builtin:${key}`, kind: "builtin", key }));-describe("ViewsSection built-in Unread view", () => {beforeEach(() => {- actions.sidebar.items = [- { id: "builtin:all_issues", kind: "builtin", key: "all_issues" },- { id: "view:v1", kind: "view", view: UNREAD_VIEW },- ];+ listIssueUnread.mockResolvedValue([]);+ listIssueStatuses.mockResolvedValue({ statuses: [TODO_STATUS], categories: [], total: 1 });+ actions.sidebar.items = items("all_issues", "my_work", "working", "subscribed");useSidebarTreeStore.setState({ viewsCollapsed: false, expanded: [] });});- it("is not in the sidebar until starred, even with unread issues", async () => {- listIssueUnread.mockResolvedValue([mark("a"), mark("b")]);+ it("opens All issues under each built-in's filter", async () => {renderSection();- await waitFor(() => expect(listIssueUnread).toHaveBeenCalled());await screen.findByRole("link", { name: "All issues" });- expect(screen.queryByRole("link", { name: /^Unread/ })).toBeNull();+ const href = (name: string) => screen.getByRole("link", { name: new RegExp(`^${name}`) }).getAttribute("href");+ expect(href("My work")).toBe("/acme/issues?view=my_work");+ expect(href("Working")).toBe("/acme/issues?view=working");+ expect(href("Subscribed")).toBe("/acme/issues?view=subscribed");});- describe("once starred", () => {- beforeEach(() => {- actions.sidebar.items = [...actions.sidebar.items, { id: "builtin:unread", kind: "builtin", key: "unread" }];- });-- it("sits where it was starred, with the unread count", async () => {- listIssueUnread.mockResolvedValue([mark("a"), mark("b")]);- renderSection();- const link = await screen.findByRole("link", { name: /^Unread/ });- expect(link).toHaveAttribute("href", "/acme/issues?view=unread");- await waitFor(() => expect(link.closest("li")).toHaveTextContent(/^Unread2/));- const names = screen.getAllByRole("link").map((l) => l.textContent);- expect(names.slice(0, 3)).toEqual(["All issues", "Mine unread", "Unread"]);- });-- it("stays when the count reaches 0", async () => {- listIssueUnread.mockResolvedValue([mark("a")]);- const { qc } = renderSection({ activeIssueId: "a" });- const link = await screen.findByRole("link", { name: /^Unread/ });- await waitFor(() => expect(link.closest("li")).toHaveTextContent(/^Unread1/));+ it.each([+ ["my_work", "My work", { relations: ["assigned", "my_agents"] }],+ ["subscribed", "Subscribed", { relations: ["subscribed"] }],+ ])("lists %s's issues when expanded", async (key, name, filters) => {+ useSidebarTreeStore.setState({ expanded: [builtinSidebarSource(key as "my_work")] });+ renderSection();+ await screen.findByRole("link", { name });+ await waitFor(() =>+ expect(listIssueTableRows).toHaveBeenCalledWith(+ expect.objectContaining({+ query: expect.objectContaining({+ scope: { kind: "workspace" },+ filters: expect.objectContaining(filters),+ }),+ }),+ ),+ );+ });- qc.setQueryData(issueUnreadOptions("ws-1").queryKey, []);- await waitFor(() => expect(link.closest("li")).toHaveTextContent(/^Unread$/));- expect(screen.getByRole("link", { name: /^Unread/ })).toBe(link);- });+ it("counts and lists the issues agents are running on under Working", async () => {+ getWorkspaceWorkingAgents.mockResolvedValue([+ { id: "a1", name: "A", avatar_url: null, running_task_count: 2, issue_ids: ["i2", "i1"] },+ { id: "a2", name: "B", avatar_url: null, running_task_count: 1, issue_ids: ["i1"] },+ ]);+ useSidebarTreeStore.setState({ expanded: [builtinSidebarSource("working")] });+ renderSection();- it("lights while its page is open", async () => {- listIssueUnread.mockResolvedValue([]);- useActiveIssueViewStore- .getState()- .setActive(issueViewContainerKey("ws-1", { scope_type: "workspace" }), UNREAD_VIEW_ID);- renderSection();- const link = await screen.findByRole("link", { name: /^Unread/ });- expect(link).toHaveAttribute("aria-current", "page");- expect(screen.getByRole("link", { name: /^All issues/ })).not.toHaveAttribute("aria-current");- });+ const link = await screen.findByRole("link", { name: /^Working/ });+ await waitFor(() => expect(link.closest("div")).toHaveTextContent(/^Working2/));+ await waitFor(() =>+ expect(listIssueTableRows).toHaveBeenCalledWith(+ expect.objectContaining({+ query: expect.objectContaining({+ filters: expect.objectContaining({ working_issue_ids: ["i1", "i2"] }),+ }),+ }),+ ),+ );+ });- it("is removed from the sidebar from its row menu", async () => {- listIssueUnread.mockResolvedValue([]);- renderSection();- const link = await screen.findByRole("link", { name: /^Unread/ });+ it("lights while its page is open, instead of All issues", async () => {+ useActiveIssueViewStore+ .getState()+ .setActive(issueViewContainerKey("ws-1", { scope_type: "workspace" }), "subscribed");+ renderSection();+ const link = await screen.findByRole("link", { name: "Subscribed" });+ expect(link).toHaveAttribute("aria-current", "page");+ expect(screen.getByRole("link", { name: "All issues" })).not.toHaveAttribute("aria-current");+ });- fireEvent.contextMenu(link);- fireEvent.click(await screen.findByRole("menuitem", { name: "Remove from sidebar" }));- expect(actions.sidebar.unstar).toHaveBeenCalledWith("builtin:unread");- });+ it("is removed from the sidebar from its row menu", async () => {+ renderSection();+ fireEvent.contextMenu(await screen.findByRole("link", { name: "Subscribed" }));+ fireEvent.click(await screen.findByRole("menuitem", { name: "Remove from sidebar" }));+ expect(actions.sidebar.unstar).toHaveBeenCalledWith("builtin:subscribed");});});diff --git a/packages/views/layout/panels/work-panel.test.tsx b/packages/views/layout/panels/work-panel.test.tsxindex 0e034e6ffc..fe54d24dab 100644--- a/packages/views/layout/panels/work-panel.test.tsx+++ b/packages/views/layout/panels/work-panel.test.tsx@@ -7,15 +7,28 @@ import { EMPTY_ISSUE_VIEW_PREFERENCE } from "@multica/core/api/schemas";import { useActiveIssueViewStore } from "@multica/core/issue-views/active-view-store";import { issueViewPreferenceOptions } from "@multica/core/issue-views/preferences";import { issueViewEverywhereOptions } from "@multica/core/issue-views/queries";+import { inboxListOptions } from "@multica/core/inbox/queries";+import { useInboxSelectionStore } from "@multica/core/inbox/selection-store";import { issueDetailOptions, issueKeys } from "@multica/core/issues/queries";import { issueUnreadOptions } from "@multica/core/issues/unread";+import { NO_PROJECT_SIDEBAR_SOURCE } from "@multica/core/issues/sidebar-list";import { SIDEBAR_PROJECTS_SCOPE } from "@multica/core/issues/sidebar-project-prefs";import { useSidebarKeptStore } from "@multica/core/issues/stores/sidebar-kept-store";-import { useSidebarTreeStore } from "@multica/core/issues/stores/sidebar-tree-store";+import {+ DEFAULT_SIDEBAR_PROJECT_SETTINGS,+ useSidebarTreeStore,+} from "@multica/core/issues/stores/sidebar-tree-store";import { spaceForPath } from "@multica/core/paths";import { pinListOptions } from "@multica/core/pins/queries";import { projectListOptions } from "@multica/core/projects/queries";-import type { Issue, IssueTableRowsRequest, IssueTableRowsResponse, PinnedItem, Project } from "@multica/core/types";+import type {+ InboxItem,+ Issue,+ IssueTableRowsRequest,+ IssueTableRowsResponse,+ PinnedItem,+ Project,+} from "@multica/core/types";import { renderWithI18n } from "../../test/i18n";import { NavigationProvider, type NavigationAdapter } from "../../navigation";import { KeptRowsRelease, WorkPanel } from "./work-panel";@@ -24,7 +37,7 @@ const apiMock = vi.hoisted(() => ({ listIssueTableRows: vi.fn(), getIssue: vi.fnconst actions = vi.hoisted(() => ({sidebar: {items: [- { id: "builtin:my_issues", kind: "builtin", key: "my_issues" },+ { id: "builtin:my_work", kind: "builtin", key: "my_work" },{ id: "builtin:all_issues", kind: "builtin", key: "all_issues" },],reorder: vi.fn(),@@ -40,6 +53,7 @@ vi.mock("@multica/core/api", async (importOriginal) => ({vi.mock("../../issue-views/use-view-actions", () => ({ useIssueViewActions: () => actions }));vi.mock("../../issue-views/delete-view-dialog", () => ({ DeleteViewDialog: () => null }));vi.mock("../../issues/components/status-icon", () => ({ StatusIcon: () => <span /> }));+vi.mock("../../common/actor-avatar", () => ({ ActorAvatar: () => null }));vi.mock("@dnd-kit/core", () => ({DndContext: ({ children }: { children: ReactNode }) => <>{children}</>,PointerSensor: vi.fn(),@@ -104,6 +118,8 @@ const ISSUE = {title: "Fix the sidebar",status: "todo",} as Issue;+// An Inbox row's link also reads out who did what, after the title.+const INBOX_ROW_NAME = new RegExp(`^${ISSUE.title}`);const OTHER = {id: "7b9e2c41-0d3a-4f6b-8e7c-2a1b0c9d8e7f",identifier: "MUL-2",@@ -137,8 +153,10 @@ function renderPanel(pins: PinnedItem[] = [],projects: Project[] = [],unreadIssueIds: string[] = [],+ inbox: InboxItem[] = [],) {const qc = new QueryClient({ defaultOptions: { queries: { staleTime: Infinity, retry: false } } });+ qc.setQueryData(inboxListOptions("ws-1").queryKey, inbox);qc.setQueryData(projectListOptions("ws-1").queryKey, { projects, total: projects.length });qc.setQueryData(pinListOptions("ws-1", "u1").queryKey, pins);qc.setQueryData(issueViewEverywhereOptions("ws-1").queryKey, []);@@ -175,8 +193,8 @@ function renderPanel(<NavigationProvider value={adapter}><KeptRowsRelease />{sheetOpen && spaceForPath(pathname) === "work" && <WorkPanel />}- <button type="button" onClick={() => setPathname("/acme/inbox")}>- Visit inbox+ <button type="button" onClick={() => setPathname("/acme/agents")}>+ Leave Work</button><button type="button" onClick={() => setPathname(`/acme/issues/${ISSUE.id}`)}>Return to issue@@ -206,16 +224,19 @@ function renderPanel(const issueRow = () => screen.getByRole("link", { name: ISSUE.title });const allIssues = () => screen.getByRole("link", { name: "All issues" });+const noProjectLocated = () => !!screen.getByRole("button", { name: "No project" }).closest("[data-located]");beforeEach(() => {useSidebarTreeStore.setState({- expanded: ["builtin:my_issues"],+ expanded: ["builtin:my_work"],viewsCollapsed: false,pinnedCollapsed: false,projectsCollapsed: false,+ projectSettings: DEFAULT_SIDEBAR_PROJECT_SETTINGS,});useActiveIssueViewStore.setState({ active: {} });useSidebarKeptStore.setState({ held: {} });+ useInboxSelectionStore.setState({ sidebarIssueByWorkspace: {} });apiMock.listIssueTableRows.mockResolvedValue({rows: [ISSUE, OTHER].map((issue) => ({ issue })),total: 2,@@ -225,6 +246,85 @@ beforeEach(() => {apiMock.getIssue.mockReturnValue(new Promise<Issue>(() => {}));});+function inboxItem(issue: Issue): InboxItem {+ return {+ id: `inbox-${issue.id}`,+ workspace_id: "ws-1",+ recipient_type: "member",+ recipient_id: "u1",+ actor_type: "agent",+ actor_id: "agent-1",+ type: "new_comment",+ severity: "info",+ issue_id: issue.id,+ title: issue.title,+ body: null,+ issue_status: issue.status,+ issue_priority: "none",+ read: false,+ archived: false,+ created_at: "2026-11-10T08:00:00Z",+ details: null,+ };+}++describe("WorkPanel sections", () => {+ it("orders Inbox, Pinned, Views, Projects", () => {+ renderPanel("/acme/my-issues", [PIN], [PROJECT]);+ const labels = Array.from(document.querySelectorAll("[data-mc='panel-section'] h3"), (h) => h.textContent);+ expect(labels).toEqual(["Inbox", "Pinned", "Views", "Projects"]);+ });+});++describe("WorkPanel Inbox highlight", () => {+ const inInbox = () => document.querySelector('[data-sidebar-list="inbox"]') as HTMLElement;+ const inMyIssues = () => document.querySelector('[data-sidebar-list="builtin:my_work"]') as HTMLElement;++ it("lights an issue opened from the Inbox there only", async () => {+ renderPanel("/acme/my-issues", [], [], [], [inboxItem(ISSUE)]);+ await within(await waitFor(inMyIssues)).findByRole("link", { name: ISSUE.title });+ fireEvent.click(within(inInbox()).getByRole("link", { name: INBOX_ROW_NAME }));++ expect(within(inInbox()).getByRole("link", { name: INBOX_ROW_NAME })).toHaveAttribute("aria-current", "page");+ expect(within(inMyIssues()).getByRole("link", { name: ISSUE.title })).not.toHaveAttribute("aria-current");+ expect(allIssues()).not.toHaveAttribute("aria-current");+ });++ it("moves the light to the list the issue is clicked in next", async () => {+ renderPanel("/acme/my-issues", [], [], [], [inboxItem(ISSUE)]);+ await within(await waitFor(inMyIssues)).findByRole("link", { name: ISSUE.title });+ fireEvent.click(within(inInbox()).getByRole("link", { name: INBOX_ROW_NAME }));+ fireEvent.click(within(inMyIssues()).getByRole("link", { name: ISSUE.title }));++ expect(within(inMyIssues()).getByRole("link", { name: ISSUE.title })).toHaveAttribute("aria-current", "page");+ expect(within(inInbox()).getByRole("link", { name: INBOX_ROW_NAME })).not.toHaveAttribute("aria-current");+ });++ it("lights the issue the issue header moved on to from the Inbox", async () => {+ useInboxSelectionStore.setState({ sidebarIssueByWorkspace: { "ws-1": ISSUE.id } });+ renderPanel(`/acme/issues/${ISSUE.id}`, [], [], [], [inboxItem(ISSUE)]);++ await waitFor(() =>+ expect(within(inInbox()).getByRole("link", { name: INBOX_ROW_NAME })).toHaveAttribute("aria-current", "page"),+ );+ expect(allIssues()).not.toHaveAttribute("aria-current");+ });++ it("falls back to the other lists once the notification is archived", async () => {+ const qc = renderPanel("/acme/my-issues", [], [], [], [inboxItem(ISSUE)]);+ await within(await waitFor(inMyIssues)).findByRole("link", { name: ISSUE.title });+ fireEvent.click(within(inInbox()).getByRole("link", { name: INBOX_ROW_NAME }));+ act(() => {+ qc.setQueryData(inboxListOptions("ws-1").queryKey, [{ ...inboxItem(ISSUE), archived: true }]);+ });++ await waitFor(() =>+ expect(within(inMyIssues()).getByRole("link", { name: ISSUE.title })).toHaveAttribute("aria-current", "page"),+ );+ expect(inInbox()).toBeNull();+ });+});+describe("WorkPanel issue highlight", () => {it("lights a clicked tree issue at once, never All issues first", async () => {renderPanel("/acme/my-issues");@@ -248,7 +348,7 @@ describe("WorkPanel issue highlight", () => {expect(issueRow()).toHaveAttribute("aria-current", "page");});- it("leaves All issues lit for an issue no expanded row lists", async () => {+ it("marks No project for an issue without a project no expanded row lists", async () => {const qc = renderPanel("/acme/issues/9c8d7e6f-5a4b-4c3d-8e2f-1a0b9c8d7e6f");act(() => {qc.setQueryData(issueDetailOptions("ws-1", "9c8d7e6f-5a4b-4c3d-8e2f-1a0b9c8d7e6f").queryKey, {@@ -258,7 +358,8 @@ describe("WorkPanel issue highlight", () => {});await screen.findByRole("link", { name: ISSUE.title });- expect(allIssues()).toHaveAttribute("aria-current", "page");+ await waitFor(() => expect(noProjectLocated()).toBe(true));+ expect(allIssues()).not.toHaveAttribute("aria-current");});it("keeps an issue its list drops lit in place until another issue opens", async () => {@@ -324,12 +425,12 @@ describe("WorkPanel issue highlight", () => {await act(() => qc.invalidateQueries({ queryKey: issueKeys.sidebarAll("ws-1") }));await screen.findByRole("link", { name: "Fixed the sidebar" });- fireEvent.click(screen.getByRole("button", { name: "Visit inbox" }));+ fireEvent.click(screen.getByRole("button", { name: "Leave Work" }));fireEvent.click(screen.getByRole("button", { name: "Return to issue" }));expect(await screen.findByRole("link", { name: OTHER.title })).toBeInTheDocument();expect(screen.queryByRole("link", { name: "Fixed the sidebar" })).toBeNull();- expect(allIssues()).toHaveAttribute("aria-current", "page");+ expect(noProjectLocated()).toBe(true);});it("keeps the open project in the tree after it leaves the projects filter", async () => {@@ -377,11 +478,11 @@ describe("WorkPanel and the open issue's project", () => {});it("lights the issue only in the list it was clicked in", async () => {- useSidebarTreeStore.setState({ expanded: ["builtin:my_issues", PROJECT_SOURCE] });+ useSidebarTreeStore.setState({ expanded: ["builtin:my_work", PROJECT_SOURCE] });const qc = renderPanel("/acme/my-issues", [], [PROJECT]);await openInProject(qc);await waitFor(() => expect(screen.getAllByRole("link", { name: ISSUE.title })).toHaveLength(2));- const inMyIssues = document.querySelector('[data-sidebar-list="builtin:my_issues"]') as HTMLElement;+ const inMyIssues = document.querySelector('[data-sidebar-list="builtin:my_work"]') as HTMLElement;fireEvent.click(within(inMyIssues).getByRole("link", { name: ISSUE.title }));expect(litIssueRows()).toEqual([within(inMyIssues).getByRole("link", { name: ISSUE.title })]);@@ -397,14 +498,45 @@ describe("WorkPanel and the open issue's project", () => {expect(useSidebarTreeStore.getState().expanded).toEqual([]);});- it("lights All issues for an issue without a project that no list shows", async () => {+ it("marks No project for an issue without a project that no list shows", async () => {useSidebarTreeStore.setState({ expanded: [] });const qc = renderPanel(`/acme/issues/${ISSUE.id}`, [], [PROJECT]);act(() => {qc.setQueryData(issueDetailOptions("ws-1", ISSUE.id).queryKey, ISSUE);});+ await waitFor(() => expect(noProjectLocated()).toBe(true));+ expect(allIssues()).not.toHaveAttribute("aria-current");+ });++ it("lights the issue in the expanded No project row", async () => {+ useSidebarTreeStore.setState({ expanded: [NO_PROJECT_SIDEBAR_SOURCE] });+ const qc = renderPanel(`/acme/issues/${ISSUE.id}`, [], [PROJECT]);+ act(() => {+ qc.setQueryData(issueDetailOptions("ws-1", ISSUE.id).queryKey, ISSUE);+ });++ const list = await waitFor(+ () => document.querySelector(`[data-sidebar-list="${NO_PROJECT_SIDEBAR_SOURCE}"]`) as HTMLElement,+ );+ await waitFor(() =>+ expect(within(list).getByRole("link", { name: ISSUE.title })).toHaveAttribute("aria-current", "page"),+ );+ expect(allIssues()).not.toHaveAttribute("aria-current");+ });++ it("lights All issues for an issue without a project once No project is hidden", async () => {+ useSidebarTreeStore.setState({+ expanded: [],+ projectSettings: { ...DEFAULT_SIDEBAR_PROJECT_SETTINGS, showNoProject: false },+ });+ const qc = renderPanel(`/acme/issues/${ISSUE.id}`, [], [PROJECT]);+ act(() => {+ qc.setQueryData(issueDetailOptions("ws-1", ISSUE.id).queryKey, ISSUE);+ });+await waitFor(() => expect(allIssues()).toHaveAttribute("aria-current", "page"));+ expect(screen.queryByRole("button", { name: "No project" })).toBeNull();});it("does not light All issues for an issue under the collapsed Projects section", async () => {@@ -437,7 +569,7 @@ describe("WorkPanel and the open issue's project", () => {const qc = renderPanel("/acme/my-issues", [], [PROJECT]);await openInProject(qc);const inMyIssues = await waitFor(() => {- const element = document.querySelector('[data-sidebar-list="builtin:my_issues"]') as HTMLElement;+ const element = document.querySelector('[data-sidebar-list="builtin:my_work"]') as HTMLElement;expect(within(element).getByRole("link", { name: ISSUE.title })).toBeInTheDocument();return element;});@@ -491,58 +623,3 @@ describe("WorkPanel and the open issue's project", () => {await waitFor(() => expect(useSidebarTreeStore.getState().locate).toBeNull());});});--describe("WorkPanel starred Unread view after its last issue is read", () => {- const unreadRow = (scope: Pick<typeof screen, "queryByRole"> = screen) =>- scope.queryByRole("link", { name: /^Unread/ });- const defaultItems = actions.sidebar.items;-- beforeEach(() => {- actions.sidebar.items = [...defaultItems, { id: "builtin:unread", kind: "builtin", key: "unread" }];- return () => {- actions.sidebar.items = defaultItems;- };- });-- async function openAndReadLastUnread() {- useSidebarTreeStore.setState({ expanded: ["view:unread"] });- apiMock.listIssueTableRows.mockResolvedValue({ rows: [{ issue: ISSUE }], total: 1, next_cursor: null });- const qc = renderPanel("/acme/my-issues", [], [], [ISSUE.id]);- // The unread dot's label is part of the link's name until it is read.- fireEvent.click(await screen.findByRole("link", { name: new RegExp(`^${ISSUE.title}`) }));- apiMock.listIssueTableRows.mockResolvedValue({ rows: [], total: 0, next_cursor: null });- await act(async () => {- qc.setQueryData(issueDetailOptions("ws-1", ISSUE.id).queryKey, ISSUE);- qc.setQueryData(issueUnreadOptions("ws-1").queryKey, []);- });- await waitFor(() => expect(unreadRow()?.closest("li")).toHaveTextContent(/^Unread/));- expect(unreadRow()?.closest("li")).not.toHaveTextContent("Unread1");- expect(issueRow()).toHaveAttribute("aria-current", "page");- return qc;- }-- it("keeps the row and the open issue in the hover peek", async () => {- await openAndReadLastUnread();- fireEvent.click(screen.getByRole("button", { name: "Open peek" }));- const peek = within(screen.getByTestId("peek"));- expect(unreadRow(peek)).not.toBeNull();- expect(peek.getByRole("link", { name: ISSUE.title })).toHaveAttribute("aria-current", "page");- });-- it("keeps the row and the open issue when the compact sheet reopens", async () => {- await openAndReadLastUnread();- fireEvent.click(screen.getByRole("button", { name: "Toggle sheet" }));- fireEvent.click(screen.getByRole("button", { name: "Toggle sheet" }));- expect(unreadRow()).not.toBeNull();- expect(issueRow()).toHaveAttribute("aria-current", "page");- });-- it("keeps the row but drops the read issue once it is no longer the page", async () => {- await openAndReadLastUnread();- fireEvent.click(screen.getByRole("button", { name: "Visit inbox" }));- fireEvent.click(screen.getByRole("button", { name: "Return to issue" }));- await screen.findByRole("link", { name: "All issues" });- expect(unreadRow()).not.toBeNull();- await waitFor(() => expect(screen.queryByRole("link", { name: ISSUE.title })).toBeNull());- });-});diff --git a/packages/views/layout/panels/work-panel.tsx b/packages/views/layout/panels/work-panel.tsxindex d3521e7f2c..9827deee4f 100644--- a/packages/views/layout/panels/work-panel.tsx+++ b/packages/views/layout/panels/work-panel.tsx@@ -6,7 +6,8 @@ import { useAuthStore } from "@multica/core/auth";import { useCurrentWorkspace, useWorkspacePaths } from "@multica/core/paths";import { isIssueUuid } from "@multica/core/issues/canonical-id";import { issueDetailOptions } from "@multica/core/issues/queries";-import { projectSidebarSource, sidebarProjects } from "@multica/core/issues/sidebar-list";+import { useInboxSelectionStore } from "@multica/core/inbox/selection-store";+import { NO_PROJECT_SIDEBAR_SOURCE, projectSidebarSource, sidebarProjects } from "@multica/core/issues/sidebar-list";import { useSidebarProjectPrefs } from "@multica/core/issues/sidebar-project-prefs";import { useSidebarKeptStore } from "@multica/core/issues/stores/sidebar-kept-store";import { useSidebarTreeStore } from "@multica/core/issues/stores/sidebar-tree-store";@@ -17,6 +18,7 @@ import { IssueContextMenuProvider } from "../../issues/actions";import { useIssueViewActions } from "../../issue-views/use-view-actions";import { useT } from "../../i18n";import { PanelBody, PanelHeader, isPathWithin } from "../panel-nav";+import { INBOX_LIST, InboxSection, useInboxSectionRows } from "./inbox-section";import { PinnedSection, usePanelPins } from "./pinned-section";import { useKeptActiveItem } from "./sidebar-tree";import { ProjectsSection, useIssueInTree } from "./work-tree";@@ -66,7 +68,7 @@ export function KeptRowsRelease() {export function WorkPanel() {const { t } = useT("layout");const p = useWorkspacePaths();- const { pathname } = useNavigation();+ const { pathname, searchParams } = useNavigation();const wsId = useCurrentWorkspace()?.id;const userId = useAuthStore((s) => s.user?.id);const viewActions = useIssueViewActions();@@ -97,7 +99,23 @@ export function WorkPanel() {(clickedIssue.segment === currentIssueId || clickedIssue.segment === currentIssue?.identifier)? clickedIssue.list: undefined;- const treeClaimsIssue = clickedList !== undefined && clickedList !== PINS_LIST;+ // An issue opened from the Inbox, by a row or by the issue header moving on+ // to the next notification, lights there while the section still shows it;+ // once archived, it falls back to the other lists.+ const inboxIssueId = useInboxSelectionStore((s) => (wsId ? s.sidebarIssueByWorkspace[wsId] : null));+ // The notification open beside the section: an issue opened from it, or an+ // issue-less one on the Inbox page.+ const inboxOpenKey =+ pathname === p.inbox()+ ? searchParams.get("issue")+ : currentIssueId && inboxIssueId === currentIssueId+ ? currentIssueId+ : null;+ const inboxRows = useInboxSectionRows(wsId, inboxOpenKey);+ const rememberSidebarIssue = useInboxSelectionStore((s) => s.rememberSidebarIssue);+ const inboxClaimsIssue =+ !!currentIssueId && inboxIssueId === currentIssueId && inboxRows.shownIssueIds.has(currentIssueId);+ const treeClaimsIssue = inboxClaimsIssue || (clickedList !== undefined && clickedList !== PINS_LIST);const pins = usePanelPins(wsId, userId, pathname, treeClaimsIssue ? null : currentIssueId);const requestLocate = useSidebarTreeStore((s) => s.requestLocate);const rememberClickedIssue = (event: React.MouseEvent) => {@@ -110,6 +128,8 @@ export function WorkPanel() {? PINS_LIST: (link.closest("[data-sidebar-list]")?.getAttribute("data-sidebar-list") ?? null);setClickedIssue(segment ? { segment, list } : null);+ // Inbox rows link by issue id, which is what the issue header compares.+ if (segment && wsId) rememberSidebarIssue(wsId, list === INBOX_LIST ? segment : null);};const { projectSettings, projectOrder } = useSidebarProjectPrefs(wsId ?? "");@@ -126,30 +146,43 @@ export function WorkPanel() {// user toggles a row or asks to show the issue there.const projectsCollapsed = useSidebarTreeStore((s) => s.projectsCollapsed);const issueProjectId = currentIssue?.project_id ?? null;- const issueProject =- !projectsCollapsed && issueProjectId ? shownProjects.find((project) => project.id === issueProjectId) : undefined;- const issueProjectSource = issueProject ? projectSidebarSource(issueProject.id) : null;- // An expanded project always lists its open issue (`ownsOpen`).- const issueProjectExpanded = useSidebarTreeStore(- (s) => !!issueProjectSource && s.expanded.includes(issueProjectSource),- );- const listing = issueProjectExpanded ? [...inTree.sources, issueProjectSource!] : inTree.sources;+ const showNoProject = !projectsCollapsed && projectSettings.showNoProject;+ // The Projects row the open issue belongs under: its project's, or "No project".+ const issueHomeSource = projectsCollapsed+ ? null+ : issueProjectId+ ? shownProjects.some((project) => project.id === issueProjectId)+ ? projectSidebarSource(issueProjectId)+ : null+ : currentIssue && showNoProject+ ? NO_PROJECT_SIDEBAR_SOURCE+ : null;+ // An expanded row always lists its open issue (`ownsOpen`).+ const issueHomeExpanded = useSidebarTreeStore((s) => !!issueHomeSource && s.expanded.includes(issueHomeSource));+ const listing = issueHomeExpanded ? [...inTree.sources, issueHomeSource!] : inTree.sources;const listOrder = [...viewActions.sidebar.items.map(sidebarViewItemSource),...shownProjects.map((project) => projectSidebarSource(project.id)),+ ...(showNoProject ? [NO_PROJECT_SIDEBAR_SOURCE] : []),];const litSource =- !plainRowsLit || !currentIssueId+ !plainRowsLit || !currentIssueId || inboxClaimsIssue? null: clickedList && listing.includes(clickedList)? clickedList- : issueProjectExpanded- ? issueProjectSource+ : issueHomeExpanded+ ? issueHomeSource: (listOrder.find((source) => listing.includes(source)) ?? null);- const locatedProjectId = plainRowsLit && !litSource && issueProject ? issueProject.id : null;+ const locatedSource = plainRowsLit && !inboxClaimsIssue && !litSource ? issueHomeSource : null;// An issue in a project the panel hides, or under the collapsed Projects// section, stays unmarked rather than lighting a list that may not show it.- const issueInAllIssues = plainRowsLit && !!currentIssue && !currentIssue.project_id && litSource === null;+ const issueInAllIssues =+ plainRowsLit &&+ !inboxClaimsIssue &&+ !!currentIssue &&+ !currentIssue.project_id &&+ litSource === null &&+ locatedSource === null;const locate = useSidebarTreeStore((s) => s.locate);const setExpanded = useSidebarTreeStore((s) => s.setExpanded);@@ -169,14 +202,11 @@ export function WorkPanel() {<IssueContextMenuProvider variant="sidebar"><PanelBody onClickCapture={rememberClickedIssue}>{wsId && (- <ViewsSection+ <InboxSectionwsId={wsId}+ rows={inboxRows}pathname={pathname}- plainRowsLit={plainRowsLit}- issueInAllIssues={issueInAllIssues}- activeIssueId={currentIssueId}- litSource={litSource}- actions={viewActions}+ activeIssueId={inboxClaimsIssue ? currentIssueId : null}/>)}@@ -186,6 +216,18 @@ export function WorkPanel() {</div>)}+ {wsId && (+ <ViewsSection+ wsId={wsId}+ pathname={pathname}+ plainRowsLit={plainRowsLit}+ issueInAllIssues={issueInAllIssues}+ activeIssueId={currentIssueId}+ litSource={litSource}+ actions={viewActions}+ />+ )}+{wsId && (<ProjectsSectionwsId={wsId}@@ -196,7 +238,7 @@ export function WorkPanel() {plainRowsLit={plainRowsLit}activeIssueId={currentIssueId}litSource={litSource}- locatedProjectId={locatedProjectId}+ locatedSource={locatedSource}/>)}</PanelBody>diff --git a/packages/views/layout/panels/work-tree.catalog.test.tsx b/packages/views/layout/panels/work-tree.catalog.test.tsxindex fe4778e1c4..6814a02a70 100644--- a/packages/views/layout/panels/work-tree.catalog.test.tsx+++ b/packages/views/layout/panels/work-tree.catalog.test.tsx@@ -71,7 +71,7 @@ function renderSection() {plainRowsLitactiveIssueId={null}litSource={null}- locatedProjectId={null}+ locatedSource={null}/></NavigationProvider></QueryClientProvider>,diff --git a/packages/views/layout/panels/work-tree.test.tsx b/packages/views/layout/panels/work-tree.test.tsxindex 382dc462a9..7a6e229af8 100644--- a/packages/views/layout/panels/work-tree.test.tsx+++ b/packages/views/layout/panels/work-tree.test.tsx@@ -6,11 +6,19 @@ import type { DragEndEvent } from "@dnd-kit/core";import type { IssueViewPreference } from "@multica/core/api/schemas";import { issueViewPreferenceOptions } from "@multica/core/issue-views/preferences";import { buildIssueStatusCatalog } from "@multica/core/issue-statuses/queries";+import { issueTableFacetsOptions } from "@multica/core/issues/queries";+import {+ NO_PROJECT_FACET_KEY,+ NO_PROJECT_ORDER_ID,+ NO_PROJECT_SIDEBAR_SOURCE,+ noProjectCountRequest,+} from "@multica/core/issues/sidebar-list";import { SIDEBAR_PROJECTS_SCOPE } from "@multica/core/issues/sidebar-project-prefs";import {DEFAULT_SIDEBAR_ISSUE_SETTINGS,DEFAULT_SIDEBAR_PROJECT_SETTINGS,useSidebarTreeStore,+ type SidebarProjectSettings,} from "@multica/core/issues/stores/sidebar-tree-store";import type { Project } from "@multica/core/types";import { renderWithI18n } from "../../test/i18n";@@ -93,14 +101,23 @@ const savedPrefs = (prefs: Record<string, unknown>): IssueViewPreference => ({prefs: { hidden: [], order: [], ...prefs },});-function renderSection(projects = PROJECTS) {- const qc = new QueryClient({ defaultOptions: { queries: { enabled: false } } });+function renderSection(+ projects = PROJECTS,+ projectSettings: Partial<SidebarProjectSettings> = {},+ order: string[] = ["p9"],+) {+ const qc = new QueryClient({ defaultOptions: { queries: { enabled: false, retry: false } } });+ qc.setQueryData(issueTableFacetsOptions("ws-1", noProjectCountRequest([])).queryKey, {+ query_fingerprint: "",+ total: 0,+ facets: [{ kind: "project", values: [{ key: "p1", count: 3 }, { key: NO_PROJECT_FACET_KEY, count: 7 }] }],+ });qc.setQueryData(issueViewPreferenceOptions("ws-1", SIDEBAR_PROJECTS_SCOPE).queryKey,savedPrefs({- projects: { ...DEFAULT_SIDEBAR_PROJECT_SETTINGS, ordering: "name" },+ projects: { ...DEFAULT_SIDEBAR_PROJECT_SETTINGS, ordering: "name", ...projectSettings },issues: DEFAULT_SIDEBAR_ISSUE_SETTINGS,- order: ["p9"],+ order,}),);renderWithI18n(@@ -114,12 +131,17 @@ function renderSection(projects = PROJECTS) {plainRowsLitactiveIssueId={null}litSource={null}- locatedProjectId={null}+ locatedSource={null}/></QueryClientProvider>,);}+const rowNames = () =>+ screen+ .getAllByRole("button", { name: /^(No project|Issues in .+)$/ })+ .map((button) => button.getAttribute("aria-label")?.replace(/^Issues in /, "") ?? button.textContent);+describe("ProjectsSection", () => {it("shows the project's chosen icon, keeping the folder when it has none", () => {renderSection([project("p1", "Desktop", "🚀"), project("p2", "Mobile")]);@@ -159,7 +181,7 @@ describe("ProjectsSection", () => {act(() => dnd.onDragEnd?.({ active: { id: "p3" }, over: { id: "p1" } } as DragEndEvent));await waitFor(() => expect(apiMock.putIssueViewPreference).toHaveBeenCalledTimes(1));const { prefs } = apiMock.putIssueViewPreference.mock.calls[0]![0];- expect(prefs.order).toEqual(["p3", "p1", "p2", "p9"]);+ expect(prefs.order).toEqual([NO_PROJECT_ORDER_ID, "p3", "p1", "p2", "p9"]);expect(prefs.projects.ordering).toBe("manual");});@@ -205,6 +227,49 @@ describe("ProjectsSection", () => {expect(openCreateIssue).toHaveBeenCalledWith({ project_id: "p2" });});+ it("lists issues outside every project under No project, which only expands", () => {+ renderSection();+ expect(screen.queryByRole("link", { name: "No project" })).toBeNull();++ fireEvent.click(screen.getByRole("button", { name: "No project" }));+ expect(useSidebarTreeStore.getState().expanded).toEqual([NO_PROJECT_SIDEBAR_SOURCE]);+ expect(screen.getByRole("button", { name: "No project" })).toHaveAttribute("aria-expanded", "true");+ expect(document.querySelector(`[data-sidebar-list="${NO_PROJECT_SIDEBAR_SOURCE}"]`)).not.toBeNull();+ });++ it("counts the open issues outside every project", () => {+ renderSection();+ expect(screen.getByRole("button", { name: "No project" }).parentElement).toHaveTextContent("7");+ });++ it("creates an issue without a project from the No project row", () => {+ renderSection();+ openCreateIssue.mockClear();+ fireEvent.click(screen.getByRole("button", { name: "New issue without a project" }));+ expect(openCreateIssue).toHaveBeenCalledWith({ project_id: null });+ });++ it("lists No project first, and saves where it is dragged", async () => {+ renderSection();+ expect(rowNames()).toEqual(["No project", "Desktop", "Mobile", "Web"]);++ act(() => dnd.onDragEnd?.({ active: { id: NO_PROJECT_ORDER_ID }, over: { id: "p2" } } as DragEndEvent));+ await waitFor(() => expect(apiMock.putIssueViewPreference).toHaveBeenCalledTimes(1));+ const { prefs } = apiMock.putIssueViewPreference.mock.calls[0]![0];+ expect(prefs.order).toEqual(["p1", "p2", NO_PROJECT_ORDER_ID, "p3", "p9"]);+ expect(prefs.projects.ordering).toBe("manual");+ });++ it("keeps No project where it was dragged", () => {+ renderSection(PROJECTS, { ordering: "manual" }, ["p1", NO_PROJECT_ORDER_ID, "p2", "p3"]);+ expect(rowNames()).toEqual(["Desktop", "No project", "Mobile", "Web"]);+ });++ it("leaves out No project when its setting is off", () => {+ renderSection(PROJECTS, { showNoProject: false });+ expect(screen.queryByRole("button", { name: "No project" })).toBeNull();+ });+it("collapses from the section label", () => {renderSection();fireEvent.click(screen.getByRole("button", { name: "Projects" }));diff --git a/packages/views/layout/panels/work-tree.tsx b/packages/views/layout/panels/work-tree.tsxindex f45aed5421..56d08f76be 100644--- a/packages/views/layout/panels/work-tree.tsx+++ b/packages/views/layout/panels/work-tree.tsx@@ -1,20 +1,26 @@"use client";import { useCallback, useId, useMemo, useRef, useSyncExternalStore, type MouseEvent } from "react";-import { useQueryClient } from "@tanstack/react-query";+import { useQuery, useQueryClient } from "@tanstack/react-query";import { DndContext, PointerSensor, closestCenter, useSensor, useSensors, type DragEndEvent } from "@dnd-kit/core";import { SortableContext, arrayMove, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";import { restrictToFirstScrollableAncestor, restrictToVerticalAxis } from "@dnd-kit/modifiers";import { CSS } from "@dnd-kit/utilities";-import { Folder, Plus } from "@multica/ui/icons";+import { Folder, FolderMinus, Plus } from "@multica/ui/icons";import { cn } from "@multica/ui/lib/utils";import { IconButton } from "@multica/ui/components/common/icon-button";import { DropdownMenuItem } from "@multica/ui/components/ui/dropdown-menu";import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";-import { issueKeys, sidebarIssuesOptions } from "@multica/core/issues/queries";+import { issueKeys, issueTableFacetsOptions, sidebarIssuesOptions } from "@multica/core/issues/queries";import { filterDependencyState, statusCatalogSource } from "@multica/core/issues/surface/filter-dependency";import {+ NO_PROJECT_FACET_KEY,+ NO_PROJECT_ORDER_ID,+ NO_PROJECT_SIDEBAR_SOURCE,SIDEBAR_FIRST_PAGE,+ noProjectCountRequest,+ noProjectRowIndex,+ noProjectSidebarRequest,projectSidebarRequest,projectSidebarSource,type SidebarIssuesRequest,@@ -41,8 +47,8 @@ import { ProjectMenu } from "../../projects/components/project-row-actions";import { shouldOpenRowMenu, useRowMenu } from "../../common/point-menu";import { CollectionRowContext } from "../collection-list/row-context";import { useDragClickGuard } from "../use-drag-click-guard";-import { ProjectsSectionSettings } from "./sidebar-settings";-import { PrivateProjectLock, SidebarIssueList, TreeRow } from "./sidebar-tree";+import { ProjectsSectionSettings, SECTION_SETTINGS_REVEAL_CLASS } from "./sidebar-settings";+import { PrivateProjectLock, SidebarIssueList, TreeRow, TreeToggleRow } from "./sidebar-tree";const DRAG_MODIFIERS = [restrictToVerticalAxis, restrictToFirstScrollableAncestor];@@ -129,8 +135,8 @@ interface ProjectsSectionProps {activeIssueId: string | null;/** The one list that lights the open issue. */litSource: string | null;- /** The project whose row marks the open issue no list shows. */- locatedProjectId: string | null;+ /** The row, a project's or "No project", that marks the open issue no list shows. */+ locatedSource: string | null;}export function ProjectsSection({@@ -142,7 +148,7 @@ export function ProjectsSection({plainRowsLit,activeIssueId,litSource,- locatedProjectId,+ locatedSource,}: ProjectsSectionProps) {const { t } = useT("layout");const p = useWorkspacePaths();@@ -152,23 +158,31 @@ export function ProjectsSection({const updatePrefs = useUpdateSidebarProjectPrefs(wsId);const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 5 } }));const { arm: armClickGuard, release: releaseClickGuard } = useDragClickGuard();+ // "No project" sorts among the projects, under its own id in the manual order.+ const rows = useMemo(() => {+ const list: (Project | typeof NO_PROJECT_ORDER_ID)[] = [...projects];+ if (projectSettings.showNoProject) {+ list.splice(noProjectRowIndex(projects, projectSettings, projectOrder), 0, NO_PROJECT_ORDER_ID);+ }+ return list;+ }, [projects, projectSettings, projectOrder]);+ const ids = useMemo(() => rows.map((row) => (row === NO_PROJECT_ORDER_ID ? row : row.id)), [rows]);const onDragEnd = useCallback(({ active, over }: DragEndEvent) => {releaseClickGuard();if (!over || active.id === over.id) return;- const ids = projects.map((project) => project.id);const from = ids.indexOf(String(active.id));const to = ids.indexOf(String(over.id));if (from === -1 || to === -1) return;const moved = arrayMove(ids, from, to);updatePrefs({- // Projects the filter hides keep their relative place after the shown ones.+ // Rows the settings hide keep their relative place after the shown ones.projectOrder: [...moved, ...projectOrder.filter((id) => !moved.includes(id))],projectSettings: { ordering: "manual" },});},- [projects, projectOrder, releaseClickGuard, updatePrefs],+ [ids, projectOrder, releaseClickGuard, updatePrefs],);return (@@ -178,7 +192,7 @@ export function ProjectsSection({onCollapsedChange={setCollapsed}action={<>- <ProjectsSectionSettings wsId={wsId} className="opacity-0 group-hover/section:opacity-100 group-focus-within/section:opacity-100 [@media(pointer:coarse)]:opacity-100" />+ <ProjectsSectionSettings wsId={wsId} className={SECTION_SETTINGS_REVEAL_CLASS} /><IconButtonlabel={t(($) => $.panels.work.new_project)}size="icon-xs"@@ -198,22 +212,35 @@ export function ProjectsSection({onDragEnd={onDragEnd}onDragCancel={releaseClickGuard}>- <SortableContext items={projects.map((project) => project.id)} strategy={verticalListSortingStrategy}>+ <SortableContext items={ids} strategy={verticalListSortingStrategy}><PanelList>- {projects.map((project) => (- <ProjectTreeItem- key={project.id}- wsId={wsId}- userId={userId}- project={project}- active={plainRowsLit && isPathWithin(pathname, p.projectDetail(project.id))}- showCount={projectSettings.showCount}- issueSettings={issueSettings}- activeIssueId={litSource === projectSidebarSource(project.id) ? activeIssueId : null}- openIssueId={activeIssueId}- located={locatedProjectId === project.id}- />- ))}+ {rows.map((row) =>+ row === NO_PROJECT_ORDER_ID ? (+ <NoProjectTreeItem+ key={row}+ wsId={wsId}+ userId={userId}+ showCount={projectSettings.showCount}+ issueSettings={issueSettings}+ activeIssueId={litSource === NO_PROJECT_SIDEBAR_SOURCE ? activeIssueId : null}+ openIssueId={activeIssueId}+ located={locatedSource === NO_PROJECT_SIDEBAR_SOURCE}+ />+ ) : (+ <ProjectTreeItem+ key={row.id}+ wsId={wsId}+ userId={userId}+ project={row}+ active={plainRowsLit && isPathWithin(pathname, p.projectDetail(row.id))}+ showCount={projectSettings.showCount}+ issueSettings={issueSettings}+ activeIssueId={litSource === projectSidebarSource(row.id) ? activeIssueId : null}+ openIssueId={activeIssueId}+ located={locatedSource === projectSidebarSource(row.id)}+ />+ ),+ )}</PanelList></SortableContext></DndContext>@@ -249,6 +276,110 @@ export function ProjectsSection({);}+const SORTABLE_ROW_DRAGGING_CLASS =+ "relative z-20 rounded-lg bg-surface-raised shadow-[var(--menu-shadow)] ring-1 ring-surface-border";++/**+ * Issues outside every project, listed like a project's. No page shows them,+ * so the row only expands.+ */+function NoProjectTreeItem({+ wsId,+ userId,+ showCount,+ issueSettings,+ activeIssueId,+ openIssueId,+ located,+}: {+ wsId: string;+ userId: string | undefined;+ showCount: boolean;+ issueSettings: SidebarIssueSettings;+ activeIssueId: string | null;+ openIssueId: string | null;+ located: boolean;+}) {+ const { t } = useT("layout");+ const listId = useId();+ const rowRef = useRef<HTMLButtonElement>(null);+ const [expanded, setExpanded] = useExpanded(NO_PROJECT_SIDEBAR_SOURCE);+ const statusCatalog = useIssueStatuses(wsId);+ const catalogDependency = filterDependencyState(true, [statusCatalogSource(statusCatalog)]);+ const params = catalogDependency.unresolved+ ? undefined+ : noProjectSidebarRequest(issueSettings, statusCatalog.statuses, userId);+ const prefetch = usePrefetch(wsId, NO_PROJECT_SIDEBAR_SOURCE, params);+ const { data: count = 0 } = useQuery({+ ...issueTableFacetsOptions(wsId, noProjectCountRequest(statusCatalog.statuses)),+ enabled: showCount && !catalogDependency.unresolved,+ select: (data) =>+ data.facets[0]?.values.find((value) => value.key === NO_PROJECT_FACET_KEY)?.count ?? 0,+ });+ const label = t(($) => $.panels.work.no_project);+ const { listeners, setNodeRef, setActivatorNodeRef, transform, transition, isDragging } = useSortable({+ id: NO_PROJECT_ORDER_ID,+ });++ return (+ <li+ ref={setNodeRef}+ style={{ transform: CSS.Translate.toString(transform), transition }}+ className={cn(isDragging && SORTABLE_ROW_DRAGGING_CLASS)}+ >+ <TreeToggleRow+ ref={rowRef}+ rowRef={setActivatorNodeRef}+ {...listeners}+ label={label}+ icon={<FolderMinus className="size-4 shrink-0" />}+ located={located}+ expanded={expanded}+ onExpandedChange={setExpanded}+ listId={listId}+ onPrefetch={prefetch}+ trailing={+ <span className="relative flex h-5 min-w-5 items-center justify-end">+ {showCount && (+ <PanelCount+ value={count}+ className="transition-opacity group-focus-within/row:opacity-0 group-hover/row:opacity-0 [@media(pointer:coarse)]:opacity-0"+ />+ )}+ <IconButton+ label={t(($) => $.panels.work.new_issue_no_project)}+ size="icon-xs"+ className="absolute -right-2 z-10 text-muted-foreground opacity-0 transition-opacity group-focus-within/row:opacity-100 group-hover/row:opacity-100 focus-visible:opacity-100 [@media(pointer:coarse)]:opacity-100"+ onPointerDown={(event) => event.stopPropagation()}+ // Explicit: an unfinished draft's project must not fill in.+ onClick={() => openCreateIssueWithPreference({ project_id: null })}+ >+ <Plus />+ </IconButton>+ </span>+ }+ />+ {expanded && (+ <SidebarIssueList+ id={listId}+ wsId={wsId}+ source={NO_PROJECT_SIDEBAR_SOURCE}+ params={params}+ paramsError={catalogDependency.error}+ onRetry={catalogDependency.retry}+ activeIssueId={activeIssueId}+ openIssueId={openIssueId}+ ownsOpen={(issue) => !issue.project_id}+ onCollapse={() => {+ setExpanded(false);+ rowRef.current?.focus();+ }}+ />+ )}+ </li>+ );+}+function ProjectTreeItem({wsId,userId,@@ -296,10 +427,7 @@ function ProjectTreeItem({<liref={setNodeRef}style={{ transform: CSS.Translate.toString(transform), transition }}- className={cn(- isDragging &&- "relative z-20 rounded-lg bg-surface-raised shadow-[var(--menu-shadow)] ring-1 ring-surface-border",- )}+ className={cn(isDragging && SORTABLE_ROW_DRAGGING_CLASS)}><TreeRowref={linkRef}diff --git a/packages/views/layout/space-panel.test.tsx b/packages/views/layout/space-panel.test.tsxindex 5b1590b0f2..be3a875dd1 100644--- a/packages/views/layout/space-panel.test.tsx+++ b/packages/views/layout/space-panel.test.tsx@@ -19,7 +19,6 @@ vi.mock("./panels/autopilots-panel", () => ({AutopilotsPanel: () => <div data-testid="autopilots-panel" />,}));vi.mock("./panels/list-space-peeks", () => ({- InboxPeek: () => <div data-testid="inbox-peek" />,ChatPeek: () => <div data-testid="chat-peek" />,}));@@ -57,13 +56,20 @@ describe("SpacePanel", () => {expect(screen.getByTestId("work-panel")).toBeInTheDocument();});- // Inbox, Chat and Settings render their own list column in the card.+ // Chat and Settings render their own list column in the card.it("renders nothing for spaces that bring their own column", () => {- navigation.pathname = "/acme/inbox";+ navigation.pathname = "/acme/chat";renderPanel();expect(panel()).toBeNull();});+ // The full Inbox belongs to Work: its list column sits beside the Work panel.+ it("keeps the Work panel beside the Inbox page", () => {+ navigation.pathname = "/acme/inbox";+ renderPanel();+ expect(screen.getByTestId("work-panel")).toBeInTheDocument();+ });+it("collapses from a click on its edge and keeps its content out of reach", () => {renderPanel();fireEvent.click(screen.getByRole("button", { name: "Toggle left sidebar" }));@@ -107,15 +113,13 @@ describe("SpacePanel", () => {}});- it("previews Inbox and Chat from another space, not over their own page", () => {+ it("previews Chat from another space, not over its own page", () => {vi.useFakeTimers();try {renderPanel();act(() => shell!.toggleNav());- act(() => shell!.requestPeek("inbox"));- act(() => vi.advanceTimersByTime(200));- expect(screen.getByTestId("inbox-peek")).toBeInTheDocument();act(() => shell!.requestPeek("chat"));+ act(() => vi.advanceTimersByTime(200));expect(screen.getByTestId("chat-peek")).toBeInTheDocument();} finally {vi.useRealTimers();@@ -124,11 +128,11 @@ describe("SpacePanel", () => {// There the page's own list column floats instead (ListColumn).it("leaves the current list space's preview to its list column", () => {- navigation.pathname = "/acme/inbox";+ navigation.pathname = "/acme/chat";renderPanel();act(() => shell!.toggleNav());- act(() => shell!.requestPeek("inbox"));- act(() => shell!.requestPeek("inbox"));+ act(() => shell!.requestPeek("chat"));+ act(() => shell!.requestPeek("chat"));expect(peek()).toBeNull();});});diff --git a/packages/views/layout/space-panel.tsx b/packages/views/layout/space-panel.tsxindex 952bdffa47..c3c92a00de 100644--- a/packages/views/layout/space-panel.tsx+++ b/packages/views/layout/space-panel.tsx@@ -7,7 +7,7 @@ import { useSidebar } from "@multica/ui/components/ui/sidebar";import { useAppShell } from "./app-shell-context";import { PanelResizeHandle } from "./panel-resize-handle";import { AutopilotsPanel } from "./panels/autopilots-panel";-import { ChatPeek, InboxPeek } from "./panels/list-space-peeks";+import { ChatPeek } from "./panels/list-space-peeks";import { LIST_COLUMN_WIDTH_CLASS, NAV_COLUMN_MOTION_CLASS, NAV_PEEK_CLASS } from "./rail-styles";import { TeamPanel } from "./panels/team-panel";import { KeptRowsRelease, WorkPanel } from "./panels/work-panel";@@ -18,10 +18,9 @@ const PANELS: Partial<Record<AppSpaceId, () => React.ReactNode>> = {autopilots: AutopilotsPanel,};-// Inbox and Chat keep their lists in their pages, so from another space they-// preview through a standalone copy of the list, at the list width.+// Chat keeps its list in its page, so from another space it previews through+// a standalone copy of the list, at the list width.const LIST_PEEKS: Partial<Record<AppSpaceId, () => React.ReactNode>> = {- inbox: InboxPeek,chat: ChatPeek,};const PEEKS: Partial<Record<AppSpaceId, () => React.ReactNode>> = {@@ -38,7 +37,7 @@ export function SpacePanelContent({ space }: { space: AppSpaceId | null }) {/*** The space panel inside the content card: a column on the card's leading* edge, separated from the page by one hairline. Spaces without a shell- * panel (Inbox, Chat, Settings) render their own `ListColumn` instead, so+ * panel (Chat, Settings) render their own `ListColumn` instead, so* nothing mounts for them. While collapsed, hovering a rail space previews* its panel over the page.*/diff --git a/packages/views/locales/en/issues.json b/packages/views/locales/en/issues.jsonindex f07944bff8..a9a3c1bfa5 100644--- a/packages/views/locales/en/issues.json+++ b/packages/views/locales/en/issues.json@@ -1893,7 +1893,9 @@"my_issues": "My Issues","my_agents": "My agents' work","all_issues": "All issues",- "unread": "Unread"+ "my_work": "My work",+ "working": "Working",+ "subscribed": "Subscribed"},"untitled": "Untitled view","copy_name": "{{name}} (copy)",diff --git a/packages/views/locales/en/layout.json b/packages/views/locales/en/layout.jsonindex 35e2db5fb7..8f89edd53f 100644--- a/packages/views/locales/en/layout.json+++ b/packages/views/locales/en/layout.json@@ -92,7 +92,6 @@"rail": {"label": "App navigation","sheet_description": "Switch spaces and workspaces.",- "inbox": "Inbox","work": "Work","team": "Team","chat": "Chat",@@ -122,12 +121,11 @@},"panels": {"work": {- "my_agents": "My agents' work",- "all_issues": "All issues",- "unread": "Unread","views": "Views","new_project": "New project","new_issue_in_project": "New issue in {{name}}",+ "new_issue_no_project": "New issue without a project",+ "no_project": "No project","private_project": "Visible to project members and workspace owners and admins","all_projects_one": "All {{count}} project","all_projects_other": "All {{count}} projects",@@ -154,6 +152,7 @@"projects_order_created": "Recently created","projects_show": "Show","projects_only_mine": "Only projects I lead",+ "projects_show_no_project": "Show “No project”","projects_show_count": "Open issue count","new_view": "New view","all_views": "All views",@@ -164,7 +163,24 @@"view_rename": "Rename","view_duplicate": "Duplicate","view_delete": "Delete view",- "new_issue_here": "New issue in this project"+ "new_issue_here": "New issue in this project",+ "inbox_actions": "Inbox actions",+ "inbox_view_archived": "View archived",+ "inbox_empty": "No notifications",+ "inbox_settings": "Inbox display",+ "inbox_all": "All notifications",+ "inbox_compact": "Compact rows",+ "inbox_open": "Open",+ "inbox_show_count": "Unread count",+ "inbox_rail_badge": "Unread badge on Work",+ "inbox_types": "Notify me about",+ "inbox_types_hint": "Turned off, a kind of notification is not delivered at all, and nothing from that time comes back when you turn it on again.",+ "inbox_more_settings": "All notification settings",+ "section_limit": "Rows shown",+ "pinned_settings": "Pinned display",+ "views_settings": "Views display",+ "views_builtin": "Built-in views",+ "views_show_count": "Counts"},"team": {"new_agent": "New agent",diff --git a/packages/views/locales/en/settings.json b/packages/views/locales/en/settings.jsonindex 040888964c..891ceb045e 100644--- a/packages/views/locales/en/settings.json+++ b/packages/views/locales/en/settings.json@@ -831,8 +831,27 @@"toast_profile_failed": "Failed to update profile"},"notifications": {- "title": "Inbox Notifications",- "description": "Muted events remain visible on the issue.",+ "title": "Inbox",+ "description": "Choose which events reach the Inbox in the Work sidebar. A turned-off event creates no notification, and turning it back on doesn't bring back what you missed.",+ "categories": {+ "direct": "About you",+ "issues": "Issues you subscribe to",+ "projects": "Projects you subscribe to",+ "agents": "Agents"+ },+ "leaving": {+ "title": "Leaving the Inbox",+ "description": "Reading a notification doesn't take it out of the Inbox.",+ "manual_label": "Archive by hand",+ "manual_description": "From its row in the sidebar, or the top of the notification",+ "manual_value": "Anytime",+ "done_label": "Issue done",+ "done_description": "When an issue reaches a Done status, its notifications are archived. Cancelling it doesn't.",+ "done_value": "Automatic",+ "archived_label": "Archived notifications",+ "archived_description": "Find them again and unarchive them",+ "archived_action": "View archived"+ },"toast_failed": "Failed to update notification settings","groups": {"assignments": {diff --git a/packages/views/locales/es/issues.json b/packages/views/locales/es/issues.jsonindex 2c18019b9d..ebe9664582 100644--- a/packages/views/locales/es/issues.json+++ b/packages/views/locales/es/issues.json@@ -1893,7 +1893,9 @@"my_issues": "Mis tareas","my_agents": "Trabajo de mis agentes","all_issues": "Todas las tareas",- "unread": "Sin leer"+ "my_work": "Mi trabajo",+ "working": "En ejecución",+ "subscribed": "Suscritas"},"untitled": "Vista sin título","copy_name": "{{name}} (copia)",diff --git a/packages/views/locales/es/layout.json b/packages/views/locales/es/layout.jsonindex a92095f064..426ee0ed84 100644--- a/packages/views/locales/es/layout.json+++ b/packages/views/locales/es/layout.json@@ -92,7 +92,6 @@"rail": {"label": "Navegación de la app","sheet_description": "Cambia de sección y de espacio de trabajo.",- "inbox": "Bandeja","work": "Trabajo","team": "Equipo","chat": "Chat",@@ -122,12 +121,11 @@},"panels": {"work": {- "my_agents": "Trabajo de mis agentes",- "all_issues": "Todas las tareas",- "unread": "Sin leer","views": "Vistas","new_project": "Nuevo proyecto","new_issue_in_project": "Nueva tarea en {{name}}",+ "new_issue_no_project": "Nueva tarea sin proyecto",+ "no_project": "Sin proyecto","private_project": "Visible para los miembros del proyecto y los owner y admin del espacio de trabajo","all_projects_one": "{{count}} proyecto en total","all_projects_other": "{{count}} proyectos en total",@@ -154,6 +152,7 @@"projects_order_created": "Creados recientemente","projects_show": "Mostrar","projects_only_mine": "Solo los proyectos que dirijo",+ "projects_show_no_project": "Mostrar «Sin proyecto»","projects_show_count": "Número de tareas abiertas","new_view": "Nueva vista","all_views": "Todas las vistas",@@ -164,7 +163,24 @@"view_rename": "Renombrar","view_duplicate": "Duplicar","view_delete": "Eliminar vista",- "new_issue_here": "Nueva tarea en este proyecto"+ "new_issue_here": "Nueva tarea en este proyecto",+ "inbox_actions": "Acciones de la bandeja",+ "inbox_view_archived": "Ver archivadas",+ "inbox_empty": "Sin notificaciones",+ "inbox_settings": "Visualización de la bandeja",+ "inbox_all": "Todas las notificaciones",+ "inbox_compact": "Filas compactas",+ "inbox_open": "Abrir",+ "inbox_show_count": "Recuento de no leídas",+ "inbox_rail_badge": "Insignia de no leídas en Trabajo",+ "inbox_types": "Notificarme sobre",+ "inbox_types_hint": "Si desactivas un tipo, sus notificaciones dejan de llegar y no se recuperan al volver a activarlo.",+ "inbox_more_settings": "Toda la configuración de notificaciones",+ "section_limit": "Filas visibles",+ "pinned_settings": "Visualización de fijados",+ "views_settings": "Visualización de vistas",+ "views_builtin": "Vistas integradas",+ "views_show_count": "Recuentos"},"team": {"new_agent": "Nuevo agente",diff --git a/packages/views/locales/es/settings.json b/packages/views/locales/es/settings.jsonindex 0cd41e15e7..9eab9aadf9 100644--- a/packages/views/locales/es/settings.json+++ b/packages/views/locales/es/settings.json@@ -831,8 +831,27 @@"toast_profile_failed": "Error al actualizar el perfil"},"notifications": {- "title": "Notificaciones de la bandeja",- "description": "Los eventos silenciados siguen visibles en la tarea.",+ "title": "Bandeja de entrada",+ "description": "Elige qué eventos llegan a la bandeja de entrada de la barra lateral de Trabajo. Un evento desactivado no crea notificaciones, y al reactivarlo no se recuperan las que te perdiste.",+ "categories": {+ "direct": "Sobre ti",+ "issues": "Tareas a las que te suscribes",+ "projects": "Proyectos a los que te suscribes",+ "agents": "Agentes"+ },+ "leaving": {+ "title": "Salir de la bandeja de entrada",+ "description": "Leer una notificación no la saca de la bandeja de entrada.",+ "manual_label": "Archivar a mano",+ "manual_description": "Desde su fila en la barra lateral o desde la parte superior de la notificación",+ "manual_value": "En cualquier momento",+ "done_label": "Tarea completada",+ "done_description": "Cuando una tarea pasa a un estado Completado, sus notificaciones se archivan. Cancelarla no las archiva.",+ "done_value": "Automático",+ "archived_label": "Notificaciones archivadas",+ "archived_description": "Encuéntralas de nuevo y desarchívalas",+ "archived_action": "Ver archivadas"+ },"toast_failed": "Error al actualizar la configuración de notificaciones","groups": {"assignments": {diff --git a/packages/views/locales/fr/issues.json b/packages/views/locales/fr/issues.jsonindex 279e482d79..05948a8084 100644--- a/packages/views/locales/fr/issues.json+++ b/packages/views/locales/fr/issues.json@@ -1893,7 +1893,9 @@"my_issues": "Mes tâches","my_agents": "Travail de mes agents","all_issues": "Toutes les tâches",- "unread": "Non lues"+ "my_work": "Mon travail",+ "working": "En cours d'exécution",+ "subscribed": "Abonnements"},"untitled": "Vue sans titre","copy_name": "{{name}} (copie)",diff --git a/packages/views/locales/fr/layout.json b/packages/views/locales/fr/layout.jsonindex f9864e0827..a51027e4ed 100644--- a/packages/views/locales/fr/layout.json+++ b/packages/views/locales/fr/layout.json@@ -92,7 +92,6 @@"rail": {"label": "Navigation de l'application","sheet_description": "Changer d'espace et d'espace de travail.",- "inbox": "Boîte","work": "Travail","team": "Équipe","chat": "Chat",@@ -122,12 +121,11 @@},"panels": {"work": {- "my_agents": "Travail de mes agents",- "all_issues": "Toutes les tâches",- "unread": "Non lues","views": "Vues","new_project": "Nouveau projet","new_issue_in_project": "Nouvelle tâche dans {{name}}",+ "new_issue_no_project": "Nouvelle tâche sans projet",+ "no_project": "Aucun projet","private_project": "Visible par les membres du projet et les owner et admin de l’espace de travail","all_projects_one": "Tous les projets ({{count}})","all_projects_other": "Tous les projets ({{count}})",@@ -154,6 +152,7 @@"projects_order_created": "Créés récemment","projects_show": "Afficher","projects_only_mine": "Seulement les projets que je dirige",+ "projects_show_no_project": "Afficher « Aucun projet »","projects_show_count": "Nombre de tâches ouvertes","new_view": "Nouvelle vue","all_views": "Toutes les vues",@@ -164,7 +163,24 @@"view_rename": "Renommer","view_duplicate": "Dupliquer","view_delete": "Supprimer la vue",- "new_issue_here": "Nouvelle tâche dans ce projet"+ "new_issue_here": "Nouvelle tâche dans ce projet",+ "inbox_actions": "Actions de la boîte de réception",+ "inbox_view_archived": "Voir les archivées",+ "inbox_empty": "Aucune notification",+ "inbox_settings": "Affichage de la boîte de réception",+ "inbox_all": "Toutes les notifications",+ "inbox_compact": "Lignes compactes",+ "inbox_open": "Ouvrir",+ "inbox_show_count": "Nombre de non lus",+ "inbox_rail_badge": "Badge de non lus sur Travail",+ "inbox_types": "Me notifier pour",+ "inbox_types_hint": "Désactivé, un type de notification n’est plus envoyé, et rien de cette période ne revient quand vous le réactivez.",+ "inbox_more_settings": "Tous les réglages de notification",+ "section_limit": "Lignes affichées",+ "pinned_settings": "Affichage des épingles",+ "views_settings": "Affichage des vues",+ "views_builtin": "Vues intégrées",+ "views_show_count": "Compteurs"},"team": {"new_agent": "Nouvel agent",diff --git a/packages/views/locales/fr/settings.json b/packages/views/locales/fr/settings.jsonindex b757030f72..624a0ed63c 100644--- a/packages/views/locales/fr/settings.json+++ b/packages/views/locales/fr/settings.json@@ -831,8 +831,27 @@"toast_profile_failed": "Échec de la mise à jour du profil"},"notifications": {- "title": "Notifications de la boîte de réception",- "description": "Les événements désactivés restent visibles dans la tâche.",+ "title": "Boîte de réception",+ "description": "Choisissez les événements qui arrivent dans la boîte de réception de la barre latérale Travail. Un événement désactivé ne crée aucune notification, et le réactiver ne récupère pas celles manquées.",+ "categories": {+ "direct": "Vous concernant",+ "issues": "Tâches que vous suivez",+ "projects": "Projets que vous suivez",+ "agents": "Agents"+ },+ "leaving": {+ "title": "Sortir de la boîte de réception",+ "description": "Lire une notification ne la retire pas de la boîte de réception.",+ "manual_label": "Archiver à la main",+ "manual_description": "Depuis sa ligne dans la barre latérale ou le haut de la notification",+ "manual_value": "À tout moment",+ "done_label": "Tâche terminée",+ "done_description": "Quand une tâche passe à un statut Terminé, ses notifications sont archivées. L'annuler ne les archive pas.",+ "done_value": "Automatique",+ "archived_label": "Notifications archivées",+ "archived_description": "Retrouvez-les et désarchivez-les",+ "archived_action": "Voir les archivées"+ },"toast_failed": "Échec de la mise à jour des réglages de notification","groups": {"assignments": {diff --git a/packages/views/locales/ja/issues.json b/packages/views/locales/ja/issues.jsonindex f526dd72f1..8b4340f1b3 100644--- a/packages/views/locales/ja/issues.json+++ b/packages/views/locales/ja/issues.json@@ -1816,7 +1816,9 @@"my_issues": "マイタスク","my_agents": "マイエージェントの作業","all_issues": "すべてのタスク",- "unread": "未読"+ "my_work": "自分の作業",+ "working": "実行中",+ "subscribed": "購読中"},"untitled": "無題のビュー","copy_name": "{{name}}(コピー)",diff --git a/packages/views/locales/ja/layout.json b/packages/views/locales/ja/layout.jsonindex ff938539b8..d413822fa7 100644--- a/packages/views/locales/ja/layout.json+++ b/packages/views/locales/ja/layout.json@@ -91,7 +91,6 @@"rail": {"label": "アプリナビゲーション","sheet_description": "スペースとワークスペースを切り替えます。",- "inbox": "受信箱","work": "作業","team": "チーム","chat": "チャット",@@ -119,12 +118,11 @@},"panels": {"work": {- "my_agents": "マイエージェントの作業",- "all_issues": "すべてのタスク",- "unread": "未読","views": "ビュー","new_project": "新規プロジェクト","new_issue_in_project": "{{name}} に新規タスク",+ "new_issue_no_project": "プロジェクトなしで新規タスク",+ "no_project": "プロジェクトなし","private_project": "プロジェクトメンバーとワークスペースの owner と admin が閲覧できます","all_projects_other": "すべてのプロジェクト({{count}})","project_issues": "{{name}} のタスク",@@ -150,6 +148,7 @@"projects_order_created": "最近作成","projects_show": "表示","projects_only_mine": "自分がリードするプロジェクトのみ",+ "projects_show_no_project": "「プロジェクトなし」を表示","projects_show_count": "未完了タスク数","new_view": "新規ビュー","all_views": "すべてのビュー",@@ -160,7 +159,24 @@"view_rename": "名前を変更","view_duplicate": "複製","view_delete": "ビューを削除",- "new_issue_here": "このプロジェクトに新規タスク"+ "new_issue_here": "このプロジェクトに新規タスク",+ "inbox_actions": "インボックスの操作",+ "inbox_view_archived": "アーカイブ済みを表示",+ "inbox_empty": "通知はありません",+ "inbox_settings": "インボックスの表示",+ "inbox_all": "すべての通知",+ "inbox_compact": "コンパクト表示",+ "inbox_open": "開く",+ "inbox_show_count": "未読数",+ "inbox_rail_badge": "「作業」に未読バッジを表示",+ "inbox_types": "受け取る通知",+ "inbox_types_hint": "オフにした種類の通知は届かなくなり、再びオンにしてもその間の通知は戻りません。",+ "inbox_more_settings": "すべての通知設定",+ "section_limit": "表示件数",+ "pinned_settings": "ピン留めの表示",+ "views_settings": "ビューの表示",+ "views_builtin": "組み込みビュー",+ "views_show_count": "件数"},"team": {"new_agent": "新規エージェント",diff --git a/packages/views/locales/ja/settings.json b/packages/views/locales/ja/settings.jsonindex 3882e6607f..468d5fd53a 100644--- a/packages/views/locales/ja/settings.json+++ b/packages/views/locales/ja/settings.json@@ -822,8 +822,27 @@"toast_profile_failed": "プロフィールを更新できませんでした"},"notifications": {- "title": "インボックス通知",- "description": "通知をオフにしても、タスク上で履歴を確認できます。",+ "title": "インボックス",+ "description": "「作業」サイドバーのインボックスに届くイベントを選びます。オフにしたイベントは通知を作らず、オンに戻しても見逃した通知は戻りません。",+ "categories": {+ "direct": "あなたに関するもの",+ "issues": "購読中のタスク",+ "projects": "購読中のプロジェクト",+ "agents": "エージェント"+ },+ "leaving": {+ "title": "インボックスから外れるとき",+ "description": "既読にしてもインボックスからは消えません。",+ "manual_label": "手動でアーカイブ",+ "manual_description": "サイドバーの行、または通知の上部から",+ "manual_value": "いつでも",+ "done_label": "タスクが完了",+ "done_description": "タスクが完了系のステータスになると、その通知はアーカイブされます。キャンセルではアーカイブされません。",+ "done_value": "自動",+ "archived_label": "アーカイブ済みの通知",+ "archived_description": "ここから見つけてアーカイブを解除できます",+ "archived_action": "アーカイブ済みを表示"+ },"toast_failed": "通知設定を更新できませんでした","groups": {"assignments": {diff --git a/packages/views/locales/ko/issues.json b/packages/views/locales/ko/issues.jsonindex 403bb692c0..5eba8c52a4 100644--- a/packages/views/locales/ko/issues.json+++ b/packages/views/locales/ko/issues.json@@ -1816,7 +1816,9 @@"my_issues": "내 태스크","my_agents": "내 에이전트의 작업","all_issues": "전체 태스크",- "unread": "읽지 않음"+ "my_work": "내 작업",+ "working": "실행 중",+ "subscribed": "구독 중"},"untitled": "제목 없는 뷰","copy_name": "{{name}} (사본)",diff --git a/packages/views/locales/ko/layout.json b/packages/views/locales/ko/layout.jsonindex 66d2cce360..b2ac7caf3e 100644--- a/packages/views/locales/ko/layout.json+++ b/packages/views/locales/ko/layout.json@@ -91,7 +91,6 @@"rail": {"label": "앱 탐색","sheet_description": "스페이스와 워크스페이스를 전환합니다.",- "inbox": "인박스","work": "작업","team": "팀","chat": "채팅",@@ -119,12 +118,11 @@},"panels": {"work": {- "my_agents": "내 에이전트의 작업",- "all_issues": "전체 태스크",- "unread": "읽지 않음","views": "뷰","new_project": "새 프로젝트","new_issue_in_project": "{{name}}에 새 태스크",+ "new_issue_no_project": "프로젝트 없이 새 태스크",+ "no_project": "프로젝트 없음","private_project": "프로젝트 멤버와 워크스페이스 owner, admin이 볼 수 있습니다","all_projects_other": "전체 프로젝트 {{count}}개","project_issues": "{{name}}의 태스크",@@ -150,6 +148,7 @@"projects_order_created": "최근 생성","projects_show": "표시","projects_only_mine": "내가 리드하는 프로젝트만",+ "projects_show_no_project": "'프로젝트 없음' 표시","projects_show_count": "미완료 태스크 수","new_view": "새 뷰","all_views": "모든 뷰",@@ -160,7 +159,24 @@"view_rename": "이름 변경","view_duplicate": "복제","view_delete": "뷰 삭제",- "new_issue_here": "이 프로젝트에 새 태스크"+ "new_issue_here": "이 프로젝트에 새 태스크",+ "inbox_actions": "인박스 작업",+ "inbox_view_archived": "보관된 알림 보기",+ "inbox_empty": "알림 없음",+ "inbox_settings": "인박스 표시",+ "inbox_all": "모든 알림",+ "inbox_compact": "간결하게 표시",+ "inbox_open": "열기",+ "inbox_show_count": "읽지 않은 수",+ "inbox_rail_badge": "'작업'에 읽지 않음 배지 표시",+ "inbox_types": "받을 알림",+ "inbox_types_hint": "끈 종류의 알림은 더 이상 오지 않으며, 다시 켜도 그동안의 알림은 돌아오지 않습니다.",+ "inbox_more_settings": "모든 알림 설정",+ "section_limit": "표시 개수",+ "pinned_settings": "고정 항목 표시",+ "views_settings": "보기 표시",+ "views_builtin": "기본 보기",+ "views_show_count": "개수"},"team": {"new_agent": "새 에이전트",diff --git a/packages/views/locales/ko/settings.json b/packages/views/locales/ko/settings.jsonindex 71ad59591b..35b8b8f410 100644--- a/packages/views/locales/ko/settings.json+++ b/packages/views/locales/ko/settings.json@@ -822,8 +822,27 @@"toast_profile_failed": "프로필을 업데이트하지 못했습니다"},"notifications": {- "title": "인박스 알림",- "description": "알림을 꺼도 태스크에서 관련 활동을 볼 수 있습니다.",+ "title": "인박스",+ "description": "'작업' 사이드바의 인박스에 들어올 이벤트를 고릅니다. 끈 이벤트는 알림을 만들지 않으며, 다시 켜도 놓친 알림은 돌아오지 않습니다.",+ "categories": {+ "direct": "나와 직접 관련된 것",+ "issues": "구독 중인 태스크",+ "projects": "구독 중인 프로젝트",+ "agents": "에이전트"+ },+ "leaving": {+ "title": "인박스에서 빠지는 경우",+ "description": "읽어도 인박스에서 사라지지 않습니다.",+ "manual_label": "직접 보관",+ "manual_description": "사이드바의 행이나 알림 상단에서",+ "manual_value": "언제든지",+ "done_label": "태스크 완료",+ "done_description": "태스크가 완료 계열 상태가 되면 그 알림은 보관됩니다. 취소는 보관하지 않습니다.",+ "done_value": "자동",+ "archived_label": "보관된 알림",+ "archived_description": "여기서 다시 찾고 보관을 해제할 수 있습니다",+ "archived_action": "보관된 알림 보기"+ },"toast_failed": "알림 설정을 업데이트하지 못했습니다","groups": {"assignments": {diff --git a/packages/views/locales/ru/issues.json b/packages/views/locales/ru/issues.jsonindex 2c7763b700..ce2ffb3edb 100644--- a/packages/views/locales/ru/issues.json+++ b/packages/views/locales/ru/issues.json@@ -2046,7 +2046,9 @@"my_issues": "Мои задачи","my_agents": "Работа моих агентов","all_issues": "Все задачи",- "unread": "Непрочитанные"+ "my_work": "Моя работа",+ "working": "Выполняются",+ "subscribed": "Подписки"},"untitled": "Представление без названия","copy_name": "{{name}} (копия)",diff --git a/packages/views/locales/ru/layout.json b/packages/views/locales/ru/layout.jsonindex 99770bc912..9b3a44f4b8 100644--- a/packages/views/locales/ru/layout.json+++ b/packages/views/locales/ru/layout.json@@ -68,7 +68,6 @@"rail": {"label": "Навигация по приложению","sheet_description": "Переключайтесь между разделами и рабочими пространствами.",- "inbox": "Входящие","work": "Работа","team": "Команда","chat": "Чат",@@ -102,11 +101,11 @@},"panels": {"work": {- "my_agents": "Работа моих агентов",- "all_issues": "Все задачи","views": "Представления","new_project": "Новый проект","new_issue_in_project": "Новая задача в «{{name}}»",+ "new_issue_no_project": "Новая задача без проекта",+ "no_project": "Нет проекта","private_project": "Видно участникам проекта, а также owner и admin рабочего пространства","all_projects_one": "Всего {{count}} проект","all_projects_other": "Всего {{count}} проекта",@@ -132,6 +131,7 @@"projects_order_created": "Недавно созданные","projects_show": "Показывать","projects_only_mine": "Только проекты, которыми я руковожу",+ "projects_show_no_project": "Показывать «Нет проекта»","projects_show_count": "Число открытых задач","new_view": "Новое представление","all_views": "Все представления",@@ -145,8 +145,24 @@"all_projects_few": "Всего {{count}} проекта","all_projects_many": "Всего {{count}} проектов","project_issues_retry": "Повторить",- "unread": "Непрочитанные",- "new_issue_here": "Новая задача в этом проекте"+ "new_issue_here": "Новая задача в этом проекте",+ "inbox_actions": "Действия со входящими",+ "inbox_view_archived": "Открыть архив",+ "inbox_empty": "Нет уведомлений",+ "inbox_settings": "Отображение входящих",+ "inbox_all": "Все уведомления",+ "inbox_compact": "Компактные строки",+ "inbox_open": "Открыть",+ "inbox_show_count": "Число непрочитанных",+ "inbox_rail_badge": "Значок непрочитанных на «Работе»",+ "inbox_types": "Уведомлять о",+ "inbox_types_hint": "Отключённый тип уведомлений больше не приходит, и при повторном включении пропущенные не вернутся.",+ "inbox_more_settings": "Все настройки уведомлений",+ "section_limit": "Показывать строк",+ "pinned_settings": "Отображение закреплённых",+ "views_settings": "Отображение видов",+ "views_builtin": "Встроенные виды",+ "views_show_count": "Счётчики"},"team": {"new_agent": "Новый агент",diff --git a/packages/views/locales/ru/settings.json b/packages/views/locales/ru/settings.jsonindex 885cb1546e..02174482a3 100644--- a/packages/views/locales/ru/settings.json+++ b/packages/views/locales/ru/settings.json@@ -848,8 +848,27 @@"toast_profile_failed": "Не удалось обновить профиль"},"notifications": {- "title": "Уведомления во входящих",- "description": "Отключённые события остаются видимыми в задаче.",+ "title": "Входящие",+ "description": "Выберите, какие события попадают во «Входящие» на боковой панели «Работа». Отключённое событие не создаёт уведомлений, а после включения пропущенные не вернутся.",+ "categories": {+ "direct": "О вас",+ "issues": "Задачи, на которые вы подписаны",+ "projects": "Проекты, на которые вы подписаны",+ "agents": "Агенты"+ },+ "leaving": {+ "title": "Когда уведомление уходит из «Входящих»",+ "description": "Прочитанное уведомление остаётся во «Входящих».",+ "manual_label": "Архивировать вручную",+ "manual_description": "Из строки на боковой панели или в верхней части уведомления",+ "manual_value": "В любой момент",+ "done_label": "Задача выполнена",+ "done_description": "Когда задача переходит в статус «Выполнено», её уведомления архивируются. Отмена их не архивирует.",+ "done_value": "Автоматически",+ "archived_label": "Архивные уведомления",+ "archived_description": "Здесь их можно найти и вернуть из архива",+ "archived_action": "Открыть архив"+ },"toast_failed": "Не удалось обновить настройки уведомлений","system": {"title": "Системные уведомления",diff --git a/packages/views/locales/zh-Hans/issues.json b/packages/views/locales/zh-Hans/issues.jsonindex f572dc66b5..6dcf8c793a 100644--- a/packages/views/locales/zh-Hans/issues.json+++ b/packages/views/locales/zh-Hans/issues.json@@ -1816,7 +1816,9 @@"my_issues": "我的任务","my_agents": "我的智能体在做","all_issues": "全部任务",- "unread": "未读"+ "my_work": "我的工作",+ "working": "执行中",+ "subscribed": "已订阅"},"untitled": "未命名视图","copy_name": "{{name}}(副本)",diff --git a/packages/views/locales/zh-Hans/layout.json b/packages/views/locales/zh-Hans/layout.jsonindex a68066e3df..3020531410 100644--- a/packages/views/locales/zh-Hans/layout.json+++ b/packages/views/locales/zh-Hans/layout.json@@ -91,7 +91,6 @@"rail": {"label": "应用导航","sheet_description": "切换空间和工作区。",- "inbox": "收件箱","work": "工作","team": "团队","chat": "聊天",@@ -119,12 +118,11 @@},"panels": {"work": {- "my_agents": "我的智能体在做",- "all_issues": "全部任务",- "unread": "未读","views": "视图","new_project": "新建项目","new_issue_in_project": "在 {{name}} 中新建任务",+ "new_issue_no_project": "新建无项目任务",+ "no_project": "无项目","private_project": "项目成员及工作区 owner 和 admin 可见","all_projects_other": "全部 {{count}} 个项目","project_issues": "{{name}} 的任务",@@ -150,6 +148,7 @@"projects_order_created": "最近创建","projects_show": "显示","projects_only_mine": "只看我负责的项目",+ "projects_show_no_project": "显示「无项目」","projects_show_count": "未完成任务数","new_view": "新建视图","all_views": "全部视图",@@ -160,7 +159,24 @@"view_rename": "重命名","view_duplicate": "创建副本","view_delete": "删除视图",- "new_issue_here": "在此项目中新建任务"+ "new_issue_here": "在此项目中新建任务",+ "inbox_actions": "收件箱操作",+ "inbox_view_archived": "查看已归档",+ "inbox_empty": "暂无通知",+ "inbox_settings": "收件箱显示",+ "inbox_all": "全部通知",+ "inbox_compact": "紧凑显示",+ "inbox_open": "打开",+ "inbox_show_count": "未读数量",+ "inbox_rail_badge": "在「工作」上显示未读数",+ "inbox_types": "接收以下通知",+ "inbox_types_hint": "关闭后不再产生这类通知;重新打开也找不回关闭期间的通知。",+ "inbox_more_settings": "全部通知设置",+ "section_limit": "显示条数",+ "pinned_settings": "固定显示",+ "views_settings": "视图显示",+ "views_builtin": "内置视图",+ "views_show_count": "数量"},"team": {"new_agent": "新建智能体",diff --git a/packages/views/locales/zh-Hans/settings.json b/packages/views/locales/zh-Hans/settings.jsonindex 2cf5bbf7de..1565914e05 100644--- a/packages/views/locales/zh-Hans/settings.json+++ b/packages/views/locales/zh-Hans/settings.json@@ -822,8 +822,27 @@"toast_profile_failed": "更新资料失败"},"notifications": {- "title": "收件箱通知",- "description": "关闭通知后,仍可在任务中查看相关动态。",+ "title": "收件箱",+ "description": "决定哪些动态会进入「工作」侧栏的收件箱。关闭后不再产生这类通知,重新打开也找不回关闭期间的通知。",+ "categories": {+ "direct": "与你直接相关",+ "issues": "你订阅的任务",+ "projects": "你订阅的项目",+ "agents": "智能体"+ },+ "leaving": {+ "title": "移出收件箱",+ "description": "通知不会因为已读而离开收件箱。",+ "manual_label": "手动归档",+ "manual_description": "在侧栏行上或通知详情顶部点归档",+ "manual_value": "随时",+ "done_label": "任务已完成",+ "done_description": "任务进入「已完成」类状态时,它的通知自动归档;取消不会。",+ "done_value": "自动",+ "archived_label": "已归档的通知",+ "archived_description": "可以在这里找回并取消归档",+ "archived_action": "查看已归档"+ },"toast_failed": "更新通知设置失败","groups": {"assignments": {diff --git a/packages/views/locales/zh-Hant/issues.json b/packages/views/locales/zh-Hant/issues.jsonindex 17743b93aa..df828d0b47 100644--- a/packages/views/locales/zh-Hant/issues.json+++ b/packages/views/locales/zh-Hant/issues.json@@ -1816,7 +1816,9 @@"my_issues": "我的任務","my_agents": "我的 AI 代理在做","all_issues": "全部任務",- "unread": "未讀"+ "my_work": "我的工作",+ "working": "執行中",+ "subscribed": "已訂閱"},"untitled": "未命名檢視","copy_name": "{{name}}(副本)",diff --git a/packages/views/locales/zh-Hant/layout.json b/packages/views/locales/zh-Hant/layout.jsonindex 75f216874a..9f494570d6 100644--- a/packages/views/locales/zh-Hant/layout.json+++ b/packages/views/locales/zh-Hant/layout.json@@ -91,7 +91,6 @@"rail": {"label": "應用導覽","sheet_description": "切換空間和工作區。",- "inbox": "收件箱","work": "工作","team": "團隊","chat": "聊天",@@ -119,12 +118,11 @@},"panels": {"work": {- "my_agents": "我的 AI 代理在做",- "all_issues": "全部任務",- "unread": "未讀","views": "檢視","new_project": "新建專案","new_issue_in_project": "在 {{name}} 中新建任務",+ "new_issue_no_project": "新建無專案任務",+ "no_project": "無專案","private_project": "專案成員及工作區 owner 和 admin 可見","all_projects_other": "全部 {{count}} 個專案","project_issues": "{{name}} 的任務",@@ -150,6 +148,7 @@"projects_order_created": "最近建立","projects_show": "顯示","projects_only_mine": "只看我負責的專案",+ "projects_show_no_project": "顯示「無專案」","projects_show_count": "未完成任務數","new_view": "新增檢視","all_views": "全部檢視",@@ -160,7 +159,24 @@"view_rename": "重新命名","view_duplicate": "建立副本","view_delete": "刪除檢視",- "new_issue_here": "在此專案中新建任務"+ "new_issue_here": "在此專案中新建任務",+ "inbox_actions": "收件箱操作",+ "inbox_view_archived": "查看已歸檔",+ "inbox_empty": "暫無通知",+ "inbox_settings": "收件箱顯示",+ "inbox_all": "全部通知",+ "inbox_compact": "緊湊顯示",+ "inbox_open": "開啟",+ "inbox_show_count": "未讀數量",+ "inbox_rail_badge": "在「工作」上顯示未讀數",+ "inbox_types": "接收以下通知",+ "inbox_types_hint": "關閉後不再產生這類通知;重新開啟也找不回關閉期間的通知。",+ "inbox_more_settings": "全部通知設定",+ "section_limit": "顯示筆數",+ "pinned_settings": "固定顯示",+ "views_settings": "檢視顯示",+ "views_builtin": "內建檢視",+ "views_show_count": "數量"},"team": {"new_agent": "新建 AI 代理",diff --git a/packages/views/locales/zh-Hant/settings.json b/packages/views/locales/zh-Hant/settings.jsonindex 9b889af136..28857db987 100644--- a/packages/views/locales/zh-Hant/settings.json+++ b/packages/views/locales/zh-Hant/settings.json@@ -822,8 +822,27 @@"toast_profile_failed": "更新資料失敗"},"notifications": {- "title": "收件箱通知",- "description": "關閉通知後,仍可在任務中檢視相關動態。",+ "title": "收件箱",+ "description": "決定哪些動態會進入「工作」側欄的收件箱。關閉後不再產生這類通知,重新開啟也找不回關閉期間的通知。",+ "categories": {+ "direct": "與你直接相關",+ "issues": "你訂閱的任務",+ "projects": "你訂閱的專案",+ "agents": "AI 代理"+ },+ "leaving": {+ "title": "移出收件箱",+ "description": "通知不會因為已讀而離開收件箱。",+ "manual_label": "手動歸檔",+ "manual_description": "在側欄列上或通知詳情頂部點歸檔",+ "manual_value": "隨時",+ "done_label": "任務已完成",+ "done_description": "任務進入「已完成」類狀態時,它的通知自動歸檔;取消不會。",+ "done_value": "自動",+ "archived_label": "已歸檔的通知",+ "archived_description": "可以在這裡找回並取消歸檔",+ "archived_action": "查看已歸檔"+ },"toast_failed": "更新通知設定失敗","groups": {"assignments": {diff --git a/packages/views/modals/create-issue.test.tsx b/packages/views/modals/create-issue.test.tsxindex b8efbaf48b..81f9d023cb 100644--- a/packages/views/modals/create-issue.test.tsx+++ b/packages/views/modals/create-issue.test.tsx@@ -1711,6 +1711,17 @@ describe("CreateIssueModal", () => {expect(mockSetAgent).toHaveBeenCalledWith({ prompt: "Refactor auth" });});+ it("opens without a project when asked for none, over an unfinished draft's project", async () => {+ const user = userEvent.setup();+ const firstOpen = renderModal(<CreateIssueModal onClose={vi.fn()} />);+ await user.click(screen.getByTestId("project-picker"));+ firstOpen.unmount();++ renderModal(<CreateIssueModal onClose={vi.fn()} data={{ project_id: null }} />);++ expect(screen.getByTestId("project-picker")).toHaveAttribute("data-project-id", "none");+ });+it("restores an unfinished project selection after manual create remounts", async () => {const user = userEvent.setup();diff --git a/packages/views/modals/quick-create-issue.test.tsx b/packages/views/modals/quick-create-issue.test.tsxindex 52ac577f10..4d58c7c87c 100644--- a/packages/views/modals/quick-create-issue.test.tsx+++ b/packages/views/modals/quick-create-issue.test.tsx@@ -1085,6 +1085,14 @@ describe("AgentCreatePanel", () => {expect(screen.getByTestId("project-picker")).toHaveTextContent("Project proj-1");});+ it("opens without a project when asked for none, over an unfinished draft's project", () => {+ mockIssueDraftStore.draft.shared.projectId = "proj-1";++ renderPanel({ onClose: vi.fn(), isExpanded: false, setIsExpanded: vi.fn(), data: { project_id: null } });++ expect(screen.queryByText("Project proj-1")).toBeNull();+ });+// When the modal was opened from "Add sub issue" on an existing issue,// the manual panel transfers parent_issue_id through the `data` payload// on switch-to-agent. The agent panel must forward that UUID to thediff --git a/packages/views/modals/quick-create-issue.tsx b/packages/views/modals/quick-create-issue.tsxindex 7ce80b8959..a05cd49130 100644--- a/packages/views/modals/quick-create-issue.tsx+++ b/packages/views/modals/quick-create-issue.tsx@@ -279,10 +279,11 @@ export function AgentCreatePanel({// Project has exactly two seeds, both carrying explicit user intent: the// project page (or manual panel) the modal was opened from, and the user's// own unfinished draft. It is deliberately NOT seeded from the last create- // — see quick-create-store (MUL-5862).+ // — see quick-create-store (MUL-5862). An opener that passes `project_id:+ // null` ("No project") means none, so the draft's does not fill in.const [projectId, setProjectId] = useState<string | null>(() => {- const seed = (data?.project_id as string | undefined) ?? draft.shared.projectId;- return seed ?? null;+ if (data && "project_id" in data) return (data.project_id as string | null | undefined) ?? null;+ return draft.shared.projectId ?? null;});const [priority, setPriority] = useState<IssuePriority>((data?.priority as IssuePriority | undefined) ?? draft.shared.priority,diff --git a/packages/views/settings/components/notifications-tab.test.tsx b/packages/views/settings/components/notifications-tab.test.tsxindex e6ac43e699..53c2cb95f4 100644--- a/packages/views/settings/components/notifications-tab.test.tsx+++ b/packages/views/settings/components/notifications-tab.test.tsx@@ -1,3 +1,4 @@+import type { ReactNode } from "react";import { afterEach, describe, expect, it, vi } from "vitest";import { cleanup, render, screen, within } from "@testing-library/react";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";@@ -7,7 +8,17 @@ import enSettings from "../../locales/en/settings.json";import { NotificationsTab } from "./notifications-tab";vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => "ws-a" }));-vi.mock("@multica/core/paths", () => ({ useCurrentWorkspace: () => ({ id: "ws-a", name: "Acme" }) }));+vi.mock("@multica/core/paths", () => ({+ useCurrentWorkspace: () => ({ id: "ws-a", name: "Acme" }),+ useWorkspacePaths: () => ({ inbox: () => "/acme/inbox" }),+}));+vi.mock("../../navigation", () => ({+ AppLink: ({ href, children, className }: { href: string; children: ReactNode; className?: string }) => (+ <a href={href} className={className}>+ {children}+ </a>+ ),+}));vi.mock("@multica/core/notification-preferences/mutations", () => ({useUpdateNotificationPreferences: () => ({ mutate: vi.fn() }),}));@@ -15,6 +26,56 @@ vi.mock("./browser-notification-setting", () => ({ BrowserNotificationSetting: (afterEach(cleanup);+function renderTab(preferences: Record<string, string> = {}) {+ const qc = new QueryClient({ defaultOptions: { queries: { staleTime: Infinity } } });+ qc.setQueryData(notificationPreferenceKeys.all("ws-a"), { workspace_id: "ws-a", preferences });+ render(+ <QueryClientProvider client={qc}>+ <I18nProvider locale="en" resources={{ en: { settings: enSettings } }}>+ <NotificationsTab />+ </I18nProvider>+ </QueryClientProvider>,+ );+ return qc;+}++describe("Inbox notification settings", () => {+ it("groups the events by how they reach you", () => {+ renderTab({ updates: "muted" });+ const inbox = screen.getByRole("region", { name: "Inbox" });+ const lines = Array.from(+ inbox.querySelectorAll("[data-settings-anchor] .font-medium, .text-caption.font-medium"),+ (el) => el.textContent,+ );+ expect(lines).toEqual([+ "About you",+ "Assignments",+ "Mentions",+ "Issues you subscribe to",+ "Status changes",+ "Comments",+ "Priority & Due date",+ "Projects you subscribe to",+ "New issues",+ "Agents",+ "Agent activity",+ ]);+ expect(within(inbox).getByRole("switch", { name: "Priority & Due date" })).not.toBeChecked();+ expect(within(inbox).getByRole("switch", { name: "Comments" })).toBeChecked();+ });++ it("explains how notifications leave the Inbox, with a way to the archived ones", () => {+ renderTab();+ const leaving = screen.getByRole("region", { name: "Leaving the Inbox" });+ expect(leaving).toHaveTextContent("Reading a notification doesn't take it out of the Inbox.");+ expect(leaving).toHaveTextContent("Cancelling it doesn't.");+ expect(within(leaving).getByRole("link", { name: "View archived" })).toHaveAttribute(+ "href",+ "/acme/inbox?view=archived",+ );+ });+});+describe("notification setting hierarchy", () => {it.each([{ systemMuted: false, chatMuted: false },diff --git a/packages/views/settings/components/notifications-tab.tsx b/packages/views/settings/components/notifications-tab.tsxindex 1b9b9e4e38..275184e653 100644--- a/packages/views/settings/components/notifications-tab.tsx+++ b/packages/views/settings/components/notifications-tab.tsx@@ -1,13 +1,19 @@"use client";+import { Fragment } from "react";import { useQuery } from "@tanstack/react-query";import { useWorkspaceId } from "@multica/core/hooks";+import { useWorkspacePaths } from "@multica/core/paths";import { notificationPreferenceOptions } from "@multica/core/notification-preferences/queries";import { useUpdateNotificationPreferences } from "@multica/core/notification-preferences/mutations";import type { NotificationGroupKey, NotificationPreferences } from "@multica/core/types";+import { buttonVariants } from "@multica/ui/components/ui/button";import { Switch } from "@multica/ui/components/ui/switch";+import { cn } from "@multica/ui/lib/utils";import { toast } from "sonner";import { useT } from "../../i18n";+import { ARCHIVED_VIEW_PARAM } from "../../inbox/components/inbox-view";+import { AppLink } from "../../navigation";import { BrowserNotificationSetting } from "./browser-notification-setting";import {SettingsCard,@@ -16,22 +22,19 @@ import {SettingsTab,} from "./settings-layout";-// Inbox event groups rendered in the per-event toggle list. `system_notifications`+// Inbox event groups, by how the event reaches you. `system_notifications`// is a sibling preference key but lives in its own section below.-const INBOX_GROUP_KEYS = [- "assignments",- "status_changes",- "comments",- "mentions",- "updates",- "new_issues",- "agent_activity",+const INBOX_CATEGORIES = [+ { key: "direct", groups: ["assignments", "mentions"] },+ { key: "issues", groups: ["status_changes", "comments", "updates"] },+ { key: "projects", groups: ["new_issues"] },+ { key: "agents", groups: ["agent_activity"] },] as const;-type InboxGroupKey = (typeof INBOX_GROUP_KEYS)[number];export function NotificationsTab() {const { t } = useT("settings");const wsId = useWorkspaceId();+ const p = useWorkspacePaths();const { data } = useQuery(notificationPreferenceOptions(wsId));const mutation = useUpdateNotificationPreferences();@@ -66,9 +69,17 @@ export function NotificationsTab() {anchor="inbox"><SettingsCard>- {INBOX_GROUP_KEYS.map((key: InboxGroupKey) => {- const enabled = preferences[key] !== "muted";- return (+ {INBOX_CATEGORIES.map((category, index) => (+ <Fragment key={category.key}>+ <div+ className={cn(+ "border-b-0 px-4 pb-1 text-caption font-medium text-muted-foreground",+ index === 0 ? "pt-3" : "pt-4",+ )}+ >+ {t(($) => $.notifications.categories[category.key])}+ </div>+ {category.groups.map((key) => (<SettingsRowkey={key}anchor={key}@@ -76,13 +87,51 @@ export function NotificationsTab() {description={t(($) => $.notifications.groups[key].description)}><Switch- checked={enabled}+ checked={preferences[key] !== "muted"}aria-label={t(($) => $.notifications.groups[key].label)}onCheckedChange={(checked) => handleToggle(key, checked)}/></SettingsRow>- );- })}+ ))}+ </Fragment>+ ))}+ </SettingsCard>+ </SettingsSection>++ <SettingsSection+ title={t(($) => $.notifications.leaving.title)}+ description={t(($) => $.notifications.leaving.description)}+ anchor="leaving_inbox"+ >+ <SettingsCard>+ <SettingsRow+ label={t(($) => $.notifications.leaving.manual_label)}+ description={t(($) => $.notifications.leaving.manual_description)}+ >+ <span className="text-caption text-muted-foreground">+ {t(($) => $.notifications.leaving.manual_value)}+ </span>+ </SettingsRow>+ <SettingsRow+ label={t(($) => $.notifications.leaving.done_label)}+ description={t(($) => $.notifications.leaving.done_description)}+ >+ <span className="text-caption text-muted-foreground">+ {t(($) => $.notifications.leaving.done_value)}+ </span>+ </SettingsRow>+ <SettingsRow+ anchor="archived"+ label={t(($) => $.notifications.leaving.archived_label)}+ description={t(($) => $.notifications.leaving.archived_description)}+ >+ <AppLink+ href={`${p.inbox()}?${new URLSearchParams({ view: ARCHIVED_VIEW_PARAM })}`}+ className={buttonVariants({ variant: "outline", size: "sm" })}+ >+ {t(($) => $.notifications.leaving.archived_action)}+ </AppLink>+ </SettingsRow></SettingsCard></SettingsSection>diff --git a/packages/views/settings/components/use-settings-search-index.ts b/packages/views/settings/components/use-settings-search-index.tsindex 3885860c30..7edf1aad87 100644--- a/packages/views/settings/components/use-settings-search-index.ts+++ b/packages/views/settings/components/use-settings-search-index.ts@@ -181,6 +181,12 @@ export function useSettingsSearchIndex(title: t(($) => $.notifications.groups[group].label),description: t(($) => $.notifications.groups[group].description),})),+ {+ tab: "notifications",+ anchor: "archived",+ title: t(($) => $.notifications.leaving.archived_label),+ description: t(($) => $.notifications.leaving.archived_description),+ },{tab: "notifications",anchor: "chat_replies",diff --git a/server/cmd/server/notification_listeners.go b/server/cmd/server/notification_listeners.goindex 0663abf04b..0f3cb35be6 100644--- a/server/cmd/server/notification_listeners.go+++ b/server/cmd/server/notification_listeners.go@@ -225,19 +225,72 @@ func archiveStaleTaskFailedInbox(if len(rows) == 0 {return}+ recipients := make([]inboxArchivedRecipient, len(rows))+ for i, row := range rows {+ recipients[i] = inboxArchivedRecipient{Type: row.RecipientType, ID: row.RecipientID}+ }+ count := publishInboxBatchArchived(bus, workspaceID, issueID, recipients)++ slog.Info("auto-archive task_failed inbox: archived stale rows",+ "workspace_id", workspaceID, "issue_id", issueID,+ "row_count", len(rows), "recipient_count", count)+}- // Dedupe recipients: the listener creates one row per failure event per- // subscriber, so a long-running issue can yield several rows for the- // same recipient.+// archiveDoneIssueInbox archives every recipient's notifications for an issue+// that reached a done status: finished work leaves the inbox whether or not+// it was read. Cancelled issues keep theirs.+func archiveDoneIssueInbox(+ ctx context.Context,+ queries *db.Queries,+ bus *events.Bus,+ workspaceID string,+ issueID string,+) {+ rows, err := queries.ArchiveInboxByIssueForAllRecipients(ctx, db.ArchiveInboxByIssueForAllRecipientsParams{+ WorkspaceID: parseUUID(workspaceID),+ IssueID: parseUUID(issueID),+ })+ if err != nil {+ slog.Error("auto-archive done issue inbox: query failed",+ "workspace_id", workspaceID, "issue_id", issueID, "error", err)+ return+ }+ if len(rows) == 0 {+ return+ }+ recipients := make([]inboxArchivedRecipient, len(rows))+ for i, row := range rows {+ recipients[i] = inboxArchivedRecipient{Type: row.RecipientType, ID: row.RecipientID}+ }+ count := publishInboxBatchArchived(bus, workspaceID, issueID, recipients)++ slog.Info("auto-archive done issue inbox: archived rows",+ "workspace_id", workspaceID, "issue_id", issueID,+ "row_count", len(rows), "recipient_count", count)+}++type inboxArchivedRecipient struct {+ Type string+ ID pgtype.UUID+}++// publishInboxBatchArchived sends one inbox:batch-archived per member+// recipient, so connected clients drop the archived rows. Returns the number+// of recipients notified.+func publishInboxBatchArchived(+ bus *events.Bus,+ workspaceID string,+ issueID string,+ rows []inboxArchivedRecipient,+) int {+ // A recipient can hold several rows for one issue.counts := map[string]int{}for _, row := range rows {- // Inbox rows for task_failed only target member recipients today- // (notifySubscribers skips agent subscribers), but defend the WS- // layer against future widening — only members get a personal feed.- if row.RecipientType != "member" {+ // Only members get a personal feed.+ if row.Type != "member" {continue}- counts[util.UUIDToString(row.RecipientID)]+++ counts[util.UUIDToString(row.ID)]++}for recipientID, count := range counts {@@ -252,10 +305,7 @@ func archiveStaleTaskFailedInbox(},})}-- slog.Info("auto-archive task_failed inbox: archived stale rows",- "workspace_id", workspaceID, "issue_id", issueID,- "row_count", len(rows), "recipient_count", len(counts))+ return len(counts)}// notifySubscribers queries the subscriber table for an issue, excludes the@@ -914,6 +964,17 @@ func registerNotificationListeners(bus *events.Bus, queries *db.Queries) {case handoff && issue.Status != issuestatus.Blocked:archiveStaleTaskFailedInbox(ctx, queries, bus, e.WorkspaceID, issue.ID)}++ // After the status_changed rows above, so "moved to Done" leaves+ // the inbox together with the rest of the issue's notifications.+ category, categoryErr := issuestatus.CategoryWithError(ctx, queries, parseUUID(e.WorkspaceID), issue.Status)+ switch {+ case categoryErr != nil:+ slog.Warn("resolve issue status category for done-issue inbox archive; keeping rows",+ "issue_id", issue.ID, "status", issue.Status, "error", categoryErr)+ case category == issuestatus.CategoryDone:+ archiveDoneIssueInbox(ctx, queries, bus, e.WorkspaceID, issue.ID)+ }}if priorityChanged, _ := payload["priority_changed"].(bool); priorityChanged {diff --git a/server/cmd/server/notification_listeners_test.go b/server/cmd/server/notification_listeners_test.goindex 465048c12b..6763aa0269 100644--- a/server/cmd/server/notification_listeners_test.go+++ b/server/cmd/server/notification_listeners_test.go@@ -958,7 +958,8 @@ func TestNotification_ParentBubble_StatusChanged(t *testing.T) {ID: subID,WorkspaceID: testWorkspaceID,Title: "sub-issue status bubble",- Status: "done",+ // Not done: a done issue's notifications are archived at once.+ Status: "in_review",Priority: "medium",CreatorType: "member",CreatorID: testUserID,@@ -1250,6 +1251,103 @@ func TestNotification_StatusChange_ArchivesStaleTaskFailed(t *testing.T) {}}+// countActiveInboxForIssue counts a recipient's unarchived rows on an issue.+func countActiveInboxForIssue(t *testing.T, recipientID, issueID string) int {+ t.Helper()+ var n int+ if err := testPool.QueryRow(context.Background(), `+ SELECT count(*) FROM inbox_item+ WHERE recipient_type = 'member' AND recipient_id = $1 AND issue_id = $2 AND archived = false+ `, recipientID, issueID).Scan(&n); err != nil {+ t.Fatalf("countActiveInboxForIssue: %v", err)+ }+ return n+}++// TestNotification_StatusChange_DoneArchivesIssueInbox verifies that moving an+// issue to Done archives every notification on it for every recipient, read+// or unread, including the status_changed row the transition itself writes.+func TestNotification_StatusChange_DoneArchivesIssueInbox(t *testing.T) {+ queries := db.New(testPool)+ bus := newNotificationBus(t, queries)++ subEmail := "[email protected]"+ subID := createNotificationMember(t, subEmail)+ t.Cleanup(func() { cleanupTestUser(t, subEmail) })++ issueID := createTestIssue(t, testWorkspaceID, testUserID)+ t.Cleanup(func() {+ cleanupInboxForIssue(t, issueID)+ cleanupTestIssue(t, issueID)+ })+ addTestSubscriber(t, issueID, "member", testUserID, "creator")+ addTestSubscriber(t, issueID, "member", subID, "assignee")++ for _, row := range []struct {+ recipient string+ read bool+ }{{testUserID, false}, {testUserID, true}, {subID, false}} {+ if _, err := testPool.Exec(context.Background(), `+ INSERT INTO inbox_item (workspace_id, recipient_type, recipient_id, type, severity, issue_id, title, details, read)+ VALUES ($1, 'member', $2, 'new_comment', 'info', $3, 'done archive test', '{}', $4)+ `, testWorkspaceID, row.recipient, issueID, row.read); err != nil {+ t.Fatalf("seed notification: %v", err)+ }+ }++ var batchArchived []events.Event+ bus.Subscribe(protocol.EventInboxBatchArchived, func(e events.Event) {+ batchArchived = append(batchArchived, e)+ })++ publishStatusChange(bus, issueID, "done", "in_review")++ for _, recipient := range []string{testUserID, subID} {+ if active := countActiveInboxForIssue(t, recipient, issueID); active != 0 {+ t.Fatalf("recipient %s: expected no active inbox rows on a done issue, got %d", recipient, active)+ }+ }+ seen := map[string]bool{}+ for _, e := range batchArchived {+ payload, _ := e.Payload.(map[string]any)+ if payload["issue_id"] != issueID {+ continue+ }+ recipientID, _ := payload["recipient_id"].(string)+ seen[recipientID] = true+ }+ if !seen[testUserID] || !seen[subID] {+ t.Fatalf("expected inbox:batch-archived for both recipients, got %v", seen)+ }+}++// TestNotification_StatusChange_CancelledKeepsIssueInbox verifies that only a+// done status clears the inbox; a cancelled issue keeps its notifications.+func TestNotification_StatusChange_CancelledKeepsIssueInbox(t *testing.T) {+ queries := db.New(testPool)+ bus := newNotificationBus(t, queries)++ issueID := createTestIssue(t, testWorkspaceID, testUserID)+ t.Cleanup(func() {+ cleanupInboxForIssue(t, issueID)+ cleanupTestIssue(t, issueID)+ })+ addTestSubscriber(t, issueID, "member", testUserID, "creator")++ if _, err := testPool.Exec(context.Background(), `+ INSERT INTO inbox_item (workspace_id, recipient_type, recipient_id, type, severity, issue_id, title, details)+ VALUES ($1, 'member', $2, 'new_comment', 'info', $3, 'cancelled keep test', '{}')+ `, testWorkspaceID, testUserID, issueID); err != nil {+ t.Fatalf("seed notification: %v", err)+ }++ publishStatusChange(bus, issueID, "cancelled", "in_progress")++ if active := countActiveInboxForIssue(t, testUserID, issueID); active != 1 {+ t.Fatalf("expected the notification to stay on a cancelled issue, got %d active", active)+ }+}+// TestNotification_StatusChange_NonTerminalKeepsTaskFailed verifies that a// transition to a non-terminal status (e.g. in_progress) does NOT archive// existing task_failed inbox rows.diff --git a/server/pkg/db/generated/inbox.sql.go b/server/pkg/db/generated/inbox.sql.goindex 94d8da321b..93c5c37e27 100644--- a/server/pkg/db/generated/inbox.sql.go+++ b/server/pkg/db/generated/inbox.sql.go@@ -158,6 +158,43 @@ func (q *Queries) ArchiveInboxByIssueAndType(ctx context.Context, arg ArchiveInbreturn items, nil}+const archiveInboxByIssueForAllRecipients = `-- name: ArchiveInboxByIssueForAllRecipients :many+UPDATE inbox_item SET archived = true+WHERE workspace_id = $1 AND issue_id = $2 AND archived = false+RETURNING recipient_type, recipient_id+`++type ArchiveInboxByIssueForAllRecipientsParams struct {+ WorkspaceID pgtype.UUID `json:"workspace_id"`+ IssueID pgtype.UUID `json:"issue_id"`+}++type ArchiveInboxByIssueForAllRecipientsRow struct {+ RecipientType string `json:"recipient_type"`+ RecipientID pgtype.UUID `json:"recipient_id"`+}++// A done issue leaves every recipient's inbox, read or not.+func (q *Queries) ArchiveInboxByIssueForAllRecipients(ctx context.Context, arg ArchiveInboxByIssueForAllRecipientsParams) ([]ArchiveInboxByIssueForAllRecipientsRow, error) {+ rows, err := q.db.Query(ctx, archiveInboxByIssueForAllRecipients, arg.WorkspaceID, arg.IssueID)+ if err != nil {+ return nil, err+ }+ defer rows.Close()+ items := []ArchiveInboxByIssueForAllRecipientsRow{}+ for rows.Next() {+ var i ArchiveInboxByIssueForAllRecipientsRow+ if err := rows.Scan(&i.RecipientType, &i.RecipientID); err != nil {+ return nil, err+ }+ items = append(items, i)+ }+ if err := rows.Err(); err != nil {+ return nil, err+ }+ return items, nil+}+const archiveInboxItem = `-- name: ArchiveInboxItem :oneUPDATE inbox_item SET archived = trueWHERE id = $1diff --git a/server/pkg/db/queries/inbox.sql b/server/pkg/db/queries/inbox.sqlindex 50b4f1e415..e264155871 100644--- a/server/pkg/db/queries/inbox.sql+++ b/server/pkg/db/queries/inbox.sql@@ -225,6 +225,12 @@ RETURNING *;UPDATE inbox_item SET archived = falseWHERE workspace_id = $1 AND recipient_type = $2 AND recipient_id = $3 AND issue_id = $4 AND archived = true;+-- name: ArchiveInboxByIssueForAllRecipients :many+-- A done issue leaves every recipient's inbox, read or not.+UPDATE inbox_item SET archived = true+WHERE workspace_id = $1 AND issue_id = $2 AND archived = false+RETURNING recipient_type, recipient_id;+-- name: ArchiveInboxByIssueAndType :manyUPDATE inbox_item SET archived = trueWHERE workspace_id = $1 AND issue_id = $2 AND type = $3 AND archived = false