Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-8280: refactor(issues): trim issue sidebar header actions (#9580)
Multica Evee3f265ae5ae2
diff --git a/e2e/fixtures.ts b/e2e/fixtures.tsindex b9ff5dba43..ea3336b661 100644--- a/e2e/fixtures.ts+++ b/e2e/fixtures.ts@@ -53,6 +53,7 @@ export class TestApiClient {private createdIssueIds: string[] = [];private createdProjectIds: string[] = [];private seededIssueIds: string[] = [];+ private createdPropertyIds: string[] = [];async login(email: string, name: string) {const client = new pg.Client(DATABASE_URL);@@ -199,6 +200,20 @@ export class TestApiClient {return project as { id: string; title: string; status: string };}+ /** Create a workspace custom property definition; archived on cleanup. */+ async createProperty(name: string, type = "text") {+ const res = await this.authedFetch("/api/properties", {+ method: "POST",+ body: JSON.stringify({ name, type }),+ });+ if (!res.ok) {+ throw new Error(`create property failed: ${res.status} ${await res.text()}`);+ }+ const property = await res.json();+ this.createdPropertyIds.push(property.id);+ return property as { id: string; name: string };+ }+async updateProject(id: string, updates: Record<string, unknown>) {const res = await this.authedFetch(`/api/projects/${id}`, {method: "PUT",@@ -452,6 +467,19 @@ export class TestApiClient {}}this.createdProjectIds = [];+ // Definitions cannot be deleted, only archived; archiving takes them out+ // of every picker so later tests see the catalog they expect.+ for (const id of this.createdPropertyIds) {+ try {+ await this.authedFetch(`/api/properties/${id}`, {+ method: "PATCH",+ body: JSON.stringify({ archived: true }),+ });+ } catch {+ /* ignore */+ }+ }+ this.createdPropertyIds = [];}getToken() {diff --git a/e2e/issue-add-property-overflow.spec.ts b/e2e/issue-add-property-overflow.spec.tsnew file mode 100644index 0000000000..845cd78e3d--- /dev/null+++ b/e2e/issue-add-property-overflow.spec.ts@@ -0,0 +1,68 @@+import { expect, test } from "@playwright/test";+import { createTestApi, loginAsDefault, waitForPageText } from "./helpers";+import type { TestApiClient } from "./fixtures";++// The server caps a workspace at 20 active properties; together with the+// built-in optional fields that is far taller than a 600px window.+const PROPERTY_COUNT = 20;++/**+ * MUL-8280: the issue sidebar's "+ Add property" list is a Popover, which has+ * no height bound of its own. With a long workspace property catalog the list+ * ran past the bottom of the window and its tail options could not be reached.+ */+test.describe("Issue sidebar add property", () => {+ let api: TestApiClient;++ test.beforeEach(async () => {+ api = await createTestApi();+ });++ test.afterEach(async () => {+ await api?.cleanup();+ });++ test("keeps a long property list inside the viewport and lets the last option be picked", async ({ page }) => {+ await page.setViewportSize({ width: 1440, height: 600 });+ const suffix = Date.now().toString(36);+ const names: string[] = [];+ for (let i = 0; i < PROPERTY_COUNT; i++) {+ const name = `Overflow ${suffix} ${String(i).padStart(2, "0")}`;+ await api.createProperty(name);+ names.push(name);+ }+ const title = `E2E add property overflow ${suffix}`;+ const issue = await api.createIssue(title);+ const slug = await loginAsDefault(page);+ await page.goto(`/${slug}/issues/${issue.id}`, { waitUntil: "domcontentloaded" });+ await waitForPageText(page, title);++ await page.locator("[data-right-sidebar-panel]").getByRole("button", { name: "Add property" }).click();+ const popover = page.getByTestId("add-property-popover");+ await expect(popover).toBeVisible();++ const viewport = page.viewportSize();+ const box = await popover.boundingBox();+ if (!viewport || !box) throw new Error("Could not measure the add property list");+ expect(box.y).toBeGreaterThanOrEqual(0);+ expect(box.y + box.height).toBeLessThanOrEqual(viewport.height);++ // Wheel inside the list, then click the last option with the mouse: an+ // option outside the window is exactly what the report was about.+ const last = popover.getByRole("button", { name: names[names.length - 1] });+ await popover.hover();+ await page.mouse.wheel(0, 5000);+ // The list scrolls inside its own bounded box; wheel scrolling is async.+ await expect.poll(() => popover.evaluate((el) => el.scrollTop)).toBeGreaterThan(0);+ await expect.poll(async () => {+ const b = await last.boundingBox();+ return b ? b.y + b.height : Infinity;+ }).toBeLessThanOrEqual(viewport.height);+ const lastBox = await last.boundingBox();+ if (!lastBox) throw new Error("Could not measure the last option");+ await page.mouse.click(lastBox.x + lastBox.width / 2, lastBox.y + lastBox.height / 2);++ await expect(popover).not.toBeVisible();+ await expect(page.getByText(names[names.length - 1], { exact: true })).toBeVisible();+ });+});diff --git a/packages/views/issues/components/issue-detail.test.tsx b/packages/views/issues/components/issue-detail.test.tsxindex 8b356a7168..dab58306d6 100644--- a/packages/views/issues/components/issue-detail.test.tsx+++ b/packages/views/issues/components/issue-detail.test.tsx@@ -1,7 +1,6 @@import { forwardRef, useEffect, useRef, useState, useImperativeHandle } from "react";import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";import { act, fireEvent, render, screen, waitFor, within } from "@testing-library/react";-import userEvent from "@testing-library/user-event";import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import type { AgentTask, Attachment, Issue, IssueStatusEntry, Label, TimelineEntry } from "@multica/core/types";import { issueKeys } from "@multica/core/issues/queries";@@ -1169,36 +1168,24 @@ describe("IssueDetail (shared)", () => {expect(screen.getByRole("button", { name: "Add property" })).toBeInTheDocument();});- it("opens property management independently while Properties is folded", async () => {+ it("keeps the Properties header free of add and settings buttons", async () => {renderIssueDetail();const disclosure = await screen.findByRole("button", { name: "Properties" });+ const header = disclosure.parentElement!;+ expect(within(header).queryByRole("button", { name: "Add property" })).not.toBeInTheDocument();+ expect(screen.queryByRole("button", { name: "Properties options" })).not.toBeInTheDocument();+ // Folding the section hides the inline Add property row with the rest of the grid.fireEvent.click(disclosure);- fireEvent.click(screen.getByRole("button", { name: "Properties options" }));- expect(disclosure).toHaveAttribute("aria-expanded", "false");- fireEvent.click(await screen.findByRole("menuitem", { name: "Custom property settings" }));- expect(settingsPush).toHaveBeenCalledWith("/test/settings?tab=properties");+ expect(screen.queryByRole("button", { name: "Add property" })).not.toBeInTheDocument();});- it("returns focus to Add property when the menu is dismissed without selecting a field", async () => {- const user = userEvent.setup();+ it("adds an optional field from the inline Add property row and closes the popover", async () => {renderIssueDetail();- const trigger = await screen.findByRole("button", { name: "Add property" });- await user.click(trigger);- expect(await screen.findByRole("menuitem", { name: "Start date" })).toBeVisible();- await user.keyboard("{Escape}");- await waitFor(() => expect(trigger).toHaveFocus());- expect(screen.queryByRole("menuitem", { name: "Start date" })).not.toBeInTheDocument();- });-- it("keeps add-property available when folded and expands after choosing a field", async () => {- renderIssueDetail();- const disclosure = await screen.findByRole("button", { name: "Properties" });- fireEvent.click(disclosure);- expect(disclosure).toHaveAttribute("aria-expanded", "false");- fireEvent.click(screen.getByRole("button", { name: "Add property" }));- fireEvent.click(await screen.findByRole("menuitem", { name: "Start date" }));- await waitFor(() => expect(disclosure).toHaveAttribute("aria-expanded", "true"));- expect(within(disclosure.parentElement!.parentElement!).getAllByText("Start date")[0]).toBeVisible();+ fireEvent.click(await screen.findByRole("button", { name: "Add property" }));+ fireEvent.click(await screen.findByRole("button", { name: "Start date" }));+ // The popover closes (its other options are gone) and the new row is rendered.+ await waitFor(() => expect(screen.queryByRole("button", { name: "Labels" })).not.toBeInTheDocument());+ expect(screen.getAllByText("Start date")[0]).toBeVisible();});it("uses a non-resizable layout with the sidebar sheet closed by default on mobile", async () => {diff --git a/packages/views/issues/components/issue-detail.tsx b/packages/views/issues/components/issue-detail.tsxindex ad86c504f9..492d8502f7 100644--- a/packages/views/issues/components/issue-detail.tsx+++ b/packages/views/issues/components/issue-detail.tsx@@ -176,7 +176,6 @@ import { PAGE_GUTTER } from "../../layout/page-header";import { ProgressRing } from "./progress-ring";import { matchesPinyin } from "../../editor/extensions/pinyin-match";import { MetadataSection } from "./metadata-section";-import { IssueSidebarSettingsMenu } from "./issue-sidebar-settings-menu";import { IssueSidebarSectionHeader, IssueSidebarStack, IssueSidebarPropertyGrid } from "./issue-sidebar-section";import { useT } from "../../i18n";import { useIssueDetailScrollRestore } from "../hooks/use-issue-detail-scroll-restore";@@ -1374,9 +1373,11 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr// picked it from "+ Add property" and we want them dropped straight into// edit state). Consumed by the row that matches this key, cleared after.const [autoOpenProp, setAutoOpenProp] = useState<OptionalPropKey | null>(null);- // Keep the add menu controlled while its action opens the field picker.- const [addPropMenuOpen, setAddPropMenuOpen] = useState(false);- const propertyPickerOpeningRef = useRef(false);+ // Controlled state for the "+ Add property" popover. Base UI's Popover+ // doesn't auto-dismiss on item click (it's not a Menu primitive), so the+ // popover would stay open behind the newly auto-opened picker — two+ // popovers stacked. We close it explicitly in `addOptionalProp`.+ const [addPropPopoverOpen, setAddPropPopoverOpen] = useState(false);// Virtuoso's `customScrollParent` wants the HTMLElement, not a ref. A plain// `useRef.current` does not trigger a re-render when it populates, so the// Virtuoso prop would never receive the element. Callback ref + state fixes@@ -2581,10 +2582,9 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = trreturn next;});setAutoOpenProp(key);- // Let the field picker take focus instead of restoring it to the menu trigger.- propertyPickerOpeningRef.current = true;- setPropertiesOpen(true);- setAddPropMenuOpen(false);+ // Dismiss the "+ Add property" popover so it doesn't sit stacked+ // behind the picker we're about to auto-open.+ setAddPropPopoverOpen(false);},[],);@@ -2596,10 +2596,8 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = trnext.add(propertyId);return next;});- propertyPickerOpeningRef.current = true;setAutoOpenCustomProp(propertyId);- setPropertiesOpen(true);- setAddPropMenuOpen(false);+ setAddPropPopoverOpen(false);}, []);// Clear the auto-open flag after the next render so pickers (which read@@ -2734,88 +2732,99 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr) || workspaceProperties.some((property) => !property.archived && !visibleCustomProps.has(property.id) && issue.properties?.[property.id] === undefined,);- const addPropertyAction = canAddProperty && (- <DropdownMenu open={addPropMenuOpen} onOpenChange={(open) => {- if (open) propertyPickerOpeningRef.current = false;- setAddPropMenuOpen(open);- }}>- <DropdownMenuTrigger render={<IconButton size="icon-xs" label={t(($) => $.detail.add_property_action)} />}>- <Plus />- </DropdownMenuTrigger>- {/* 388px is the sidebar's 420px resize limit minus its 16px padding on each side. */}- <DropdownMenuContent- align="end"- className="w-max max-w-[min(388px,var(--available-width))]"- finalFocus={() => !propertyPickerOpeningRef.current}- >- {OPTIONAL_PROP_KEYS.filter((k) => !visibleOptionalProps.has(k) && (k !== "stage" || issue.parent_issue_id != null)).map((k) => (- <DropdownMenuItem- key={k}- onClick={() => addOptionalProp(k)}- >- {k === "priority" && (- <PriorityIcon priority="medium" inheritColor className="text-muted-foreground" />- )}- {k === "stage" && (- <Milestone className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />- )}- {k === "start_date" && (- <CalendarClock className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />- )}- {k === "due_date" && (- <CalendarDays className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />- )}- {k === "labels" && (- <Tag className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />- )}- <span className="truncate">- {k === "priority" && t(($) => $.detail.prop_priority)}- {k === "stage" && t(($) => $.detail.prop_stage)}- {k === "start_date" && t(($) => $.detail.prop_start_date)}- {k === "due_date" && t(($) => $.detail.prop_due_date)}- {k === "labels" && t(($) => $.detail.prop_labels)}- </span>- </DropdownMenuItem>- ))}- {(() => {- const addable = workspaceProperties.filter(- (p) =>- !p.archived &&- !visibleCustomProps.has(p.id) &&- issue.properties?.[p.id] === undefined,- );- if (addable.length === 0) return null;- return (- <>- <div className="my-1 h-px bg-border" />- {addable.map((p) => (- <DropdownMenuItem- key={p.id}- onClick={() => addCustomProp(p.id)}- >- {p.icon ? (- <PropertyIcon property={p} className="size-3.5 text-caption" />- ) : (- <SlidersHorizontal className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />- )}- <span className="line-clamp-2 min-w-0 break-words [overflow-wrap:anywhere]" title={p.name}>{p.name}</span>- </DropdownMenuItem>- ))}- </>- );- })()}- </DropdownMenuContent>- </DropdownMenu>+ // "+ Add property" — an inline row at the bottom of the Properties grid+ // that opens a Popover listing optional fields not yet displayed. Hidden+ // once every optional field is on screen.+ const addPropertyRow = canAddProperty && (+ <div className="col-span-2 mt-1">+ <Popover open={addPropPopoverOpen} onOpenChange={setAddPropPopoverOpen}>+ <PopoverTrigger+ className="-mx-2 flex items-center gap-1.5 rounded-md px-2 py-1 text-caption text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground"+ >+ <Plus className="h-3 w-3 shrink-0" />+ <span>{t(($) => $.detail.add_property_action)}</span>+ </PopoverTrigger>+ {/* Each option leads with the icon the resulting picker uses, so the+ list reads as a preview of what will show up above. 388px is the+ sidebar's 420px resize limit minus its 16px padding on each side.+ Popover (unlike DropdownMenu) has no height bound of its own, so a+ long property catalog must be capped to the space the positioner+ reports and scroll inside, or its tail renders off-screen. */}+ <PopoverContent+ align="start"+ data-testid="add-property-popover"+ className="max-h-(--available-height) w-max min-w-44 max-w-[min(388px,var(--available-width))] overflow-y-auto overscroll-contain p-1"+ >+ {OPTIONAL_PROP_KEYS.filter((k) => !visibleOptionalProps.has(k) && (k !== "stage" || issue.parent_issue_id != null)).map((k) => (+ <button+ key={k}+ type="button"+ onClick={() => addOptionalProp(k)}+ className="flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-caption text-foreground transition-colors hover:bg-accent focus-visible:bg-accent focus-visible:outline-none"+ >+ {k === "priority" && (+ <PriorityIcon priority="medium" inheritColor className="text-muted-foreground" />+ )}+ {k === "stage" && (+ <Milestone className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />+ )}+ {k === "start_date" && (+ <CalendarClock className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />+ )}+ {k === "due_date" && (+ <CalendarDays className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />+ )}+ {k === "labels" && (+ <Tag className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />+ )}+ <span className="truncate">+ {k === "priority" && t(($) => $.detail.prop_priority)}+ {k === "stage" && t(($) => $.detail.prop_stage)}+ {k === "start_date" && t(($) => $.detail.prop_start_date)}+ {k === "due_date" && t(($) => $.detail.prop_due_date)}+ {k === "labels" && t(($) => $.detail.prop_labels)}+ </span>+ </button>+ ))}+ {(() => {+ const addable = workspaceProperties.filter(+ (p) =>+ !p.archived &&+ !visibleCustomProps.has(p.id) &&+ issue.properties?.[p.id] === undefined,+ );+ if (addable.length === 0) return null;+ return (+ <>+ <div className="my-1 h-px bg-border" />+ {addable.map((p) => (+ <button+ key={p.id}+ type="button"+ onClick={() => addCustomProp(p.id)}+ className="flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-caption text-foreground transition-colors hover:bg-accent focus-visible:bg-accent focus-visible:outline-none"+ >+ {p.icon ? (+ <PropertyIcon property={p} className="size-3.5 text-caption" />+ ) : (+ <SlidersHorizontal className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />+ )}+ <span className="line-clamp-2 min-w-0 break-words [overflow-wrap:anywhere]" title={p.name}>{p.name}</span>+ </button>+ ))}+ </>+ );+ })()}+ </PopoverContent>+ </Popover>+ </div>);const sidebarContent = (<IssueSidebarStack>{/* Properties */}<div>- <IssueSidebarSectionHeader title={t(($) => $.detail.section_properties)} open={propertiesOpen} onOpenChange={setPropertiesOpen} actions={<>- {addPropertyAction}- <IssueSidebarSettingsMenu title={t(($) => $.detail.section_properties)} label={t(($) => $.sidebar_settings.properties)} tab="properties" />- </>} />+ <IssueSidebarSectionHeader title={t(($) => $.detail.section_properties)} open={propertiesOpen} onOpenChange={setPropertiesOpen} />{propertiesOpen && <IssueSidebarPropertyGrid>{/* Core props — always rendered. */}<PropRow label={t(($) => $.detail.prop_status)}>@@ -2921,10 +2930,10 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr</PropRow>))}+ {addPropertyRow}</IssueSidebarPropertyGrid>}</div>- {/* Keep creation available even when the workspace has no active quick actions. */}<QuickActionsSection issueId={issue.id} /><WakeupsSectiondiff --git a/packages/views/issues/components/issue-sidebar-settings-menu.test.tsx b/packages/views/issues/components/issue-sidebar-settings-menu.test.tsxdeleted file mode 100644index 2927a8aaf4..0000000000--- a/packages/views/issues/components/issue-sidebar-settings-menu.test.tsx+++ /dev/null@@ -1,53 +0,0 @@-import { fireEvent, screen, waitFor } from "@testing-library/react";-import userEvent from "@testing-library/user-event";-import { beforeEach, describe, expect, it, vi } from "vitest";-import { renderWithI18n } from "../../test/i18n";-import { DropdownMenuItem } from "@multica/ui/components/ui/dropdown-menu";-import { IssueSidebarSettingsMenu } from "./issue-sidebar-settings-menu";--const push = vi.hoisted(() => vi.fn());-vi.mock("@multica/core/paths", () => ({ useWorkspacePaths: () => ({ settings: () => "/acme/settings" }) }));-vi.mock("../../navigation", () => ({ useNavigation: () => ({ push }) }));--beforeEach(() => push.mockReset());--describe("IssueSidebarSettingsMenu", () => {- it.each(["quick-actions", "wakeups", "properties", "plugins", "code"] as const)("opens the workspace %s settings", async (tab) => {- renderWithI18n(<IssueSidebarSettingsMenu title="Section" label="Section settings" tab={tab} />);- fireEvent.click(screen.getByRole("button", { name: "Section options" }));- fireEvent.click(await screen.findByRole("menuitem", { name: "Section settings" }));- expect(push).toHaveBeenCalledExactlyOnceWith(`/acme/settings?tab=${tab}`);- });-- it("composes section actions before settings without navigating on action clicks", async () => {- const action = vi.fn();- renderWithI18n(- <IssueSidebarSettingsMenu title="Pull requests" triggerLabel="Pull request automation" label="PR merge settings" tab="code">- <DropdownMenuItem onClick={action}>Keep status when PRs merge</DropdownMenuItem>- </IssueSidebarSettingsMenu>,- );- fireEvent.click(screen.getByRole("button", { name: "Pull request automation" }));- const item = await screen.findByRole("menuitem", { name: "Keep status when PRs merge" });- expect(screen.getAllByRole("menuitem").map((node) => node.textContent)).toEqual(["Keep status when PRs merge", "PR merge settings"]);- fireEvent.click(item);- expect(action).toHaveBeenCalledOnce();- expect(push).not.toHaveBeenCalled();- });-- it("supports keyboard opening and Escape restores focus without navigating", async () => {- const user = userEvent.setup();- renderWithI18n(<IssueSidebarSettingsMenu title="Properties" label="Custom property settings" tab="properties" />);- const trigger = screen.getByRole("button", { name: "Properties options" });- trigger.focus();- await user.keyboard("{Enter}");- expect(await screen.findByRole("menuitem", { name: "Custom property settings" })).toBeVisible();- await user.keyboard("{Escape}");- await waitFor(() => expect(trigger).toHaveFocus());- expect(push).not.toHaveBeenCalled();- });-- it("localizes the menu trigger", () => {- renderWithI18n(<IssueSidebarSettingsMenu title="属性" label="自定义属性设置" tab="properties" />, { locale: "zh-Hans" });- expect(screen.getByRole("button", { name: "属性选项" })).toBeVisible();- });-});diff --git a/packages/views/issues/components/issue-sidebar-settings-menu.tsx b/packages/views/issues/components/issue-sidebar-settings-menu.tsxdeleted file mode 100644index 1649e07b31..0000000000--- a/packages/views/issues/components/issue-sidebar-settings-menu.tsx+++ /dev/null@@ -1,36 +0,0 @@-"use client";--import type { ReactNode } from "react";-import { MoreHorizontal, Settings } from "lucide-react";-import { useWorkspacePaths } from "@multica/core/paths";-import { IconButton } from "@multica/ui/components/common/icon-button";-import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@multica/ui/components/ui/dropdown-menu";-import { useNavigation } from "../../navigation";-import { useT } from "../../i18n";--export function IssueSidebarSettingsMenu({ title, label, tab, triggerLabel, children }: {- title: string;- label: string;- tab: "quick-actions" | "wakeups" | "properties" | "plugins" | "code";- triggerLabel?: string;- children?: ReactNode;-}) {- const { t } = useT("issues");- const paths = useWorkspacePaths();- const navigation = useNavigation();-- return (- <DropdownMenu>- <DropdownMenuTrigger render={- <IconButton size="icon-xs" label={triggerLabel ?? t(($) => $.sidebar_settings.menu, { section: title })}><MoreHorizontal /></IconButton>- } />- <DropdownMenuContent align="end" className="w-max max-w-(--available-width)">- {children}- <DropdownMenuItem onClick={() => navigation.push(`${paths.settings()}?tab=${tab}`)}>- <Settings />- {label}- </DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>- );-}diff --git a/packages/views/issues/components/pull-requests-section.tsx b/packages/views/issues/components/pull-requests-section.tsxindex 66dcc3b887..3ed03360f5 100644--- a/packages/views/issues/components/pull-requests-section.tsx+++ b/packages/views/issues/components/pull-requests-section.tsx@@ -1,12 +1,11 @@"use client";-import { IssueSidebarSettingsMenu } from "./issue-sidebar-settings-menu";import { IssueSidebarSectionHeader } from "./issue-sidebar-section";import { useState } from "react";import { useQuery } from "@tanstack/react-query";import { toast } from "sonner";-import { CircleSlash, Plus, RotateCcw } from "lucide-react";+import { CircleSlash, MoreHorizontal, Plus, RotateCcw, Settings } from "lucide-react";import { ApiError } from "@multica/core/api";import {issuePullRequestsOptions,@@ -14,14 +13,19 @@ import {useLinkIssuePullRequest,useSetIssuePRAutoComplete,} from "@multica/core/github";+import { useWorkspacePaths } from "@multica/core/paths";import { Button } from "@multica/ui/components/ui/button";import { IconButton } from "@multica/ui/components/common/icon-button";import {+ DropdownMenu,+ DropdownMenuContent,DropdownMenuItem,DropdownMenuSeparator,+ DropdownMenuTrigger,} from "@multica/ui/components/ui/dropdown-menu";import { Input } from "@multica/ui/components/ui/input";import { Popover, PopoverContent, PopoverTrigger } from "@multica/ui/components/ui/popover";+import { useNavigation } from "../../navigation";import { useT } from "../../i18n";import { PullRequestList } from "./pull-request-list";@@ -183,32 +187,44 @@ function AutoCompleteMenu({workspaceEnabled: boolean;}) {const { t } = useT("issues");+ const paths = useWorkspacePaths();+ const navigation = useNavigation();const setAutoComplete = useSetIssuePRAutoComplete(issueId);+ // The only section menu left in the sidebar: it carries a real per-issue+ // action (keep status on merge), not just a link to settings.return (- <IssueSidebarSettingsMenu- title={t(($) => $.detail.section_pull_requests)}- triggerLabel={t(($) => $.pr_automation.section_menu)}- label={t(($) => $.pr_automation.settings)}- tab="code"- >- {/* When the workspace leaves status alone, the issue switch changes nothing. */}- {workspaceEnabled ? (- <>- <DropdownMenuItem- disabled={setAutoComplete.isPending}- onClick={() =>- setAutoComplete.mutate(!disabled, {- onError: () => toast.error(t(($) => $.pr_automation.update_failed)),- })- }- >- {disabled ? <RotateCcw /> : <CircleSlash />}- {disabled ? t(($) => $.pr_automation.enable) : t(($) => $.pr_automation.disable)}- </DropdownMenuItem>- <DropdownMenuSeparator />- </>- ) : null}- </IssueSidebarSettingsMenu>+ <DropdownMenu>+ <DropdownMenuTrigger+ render={+ <IconButton variant="ghost" size="icon-xs" label={t(($) => $.pr_automation.section_menu)}>+ <MoreHorizontal />+ </IconButton>+ }+ />+ <DropdownMenuContent align="end" className="w-max max-w-(--available-width)">+ {/* When the workspace leaves status alone, the issue switch changes nothing. */}+ {workspaceEnabled ? (+ <>+ <DropdownMenuItem+ disabled={setAutoComplete.isPending}+ onClick={() =>+ setAutoComplete.mutate(!disabled, {+ onError: () => toast.error(t(($) => $.pr_automation.update_failed)),+ })+ }+ >+ {disabled ? <RotateCcw /> : <CircleSlash />}+ {disabled ? t(($) => $.pr_automation.enable) : t(($) => $.pr_automation.disable)}+ </DropdownMenuItem>+ <DropdownMenuSeparator />+ </>+ ) : null}+ <DropdownMenuItem onClick={() => navigation.push(`${paths.settings()}?tab=code`)}>+ <Settings />+ {t(($) => $.pr_automation.settings)}+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>);}diff --git a/packages/views/issues/components/quick-actions-section.test.tsx b/packages/views/issues/components/quick-actions-section.test.tsxindex 3ae6d7da76..55a18e53e2 100644--- a/packages/views/issues/components/quick-actions-section.test.tsx+++ b/packages/views/issues/components/quick-actions-section.test.tsx@@ -104,11 +104,11 @@ describe("QuickActionsSection", () => {it("hides during loading and outside a workspace", () => {loading = true;const view = renderWithI18n(<QuickActionsSection issueId="i-1" />);- expect(screen.queryByRole("button", { name: "New quick action" })).not.toBeInTheDocument();+ expect(screen.queryByText("Quick Actions")).not.toBeInTheDocument();loading = false;workspaceId = "";view.rerender(<QuickActionsSection issueId="i-1" />);- expect(screen.queryByRole("button", { name: "New quick action" })).not.toBeInTheDocument();+ expect(screen.queryByText("Quick Actions")).not.toBeInTheDocument();});it("retries a failed catalog query and removes recovery after success", () => {@@ -117,7 +117,6 @@ describe("QuickActionsSection", () => {const view = renderWithI18n(<QuickActionsSection issueId="i-1" />);fireEvent.click(screen.getByRole("button", { name: "Could not load. Retry" }));expect(refetch).toHaveBeenCalledOnce();- expect(screen.getByRole("button", { name: "New quick action" })).toBeVisible();queryError = false;listData = [action()];view.rerender(<QuickActionsSection issueId="i-1" />);@@ -125,28 +124,23 @@ describe("QuickActionsSection", () => {expect(screen.getByText("Code Review")).toBeVisible();});- it("keeps management available while folded and opens the action catalog", async () => {+ it("keeps the header free of create and settings buttons", () => {renderWithI18n(<QuickActionsSection issueId="i-1" />);- const disclosure = screen.getByRole("button", { name: "Quick Actions 1" });- fireEvent.click(disclosure);- fireEvent.click(screen.getByRole("button", { name: "Quick Actions options" }));- expect(disclosure).toHaveAttribute("aria-expanded", "false");- fireEvent.click(await screen.findByRole("menuitem", { name: "Quick action settings" }));- expect(settingsPush).toHaveBeenCalledWith("/acme/settings?tab=quick-actions");+ expect(screen.getByRole("button", { name: "Quick Actions 1" })).toBeVisible();+ expect(screen.queryByRole("button", { name: "New quick action" })).not.toBeInTheDocument();+ expect(screen.queryByRole("button", { name: "Quick Actions options" })).not.toBeInTheDocument();});- it("offers creation before the workspace has any actions", () => {+ it("renders nothing before the workspace has any actions", () => {listData = [];renderWithI18n(<QuickActionsSection issueId="i-1" />);- expect(screen.getByRole("button", { name: "New quick action" })).toBeVisible();- expect(screen.queryByRole("button", { name: "Quick Actions" })).not.toBeInTheDocument();- expect(screen.getByText("Quick Actions")).toBeVisible();+ expect(screen.queryByText("Quick Actions")).not.toBeInTheDocument();});it("hides archived actions even if the server returned them", () => {listData = [action({ status: "archived" })];renderWithI18n(<QuickActionsSection issueId="i-1" />);- expect(screen.getByRole("button", { name: "New quick action" })).toBeVisible();+ expect(screen.queryByText("Quick Actions")).not.toBeInTheDocument();expect(screen.queryByText("Code Review")).not.toBeInTheDocument();});diff --git a/packages/views/issues/components/quick-actions-section.tsx b/packages/views/issues/components/quick-actions-section.tsxindex a10b60a1d9..00fe4a0b57 100644--- a/packages/views/issues/components/quick-actions-section.tsx+++ b/packages/views/issues/components/quick-actions-section.tsx@@ -2,8 +2,7 @@import { useMemo, useState } from "react";import { useQuery } from "@tanstack/react-query";-import { Loader2, Plus, Zap } from "lucide-react";-import { IconButton } from "@multica/ui/components/common/icon-button";+import { Loader2, Zap } from "lucide-react";import { toast } from "sonner";import { dispatchReasonCode } from "@multica/core/api";import { useCurrentWorkspace } from "@multica/core/paths";@@ -22,9 +21,7 @@ import {import { Tooltip, TooltipContent, TooltipTrigger } from "@multica/ui/components/ui/tooltip";import { cn } from "@multica/ui/lib/utils";import { ActorAvatar } from "../../common/actor-avatar";-import { IssueSidebarSettingsMenu } from "./issue-sidebar-settings-menu";import { IssueSidebarSectionHeader } from "./issue-sidebar-section";-import { CreateQuickActionDialog } from "../../quick-actions/components/quick-action-dialog";import { useT } from "../../i18n";// Quick Actions sidebar section (MUL-5465).@@ -48,8 +45,6 @@ import { useT } from "../../i18n";export function QuickActionsSection({ issueId }: { issueId: string }) {const { t } = useT("issues");- const { t: tSettings } = useT("settings");- const [creating, setCreating] = useState(false);// Nullable read, not useWorkspaceId(): this section is an enhancement on the// sidebar and must degrade to "not rendered" outside a workspace route// rather than throwing and taking the whole issue detail down with it.@@ -64,20 +59,19 @@ export function QuickActionsSection({ issueId }: { issueId: string }) {});const actions = useMemo(() => data.filter((a) => a.status === "active"), [data]);- // Keep the creation entry available even before the first action exists.- if (!wsId || isLoading) return null;+ // Quick actions are a workspace-level catalog managed in Settings; the+ // sidebar only runs them. Nothing configured renders nothing at all — an+ // empty section header is pure noise. A failed load still renders so the+ // retry is reachable.+ if (!wsId || isLoading || (actions.length === 0 && !isError)) return null;const visible = showAll ? actions : actions.slice(0, QUICK_ACTION_SIDEBAR_LIMIT);const hiddenCount = actions.length - visible.length;return (<div>- <IssueSidebarSectionHeader title={t(($) => $.detail.section_quick_actions)} count={actions.length} collapsible={actions.length > 0 || isError === true} open={open} onOpenChange={setOpen}- actions={<>- <IconButton size="icon-xs" label={tSettings(($) => $.quick_actions.create_title)} onClick={() => setCreating(true)}><Plus /></IconButton>- <IssueSidebarSettingsMenu title={t(($) => $.detail.section_quick_actions)} label={t(($) => $.sidebar_settings.quick_actions)} tab="quick-actions" />- </>} />- {open && (actions.length > 0 || isError) ? (+ <IssueSidebarSectionHeader title={t(($) => $.detail.section_quick_actions)} count={actions.length} open={open} onOpenChange={setOpen} />+ {open ? (<div className="space-y-0.5 px-2">{isError && <button type="button" className="flex min-h-8 w-full items-center rounded-md px-2 py-1.5 text-left text-caption text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring" onClick={() => void refetch()}>{t(($) => $.detail.section_load_failed_retry)}@@ -102,8 +96,6 @@ export function QuickActionsSection({ issueId }: { issueId: string }) {</div>) : null}- {creating && <CreateQuickActionDialog onClose={() => setCreating(false)} />}-{/* One message for every refusal. The person reading this dialog and theperson who can fix the binding are different people — the clicker'snext step is the same either way, and the diagnostic detail lives indiff --git a/packages/views/issues/components/wakeups-section.test.tsx b/packages/views/issues/components/wakeups-section.test.tsxindex 2bf0e54b03..733738dde9 100644--- a/packages/views/issues/components/wakeups-section.test.tsx+++ b/packages/views/issues/components/wakeups-section.test.tsx@@ -100,14 +100,10 @@ beforeEach(() => {};});describe("Wakeups sidebar", () => {- it("opens workspace defaults from the folded section", async () => {+ it("keeps the header to the add action without a settings-only menu", () => {renderWithI18n(<WakeupsSection issueId="issue" />);- const disclosure = screen.getByRole("button", { name: "Wakeups 1" });- fireEvent.click(disclosure);- fireEvent.click(screen.getByRole("button", { name: "Wakeups options" }));- expect(disclosure).toHaveAttribute("aria-expanded", "false");- fireEvent.click(await screen.findByRole("menuitem", { name: "Wakeup settings" }));- expect(settingsPush).toHaveBeenCalledWith("/acme/settings?tab=wakeups");+ expect(screen.getByRole("button", { name: "Wakeups 1" })).toBeVisible();+ expect(screen.queryByRole("button", { name: "Wakeups options" })).not.toBeInTheDocument();});it("shows an empty static title with creation available", () => {empty = true;diff --git a/packages/views/issues/components/wakeups-section.tsx b/packages/views/issues/components/wakeups-section.tsxindex e37ae4f820..b17619ebab 100644--- a/packages/views/issues/components/wakeups-section.tsx+++ b/packages/views/issues/components/wakeups-section.tsx@@ -1,6 +1,5 @@"use client";-import { IssueSidebarSettingsMenu } from "./issue-sidebar-settings-menu";import { IssueSidebarSectionHeader } from "./issue-sidebar-section";import { useState } from "react";@@ -429,10 +428,7 @@ export function WakeupsSection({title={t(($) => $.wakeups.title)} open={open} onOpenChange={setOpen}count={current.length + (!closed ? systemRules.length : 0)}collapsible={hasContent}- actions={<>- {!closed && <WakeupCreate workspaceId={workspaceId} issueId={issueId} defaultAgentId={defaultAgentId} />}- <IssueSidebarSettingsMenu title={t(($) => $.wakeups.title)} label={t(($) => $.sidebar_settings.wakeups)} tab="wakeups" />- </>}+ actions={!closed ? <WakeupCreate workspaceId={workspaceId} issueId={issueId} defaultAgentId={defaultAgentId} /> : undefined}/>{open && hasContent && (<div className="px-2">diff --git a/packages/views/locales/en/issues.json b/packages/views/locales/en/issues.jsonindex 328c483cf4..b11a1ea23f 100644--- a/packages/views/locales/en/issues.json+++ b/packages/views/locales/en/issues.json@@ -1,11 +1,4 @@{- "sidebar_settings": {- "menu": "{{section}} options",- "quick_actions": "Quick action settings",- "wakeups": "Wakeup settings",- "properties": "Custom property settings",- "plugins": "Plugin settings"- },"inline_run": {"label": "{{name}} run","stop": "Stop",diff --git a/packages/views/locales/fr/issues.json b/packages/views/locales/fr/issues.jsonindex 37377cc8e5..2a196dc8a6 100644--- a/packages/views/locales/fr/issues.json+++ b/packages/views/locales/fr/issues.json@@ -1,11 +1,4 @@{- "sidebar_settings": {- "menu": "Options : {{section}}",- "quick_actions": "Paramètres des actions rapides",- "wakeups": "Paramètres de réveil",- "properties": "Paramètres des propriétés personnalisées",- "plugins": "Paramètres des plugins"- },"inline_run": {"label": "Exécution de {{name}}","stop": "Arrêter",diff --git a/packages/views/locales/ja/issues.json b/packages/views/locales/ja/issues.jsonindex 1dadbb6bf8..5e00acf803 100644--- a/packages/views/locales/ja/issues.json+++ b/packages/views/locales/ja/issues.json@@ -1,11 +1,4 @@{- "sidebar_settings": {- "menu": "{{section}}のオプション",- "quick_actions": "クイックアクション設定",- "wakeups": "自動起動設定",- "properties": "カスタムプロパティ設定",- "plugins": "プラグイン設定"- },"inline_run": {"label": "{{name}} の実行","stop": "停止",diff --git a/packages/views/locales/ko/issues.json b/packages/views/locales/ko/issues.jsonindex 17abd5ccfa..627367ed55 100644--- a/packages/views/locales/ko/issues.json+++ b/packages/views/locales/ko/issues.json@@ -1,11 +1,4 @@{- "sidebar_settings": {- "menu": "{{section}} 옵션",- "quick_actions": "빠른 작업 설정",- "wakeups": "깨우기 설정",- "properties": "사용자 지정 속성 설정",- "plugins": "플러그인 설정"- },"inline_run": {"label": "{{name}} 실행","stop": "중지",diff --git a/packages/views/locales/zh-Hans/issues.json b/packages/views/locales/zh-Hans/issues.jsonindex b57904b946..7800b26d8e 100644--- a/packages/views/locales/zh-Hans/issues.json+++ b/packages/views/locales/zh-Hans/issues.json@@ -1,11 +1,4 @@{- "sidebar_settings": {- "menu": "{{section}}选项",- "quick_actions": "快捷操作设置",- "wakeups": "唤醒设置",- "properties": "自定义属性设置",- "plugins": "插件设置"- },"inline_run": {"label": "{{name}} 的运行","stop": "停止",diff --git a/packages/views/locales/zh-Hant/issues.json b/packages/views/locales/zh-Hant/issues.jsonindex 9e2775f6ab..28ef3c374a 100644--- a/packages/views/locales/zh-Hant/issues.json+++ b/packages/views/locales/zh-Hant/issues.json@@ -1,11 +1,4 @@{- "sidebar_settings": {- "menu": "{{section}}選項",- "quick_actions": "快捷操作設定",- "wakeups": "喚醒設定",- "properties": "自訂屬性設定",- "plugins": "外掛設定"- },"inline_run": {"label": "{{name}} 的執行","stop": "停止",diff --git a/packages/views/plugins/plugin-panel-section.test.tsx b/packages/views/plugins/plugin-panel-section.test.tsxindex 6f8a0cb7ab..ae59254e3a 100644--- a/packages/views/plugins/plugin-panel-section.test.tsx+++ b/packages/views/plugins/plugin-panel-section.test.tsx@@ -94,17 +94,11 @@ describe("PluginPanelSection", () => {expect(srcdoc).not.toContain('child.setAttribute("sandbox", "allow-scripts allow-same-origin")');});- it("opens plugin management without unfolding or replacing the panel", async () => {+ it("keeps the section header free of settings-only menus", () => {data.installed.plugins = [installation()];render(<PluginPanelSection issueId="issue-1" />, { wrapper: Wrapper });- const frame = screen.getByTitle("Hello Panel — Hello");- const disclosure = screen.getByRole("button", { name: "Plugins 1" });- fireEvent.click(disclosure);- fireEvent.click(screen.getByRole("button", { name: "Plugins options" }));- expect(disclosure).toHaveAttribute("aria-expanded", "false");- fireEvent.click(await screen.findByRole("menuitem", { name: "Plugin settings" }));- expect(settingsPush).toHaveBeenCalledWith("/acme/settings?tab=plugins");- expect(screen.getByTitle("Hello Panel — Hello")).toBe(frame);+ expect(screen.getByRole("button", { name: "Plugins 1" })).toBeVisible();+ expect(screen.queryByRole("button", { name: "Plugins options" })).not.toBeInTheDocument();});it("preserves the mounted plugin frame across disclosure changes", () => {diff --git a/packages/views/plugins/plugin-panel-section.tsx b/packages/views/plugins/plugin-panel-section.tsxindex 700202bf96..455dcabf8b 100644--- a/packages/views/plugins/plugin-panel-section.tsx+++ b/packages/views/plugins/plugin-panel-section.tsx@@ -8,7 +8,6 @@ import { useFeatureEnabled } from "@multica/core/config";import { PLUGINS_V1_FLAG } from "@multica/core/feature-flags";import { useT } from "../i18n";import { isDesktopShell } from "../platform/local-directory";-import { IssueSidebarSettingsMenu } from "../issues/components/issue-sidebar-settings-menu";import { IssueSidebarSectionHeader } from "../issues/components/issue-sidebar-section";import { PluginSurfaceFrame } from "./plugin-surface-frame";@@ -48,8 +47,7 @@ export function PluginPanelSection({ issueId }: { issueId: string }) {return (<section>- <IssueSidebarSectionHeader title={t(($) => $.plugins.panels)} open={open} onOpenChange={setOpen} count={panels.length}- actions={<IssueSidebarSettingsMenu title={t(($) => $.plugins.panels)} label={t(($) => $.sidebar_settings.plugins)} tab="plugins" />} />+ <IssueSidebarSectionHeader title={t(($) => $.plugins.panels)} open={open} onOpenChange={setOpen} count={panels.length} /><div hidden={!open} className="space-y-2 px-2">{panels.map(({ installation, surface }) => (<PluginSurfaceFrame