Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(views): richer issue mention hover card + shift+click peek (MUL-8071) (#9323)
Jiayuan Zhang050f8b946ecb
diff --git a/packages/views/inbox/components/inbox-page.tsx b/packages/views/inbox/components/inbox-page.tsxindex 0569274c2b..e02e72b387 100644--- a/packages/views/inbox/components/inbox-page.tsx+++ b/packages/views/inbox/components/inbox-page.tsx@@ -51,6 +51,7 @@ import {} from "@multica/core/inbox/filter-store";import { IssueDetail, issueHighlightMementoKey } from "../../issues/components/issue-detail";+import { IssuePeekHost } from "../../issues/components/issue-peek";import { useViewStateWriter } from "../../platform";import { ErrorBoundary } from "@multica/ui/components/common/error-boundary";import { useNavigation, useReportNavigating } from "../../navigation";@@ -688,27 +689,30 @@ export function InboxPage() {</div>) : undefined}>- <IssueDetail- key={detailItem.issue_id}- issueId={detailItem.issue_id}- defaultSidebarOpen={false}- layoutId="multica_inbox_issue_detail_layout"- highlightCommentId={detailItem.details?.comment_id ?? undefined}- highlightRequestToken={highlightRequestToken}- // The split layout already has a nav trigger in the list header.- // Explicit false suppresses the detail header's fallback trigger.- leadingAction={compactBackAction ?? false}- onDelete={() => {- // Issue deletion CASCADE-deletes the inbox item server-side, and the- // issue:deleted WS event prunes it from the inbox cache. Just clear- // the selection — calling archive here would 404 on a row that no- // longer exists.- setSelectedKey("");- }}- onDone={() => {- handleArchive(detailItem.id);- }}- />+ {/* Shift+Click on an issue mention peeks it over the detail pane. */}+ <IssuePeekHost key={detailItem.issue_id}>+ <IssueDetail+ key={detailItem.issue_id}+ issueId={detailItem.issue_id}+ defaultSidebarOpen={false}+ layoutId="multica_inbox_issue_detail_layout"+ highlightCommentId={detailItem.details?.comment_id ?? undefined}+ highlightRequestToken={highlightRequestToken}+ // The split layout already has a nav trigger in the list header.+ // Explicit false suppresses the detail header's fallback trigger.+ leadingAction={compactBackAction ?? false}+ onDelete={() => {+ // Issue deletion CASCADE-deletes the inbox item server-side, and the+ // issue:deleted WS event prunes it from the inbox cache. Just clear+ // the selection — calling archive here would 404 on a row that no+ // longer exists.+ setSelectedKey("");+ }}+ onDone={() => {+ handleArchive(detailItem.id);+ }}+ />+ </IssuePeekHost></ErrorBoundary>) : detailItem ? (<div className="p-6">diff --git a/packages/views/issues/components/issue-detail-route.tsx b/packages/views/issues/components/issue-detail-route.tsxindex a275dbb78d..39bbd5a3d2 100644--- a/packages/views/issues/components/issue-detail-route.tsx+++ b/packages/views/issues/components/issue-detail-route.tsx@@ -6,6 +6,7 @@ import { useWorkspaceId } from "@multica/core/hooks";import { useWorkspacePaths } from "@multica/core/paths";import { useNavigation } from "../../navigation";import { IssueDetail, IssueDetailSkeleton, IssueNotFound } from "./issue-detail";+import { IssuePeekHost } from "./issue-peek";interface IssueDetailRouteProps {/**@@ -89,11 +90,16 @@ export function IssueDetailRoute({ routeId, onDelete }: IssueDetailRouteProps) {// unbounded request loop that never settles. See `CanonicalIssue.notFound`.if (notFound || !canonicalId) return <IssueNotFound showBackLink={!onDelete} />;+ // The page hosts a side peek so Shift+Click on an issue mention in the+ // description or comments opens it floating over the page. Keyed so moving+ // to another issue closes the peek.return (- <IssueDetail- issueId={canonicalId}- onDelete={onDelete}- highlightCommentId={highlight.commentId}- />+ <IssuePeekHost key={canonicalId}>+ <IssueDetail+ issueId={canonicalId}+ onDelete={onDelete}+ highlightCommentId={highlight.commentId}+ />+ </IssuePeekHost>);}diff --git a/packages/views/issues/components/issue-hover-card.test.tsx b/packages/views/issues/components/issue-hover-card.test.tsxindex 606637a383..10e95d02fd 100644--- a/packages/views/issues/components/issue-hover-card.test.tsx+++ b/packages/views/issues/components/issue-hover-card.test.tsx@@ -1,4 +1,4 @@-import { screen } from "@testing-library/react";+import { screen, within } from "@testing-library/react";import userEvent from "@testing-library/user-event";import { describe, expect, it, vi, beforeEach } from "vitest";import { useQuery } from "@tanstack/react-query";@@ -39,6 +39,31 @@ vi.mock("@multica/core/issues/queries", () => ({}),}));+vi.mock("@multica/core/agents", () => ({+ agentTaskSnapshotOptions: (workspaceId: string) => ({+ queryKey: ["agent-tasks", workspaceId],+ }),+}));++vi.mock("@multica/core/projects", () => ({+ projectListOptions: (workspaceId: string) => ({+ queryKey: ["projects", workspaceId],+ }),+}));++vi.mock("@multica/core/github", () => ({+ issuePullRequestsOptions: (issueId: string) => ({+ queryKey: ["pull-requests", issueId],+ }),+}));++// The PR summary's verdict logic is owned and tested by pull-request-list.+vi.mock("./pull-request-list", () => ({+ PullRequestInlineSummary: ({ pr }: { pr: { number: number } }) => (+ <span data-testid="pr-summary">#{pr.number}</span>+ ),+}));+// The real ActorAvatar pulls in navigation, presence, and four profile cards.// The card only needs to know it rendered for the right actor.vi.mock("../../common/actor-avatar", () => ({@@ -63,13 +88,15 @@ vi.mock("../../common/actor-avatar", () => ({),}));-// A spy, not a stub: `useActorName` subscribes to the workspace member list,-// so "was this hook mounted at all" is the assertion that keeps the assignee-// row from being inlined back into the card body.-const mockUseActorName = vi.hoisted(() => vi.fn(() => ({ getActorName: () => "zain" })));+const ACTOR_NAMES: Record<string, string> = {+ "user-9": "zain",+ "agent-triage": "GitHub Triage",+};vi.mock("@multica/core/workspace/hooks", () => ({- useActorName: mockUseActorName,+ useActorName: () => ({+ getActorName: (_type: string, id: string) => ACTOR_NAMES[id] ?? id,+ }),}));vi.mock("./status-icon", () => ({@@ -99,6 +126,8 @@ vi.mock("./priority-icon", () => ({const mockUseQuery = vi.mocked(useQuery);+type Label = { id: string; name: string; color: string };+type Issue = {id: string;identifier: string;@@ -109,14 +138,35 @@ type Issue = {description?: string | null;assignee_type?: string | null;assignee_id?: string | null;+ creator_type: string;+ creator_id: string;+ parent_issue_id?: string | null;+ project_id?: string | null;+ due_date?: string | null;+ labels?: Label[];+ created_at: string;+ updated_at: string;};+const NOW = Date.now();+const minutesAgo = (m: number) => new Date(NOW - m * 60_000).toISOString();+const BASE_ISSUE: Issue = {id: "issue-1",identifier: "MUL-3405",title: "A very long issue title that the inline chip never shows",status: "todo",priority: "none",+ creator_type: "agent",+ creator_id: "agent-triage",+ created_at: minutesAgo(3 * 24 * 60),+ updated_at: minutesAgo(14),+};++const PARENT_ISSUE = {+ id: "parent-1",+ identifier: "MUL-3400",+ title: "Weekly GitHub triage",};const NOT_FOUND_TEXT = "This issue does not exist or has been deleted in this workspace.";@@ -127,40 +177,54 @@ type DetailState =| { phase: "error" }| { phase: "success"; issue: Issue | undefined };+interface Fixtures {+ progress?: Map<string, { done: number; total: number }>;+ tasks?: { issue_id: string; agent_id: string; status: string }[];+ projects?: { id: string; title: string }[];+ pullRequests?: { id: string; number: number; state: string }[];+}++const settled = (data: unknown) =>+ ({ data, isPending: false, isError: false }) as unknown as ReturnType<typeof useQuery>;+/**- * Routes each query the card body makes to its own fixture, keyed by the first- * segment of the query key the mocked options factories produce. The detail- * fixture carries `isPending`/`isError` explicitly because the body branches on- * them, not on `data` alone.+ * Routes each query the card makes to its own fixture, keyed by the first+ * segment of the query key the mocked options factories produce. A disabled+ * query reports no data, and a `select` is applied the way react-query would.+ * The detail fixture carries `isPending`/`isError` explicitly because the body+ * branches on them, not on `data` alone.*/-function mockQueries(- detail: DetailState,- progress?: Map<string, { done: number; total: number }>,-): void {+function mockQueries(detail: DetailState, fixtures: Fixtures = {}): void {mockUseQuery.mockImplementation((options: unknown) => {- const [key] = (options as { queryKey: string[] }).queryKey;- if (key === "issue") {+ const { queryKey, enabled, select } = options as {+ queryKey: string[];+ enabled?: boolean;+ select?: (data: unknown) => unknown;+ };+ if (enabled === false) return settled(undefined);+ const [key, id] = queryKey;+ const raw = (data: unknown) => settled(select ? select(data) : data);+ if (key === "issue" && id === "issue-1") {return {data: detail.phase === "success" ? detail.issue : undefined,isPending: detail.phase === "pending",isError: detail.phase === "error",} as unknown as ReturnType<typeof useQuery>;}- if (key === "child-progress") {- return { data: progress, isPending: false, isError: false } as unknown as ReturnType<- typeof useQuery- >;+ if (key === "issue" && id === PARENT_ISSUE.id) return settled(PARENT_ISSUE);+ if (key === "child-progress") return settled(fixtures.progress);+ if (key === "agent-tasks") return raw(fixtures.tasks ?? []);+ if (key === "projects") return raw(fixtures.projects ?? []);+ if (key === "pull-requests") {+ return raw({ pull_requests: fixtures.pullRequests ?? [] });}throw new Error(`Unexpected query key: ${String(key)}`);});}/** Shorthand for the common case: the detail query settled with an issue. */-function mockIssue(- issue: Issue,- progress?: Map<string, { done: number; total: number }>,-): void {- mockQueries({ phase: "success", issue }, progress);+function mockIssue(issue: Issue, fixtures?: Fixtures): void {+ mockQueries({ phase: "success", issue }, fixtures);}function renderCard(fallbackLabel?: string): void {@@ -192,10 +256,15 @@ function paragraphCount(): number {return title.parentElement?.querySelectorAll("p").length ?? 0;}+/** The value cell of a property row, found by its term. */+function propertyValue(term: string): HTMLElement {+ const dt = screen.getByText(term, { selector: "dt" });+ return dt.nextElementSibling as HTMLElement;+}+describe("IssueHoverCard", () => {beforeEach(() => {mockUseQuery.mockReset();- mockUseActorName.mockClear();mockIssue(BASE_ISSUE);});@@ -221,33 +290,16 @@ describe("IssueHoverCard", () => {expect(mockUseQuery).toHaveBeenCalled();});- it("shows the priority glyph ahead of the status icon", async () => {- mockIssue({ ...BASE_ISSUE, priority: "high" });-- await openCard();-- const priority = screen.getByTestId("priority-icon");- expect(priority).toHaveAttribute("data-priority", "high");- // Ordering: priority leads the header, the status icon follows it. Both- // glyphs sit inside their own naming wrapper, so compare the wrappers.- expect(priority.parentElement?.nextElementSibling).toContainElement(- screen.getByTestId("status-icon"),- );- });-- it("names the status and priority glyphs for assistive tech", async () => {+ it("names the status and the priority in text, not only as glyphs", async () => {mockIssue({ ...BASE_ISSUE, status: "in_progress", priority: "high" });await openCard();- // Localized names from the shipped issues namespace — no key of this- // card's own. Removing either aria-label drops the element from the query.- expect(screen.getByLabelText("In Progress")).toContainElement(- screen.getByTestId("status-icon"),- );- expect(screen.getByLabelText("High")).toContainElement(- screen.getByTestId("priority-icon"),- );+ // Localized names from the shipped issues namespace.+ expect(screen.getByText("In Progress")).toBeInTheDocument();+ const priority = screen.getByText("High");+ expect(priority).toContainElement(screen.getByTestId("priority-icon"));+ expect(screen.getByTestId("priority-icon")).toHaveAttribute("data-priority", "high");});it("paints a custom status with its catalog color", async () => {@@ -269,7 +321,7 @@ describe("IssueHoverCard", () => {);});- it("omits the priority glyph when the issue has no priority", async () => {+ it("omits the priority when the issue has no priority", async () => {mockIssue({ ...BASE_ISSUE, priority: "none" });await openCard();@@ -283,48 +335,194 @@ describe("IssueHoverCard", () => {await openCard();- const avatar = screen.getByTestId("actor-avatar");+ const assignee = propertyValue("Assignee");+ const avatar = within(assignee).getByTestId("actor-avatar");expect(avatar).toHaveAttribute("data-actor-type", "member");expect(avatar).toHaveAttribute("data-actor-id", "user-9");expect(avatar).toHaveAttribute("data-hover-card", "false");expect(avatar).toHaveAttribute("data-profile-link", "false");- expect(screen.getByText("zain")).toBeInTheDocument();- expect(mockUseActorName).toHaveBeenCalled();+ expect(within(assignee).getByText("zain")).toBeInTheDocument();});- it("omits the assignee when the issue is unassigned", async () => {+ it("says Unassigned rather than dropping the assignee row", async () => {mockIssue({ ...BASE_ISSUE, assignee_type: null, assignee_id: null });await openCard();- expect(screen.queryByTestId("actor-avatar")).not.toBeInTheDocument();- expect(screen.queryByText("zain")).not.toBeInTheDocument();- // The member directory stays unfetched: the row that reads it never mounts.- expect(mockUseActorName).not.toHaveBeenCalled();+ const assignee = propertyValue("Assignee");+ expect(within(assignee).getByText("Unassigned")).toBeInTheDocument();+ expect(within(assignee).queryByTestId("actor-avatar")).not.toBeInTheDocument();+ });++ it("marks the assignee as working while an agent runs on the issue", async () => {+ mockIssue(+ { ...BASE_ISSUE, assignee_type: "agent", assignee_id: "agent-triage" },+ {+ tasks: [+ { issue_id: "issue-1", agent_id: "agent-triage", status: "running" },+ { issue_id: "other-issue", agent_id: "agent-x", status: "queued" },+ ],+ },+ );++ await openCard();++ // ShimmerText renders an aria-hidden copy of its label for the highlight,+ // so match the cell's text rather than a single element.+ expect(propertyValue("Assignee")).toHaveTextContent("Working");+ });++ it("shows no activity when only other issues have agent tasks", async () => {+ mockIssue(+ { ...BASE_ISSUE, assignee_type: "agent", assignee_id: "agent-triage" },+ { tasks: [{ issue_id: "other-issue", agent_id: "agent-x", status: "running" }] },+ );++ await openCard();++ expect(screen.queryByText("Working")).not.toBeInTheDocument();+ expect(screen.queryByText("Queued")).not.toBeInTheDocument();+ });++ it("marks the assignee as queued while only its own run waits", async () => {+ mockIssue(+ { ...BASE_ISSUE, assignee_type: "agent", assignee_id: "agent-triage" },+ {+ tasks: [+ { issue_id: "issue-1", agent_id: "agent-triage", status: "queued" },+ { issue_id: "issue-1", agent_id: "agent-reviewer", status: "running" },+ ],+ },+ );++ await openCard();++ expect(propertyValue("Assignee")).toHaveTextContent("Queued");+ expect(propertyValue("Assignee")).not.toHaveTextContent("Working");+ });++ it("does not credit another agent's run on the issue to the assignee", async () => {+ mockIssue(+ { ...BASE_ISSUE, assignee_type: "agent", assignee_id: "agent-triage" },+ { tasks: [{ issue_id: "issue-1", agent_id: "agent-reviewer", status: "running" }] },+ );++ await openCard();++ expect(screen.queryByText("Working")).not.toBeInTheDocument();+ expect(screen.queryByText("Queued")).not.toBeInTheDocument();+ });++ it("never marks a member assignee with agent activity", async () => {+ mockIssue(+ { ...BASE_ISSUE, assignee_type: "member", assignee_id: "user-9" },+ { tasks: [{ issue_id: "issue-1", agent_id: "user-9", status: "queued" }] },+ );++ await openCard();++ expect(screen.queryByText("Working")).not.toBeInTheDocument();+ expect(screen.queryByText("Queued")).not.toBeInTheDocument();+ });++ it("names who created the issue and when it last moved", async () => {+ await openCard();++ const creator = screen+ .getAllByTestId("actor-avatar")+ .find((el) => el.getAttribute("data-actor-id") === "agent-triage");+ expect(creator).toHaveAttribute("data-hover-card", "false");+ expect(screen.getByText("GitHub Triage")).toBeInTheDocument();+ expect(screen.getByText("created 3d ago · updated 14m ago")).toBeInTheDocument();+ });++ it("shows the project and parent issue when the issue has them", async () => {+ mockIssue(+ { ...BASE_ISSUE, project_id: "project-1", parent_issue_id: PARENT_ISSUE.id },+ { projects: [{ id: "project-1", title: "Runtimes" }] },+ );++ await openCard();++ expect(within(propertyValue("Project")).getByText("Runtimes")).toBeInTheDocument();+ const parent = propertyValue("Parent issue");+ expect(within(parent).getByText("MUL-3400")).toBeInTheDocument();+ expect(within(parent).getByText("Weekly GitHub triage")).toBeInTheDocument();+ });++ it("does not query projects or a parent for an issue that has neither", async () => {+ await openCard();++ expect(screen.queryByText("Project", { selector: "dt" })).not.toBeInTheDocument();+ expect(screen.queryByText("Parent issue", { selector: "dt" })).not.toBeInTheDocument();+ const projectQuery = mockUseQuery.mock.calls.find(+ ([options]) => (options as { queryKey: string[] }).queryKey[0] === "projects",+ );+ expect((projectQuery?.[0] as { enabled?: boolean }).enabled).toBe(false);+ });++ it("caps the labels and counts the rest", async () => {+ mockIssue({+ ...BASE_ISSUE,+ labels: ["bug", "runtime", "desktop", "p1"].map((name, i) => ({+ id: `label-${i}`,+ name,+ color: "#ef4444",+ })),+ });++ await openCard();++ const labels = propertyValue("Labels");+ expect(within(labels).getByText("bug")).toBeInTheDocument();+ expect(within(labels).getByText("desktop")).toBeInTheDocument();+ expect(within(labels).queryByText("p1")).not.toBeInTheDocument();+ expect(within(labels).getByText("+1")).toBeInTheDocument();+ });++ it("leads with an open pull request and counts the rest", async () => {+ mockIssue(BASE_ISSUE, {+ pullRequests: [+ { id: "pr-1", number: 7600, state: "merged" },+ { id: "pr-2", number: 7612, state: "open" },+ ],+ });++ await openCard();++ const prs = propertyValue("Pull requests");+ expect(within(prs).getByTestId("pr-summary")).toHaveTextContent("#7612");+ expect(within(prs).getByText("+1")).toBeInTheDocument();+ });++ it("omits the pull request row when none are linked", async () => {+ await openCard();++ expect(screen.queryByText("Pull requests", { selector: "dt" })).not.toBeInTheDocument();});it("shows sub-issue progress when the workspace map has an entry", async () => {- mockIssue(BASE_ISSUE, new Map([["issue-1", { done: 2, total: 5 }]]));+ mockIssue(BASE_ISSUE, { progress: new Map([["issue-1", { done: 2, total: 5 }]]) });await openCard();- expect(screen.getByText("2/5")).toBeInTheDocument();+ expect(within(propertyValue("Sub-issues")).getByText("2/5")).toBeInTheDocument();});it("omits progress when the issue has no children", async () => {- mockIssue(BASE_ISSUE, new Map([["other-issue", { done: 1, total: 3 }]]));+ mockIssue(BASE_ISSUE, { progress: new Map([["other-issue", { done: 1, total: 3 }]]) });await openCard();- expect(screen.queryByText(/\d+\/\d+/)).not.toBeInTheDocument();+ expect(screen.queryByText(/^\d+\/\d+$/)).not.toBeInTheDocument();});it("omits progress when the issue has an entry with no children counted", async () => {- mockIssue(BASE_ISSUE, new Map([["issue-1", { done: 0, total: 0 }]]));+ mockIssue(BASE_ISSUE, { progress: new Map([["issue-1", { done: 0, total: 0 }]]) });await openCard();- expect(screen.queryByText(/\d+\/\d+/)).not.toBeInTheDocument();+ expect(screen.queryByText(/^\d+\/\d+$/)).not.toBeInTheDocument();});it("shows a flattened description snippet clamped to two lines", async () => {diff --git a/packages/views/issues/components/issue-hover-card.tsx b/packages/views/issues/components/issue-hover-card.tsxindex 70a0005cca..c333acf9e5 100644--- a/packages/views/issues/components/issue-hover-card.tsx+++ b/packages/views/issues/components/issue-hover-card.tsx@@ -3,24 +3,46 @@import { issueStatusCategory } from "@multica/core/issues";import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";import { useStatusLabel } from "./../utils/status-label";-import type { ReactNode } from "react";+import { useCallback, type ReactNode } from "react";import { useQuery } from "@tanstack/react-query";+import {+ Box,+ CalendarDays,+ CornerLeftUp,+ GitPullRequest,+ ListTree,+ Tag,+ UserRound,+ type LucideIcon,+} from "lucide-react";import { childIssueProgressOptions, issueDetailOptions } from "@multica/core/issues/queries";+import { formatDateOnly, isPastDateOnly } from "@multica/core/issues/date";+import { agentTaskSnapshotOptions } from "@multica/core/agents";+import { issuePullRequestsOptions } from "@multica/core/github";+import { projectListOptions } from "@multica/core/projects";import { useWorkspaceId } from "@multica/core/hooks";import { useActorName } from "@multica/core/workspace/hooks";+import type { AgentTask, GitHubPullRequest, Issue } from "@multica/core/types";import {HoverCard,HoverCardTrigger,HoverCardContent,} from "@multica/ui/components/ui/hover-card";+import { ShimmerText } from "@multica/ui/components/common/shimmer-text";import { Skeleton } from "@multica/ui/components/ui/skeleton";-import { useT } from "../../i18n";+import { cn } from "@multica/ui/lib/utils";+import { useLocale, useT, useTimeAgo } from "../../i18n";import { ActorAvatar } from "../../common/actor-avatar";+import { LabelChip } from "../../labels/label-chip";+import { selectIssueTasks } from "../surface/activity";import { descriptionPreview } from "./description-preview";import { PriorityIcon } from "./priority-icon";import { ProgressRing } from "./progress-ring";+import { PullRequestInlineSummary } from "./pull-request-list";import { StatusIcon } from "./status-icon";+const MAX_LABELS = 3;+interface IssueHoverCardProps {issueId: string;children: ReactNode;@@ -43,17 +65,23 @@ interface IssueHoverCardProps {** The inline chip shows status, identifier, and as much title as fits inside* its `min(18rem, 100%)` cap — so a long title arrives truncated. The card- * carries what the chip cannot: the full untruncated title, priority, a- * description snippet, the assignee, and sub-issue progress. Issue mentions are- * the only kind with a hover preview — member and agent mentions render as a- * plain `.mention` span in rich-content.tsx. This lives here rather than in- * packages/ui because it reads workspace queries.+ * carries what the chip cannot: the full title, the status by name, priority,+ * a description snippet, a property list (assignee and live agent activity,+ * project, parent, labels, due date, sub-issue progress, linked PR), and who+ * created the issue. Issue mentions are the only kind with a hover preview —+ * member and agent mentions render as a plain `.mention` span in+ * rich-content.tsx. This lives here rather than in packages/ui because it+ * reads workspace queries.+ *+ * Assignee, status, and provenance render for every issue, so a freshly filed+ * issue with no description or properties still gets a card that says more+ * than the chip does.*- * Every query lives in IssueHoverCardBody rather than here on purpose: Base UI- * mounts the popup only while the card is open, so this component adds no- * request of its own until a card opens. Moving a query up into IssueHoverCard- * would fire one per mention on render. (The chip inside the trigger has its- * own unresolved-issue fetch; that is independent of this.)+ * Every query lives below IssueHoverCard on purpose: Base UI mounts the popup+ * only while the card is open, so this component adds no request of its own+ * until a card opens. Moving a query up into IssueHoverCard would fire one per+ * mention on render. (The chip inside the trigger has its own+ * unresolved-issue fetch; that is independent of this.)*/export function IssueHoverCard({issueId,@@ -68,48 +96,13 @@ export function IssueHoverCard({<HoverCardTrigger delay={delay} render={<span />}>{children}</HoverCardTrigger>- <HoverCardContent align="start" className="w-auto min-w-56 max-w-80">+ <HoverCardContent align="start" className="w-85 max-w-[calc(100vw-1rem)] p-3"><IssueHoverCardBody issueId={issueId} fallbackLabel={fallbackLabel} /></HoverCardContent></HoverCard>);}-/**- * Assignee row of the card.- *- * Its own component so `useActorName` — which subscribes to the workspace- * member list, a query nothing else on this path warms — mounts only for cards- * that actually have an assignee to name. Inlining it back into the body would- * make the first hover on any mention pull the member directory.- */-function IssueHoverCardAssignee({- actorType,- actorId,-}: {- actorType: string;- actorId: string;-}) {- const { getActorName } = useActorName();- return (- <span className="flex min-w-0 items-center gap-1.5">- {/* This is already a hover card, and the agent live-peek variant would- fire its own request — so no nested card, no link. */}- <ActorAvatar- actorType={actorType}- actorId={actorId}- size="sm"- enableHoverCard={false}- profileLink={false}- className="shrink-0"- />- <span className="min-w-0 truncate text-caption text-foreground">- {getActorName(actorType, actorId)}- </span>- </span>- );-}-function IssueHoverCardBody({issueId,fallbackLabel,@@ -118,12 +111,7 @@ function IssueHoverCardBody({fallbackLabel?: string;}) {const wsId = useWorkspaceId();- const { colorOf: statusColorOf, iconOf: statusIconOf } = useIssueStatuses(wsId);- const resolveStatusLabel = useStatusLabel(wsId);const detail = useQuery(issueDetailOptions(wsId, issueId));- // One workspace-wide progress snapshot shared with the issues list and issue- // detail, not a per-issue children fetch: opening a card reuses the cache.- const { data: childProgress } = useQuery(childIssueProgressOptions(wsId));const { t } = useT("issues");// A skeleton rather than localized loading text: only the pending phase gets@@ -131,10 +119,10 @@ function IssueHoverCardBody({if (detail.isPending) {return (<div data-testid="issue-hover-card-skeleton" className="flex flex-col gap-1.5">- <Skeleton className="h-3 w-20" />- <Skeleton className="h-4 w-48" />+ <Skeleton className="h-3 w-24" />+ <Skeleton className="h-4 w-56" /><Skeleton className="mt-1.5 h-3 w-44" />- <Skeleton className="mt-1.5 h-4 w-24" />+ <Skeleton className="mt-1.5 h-4 w-32" /></div>);}@@ -158,35 +146,99 @@ function IssueHoverCardBody({);}+ return <IssueHoverCardDetails issue={issue} />;+}++/** One `dt`/`dd` pair of the property list. */+function PropertyRow({+ icon: Icon,+ label,+ children,+}: {+ icon: LucideIcon;+ label: string;+ children: ReactNode;+}) {+ return (+ <>+ <dt className="flex items-center gap-1.5 whitespace-nowrap text-caption text-muted-foreground">+ <Icon className="size-3.5 shrink-0" aria-hidden="true" />+ {label}+ </dt>+ <dd className="flex min-h-5 min-w-0 items-center gap-1.5 text-caption text-foreground">+ {children}+ </dd>+ </>+ );+}++/**+ * The PR worth showing when there is room for one: the first still-open one,+ * since a merged or closed PR says less about where the issue stands.+ */+function leadPullRequest(prs: GitHubPullRequest[]): GitHubPullRequest | undefined {+ return prs.find((pr) => pr.state === "open" || pr.state === "draft") ?? prs[0];+}++/**+ * The loaded card. Split from IssueHoverCardBody so the queries keyed on the+ * issue's own fields (project, parent) mount only after the detail settles.+ */+function IssueHoverCardDetails({ issue }: { issue: Issue }) {+ const wsId = useWorkspaceId();+ const { t } = useT("issues");+ const locale = useLocale();+ const timeAgo = useTimeAgo();+ const { getActorName } = useActorName();+ const { colorOf: statusColorOf, iconOf: statusIconOf } = useIssueStatuses(wsId);+ const resolveStatusLabel = useStatusLabel(wsId);++ // One workspace-wide progress snapshot shared with the issues list and issue+ // detail, not a per-issue children fetch: opening a card reuses the cache.+ const { data: childProgress } = useQuery(childIssueProgressOptions(wsId));+ // The same workspace task snapshot the board's activity badge observes.+ const selectTasks = useCallback(+ (snapshot: AgentTask[]) => selectIssueTasks(snapshot, issue.id),+ [issue.id],+ );+ const { data: tasks } = useQuery({ ...agentTaskSnapshotOptions(wsId), select: selectTasks });+ const { data: projects } = useQuery({+ ...projectListOptions(wsId),+ enabled: !!issue.project_id,+ });+ const parentId = issue.parent_issue_id;+ const { data: parent } = useQuery({+ ...issueDetailOptions(wsId, parentId ?? ""),+ enabled: !!parentId,+ });+ const { data: pullRequests } = useQuery(issuePullRequestsOptions(issue.id));+const preview = issue.description ? descriptionPreview(issue.description) : "";- const assigneeType = issue.assignee_type;- const assigneeId = issue.assignee_id;- const hasAssignee = !!assigneeType && !!assigneeId;- const progress = childProgress?.get(issue.id);- const hasProgress = !!progress && progress.total > 0;// Board cards and list rows render the glyph into a fixed grid slot, so the// "none" dash holds a column there. This card has no column to hold, leaving// the dash a mark carrying no information in an already dense popup.const hasPriority = !!issue.priority && issue.priority !== "none";+ const hasAssignee = !!issue.assignee_type && !!issue.assignee_id;+ // The badge sits beside the assignee, so it only counts that agent's own+ // runs — another agent reviewing the issue is not the assignee working.+ const isAssigneeTask = (task: AgentTask) =>+ issue.assignee_type === "agent" && task.agent_id === issue.assignee_id;+ const isWorking = !!tasks?.running.some(isAssigneeTask);+ const isQueued = !isWorking && !!tasks?.queued.some(isAssigneeTask);+ const project = issue.project_id+ ? projects?.find((p) => p.id === issue.project_id)+ : undefined;+ const labels = issue.labels ?? [];+ const progress = childProgress?.get(issue.id);+ const hasProgress = !!progress && progress.total > 0;+ const prs = pullRequests?.pull_requests ?? [];+ const leadPr = leadPullRequest(prs);+ const isOverdue = !!issue.due_date && isPastDateOnly(issue.due_date);return (- <div className="flex flex-col gap-1.5">- {/* Priority, status, identifier — the same lead-with-priority order as- BoardCardContent, at the icon size the status glyph already uses.- StatusIcon and PriorityIcon both render a bare <svg> that forwards no- aria props, so each glyph is named by an `role="img"` wrapper: on a- role-less span an aria-label is dropped by assistive tech. */}- <div className="flex items-center gap-1.5">- {hasPriority && (- <span role="img" aria-label={t(($) => $.priority[issue.priority])} className="flex">- <PriorityIcon priority={issue.priority} />- </span>- )}- <span- role="img"- aria-label={resolveStatusLabel(issue.status)}- className="flex shrink-0"- >+ <div className="flex flex-col gap-2">+ <div className="flex items-center justify-between gap-3">+ <div className="flex min-w-0 items-center gap-1.5 text-caption"><StatusIconstatus={issue.status}category={issueStatusCategory(issue) ?? undefined}@@ -194,37 +246,129 @@ function IssueHoverCardBody({icon={statusIconOf(issue.status)}className="h-3.5 w-3.5 shrink-0"/>- </span>- <span className="text-caption font-medium text-muted-foreground">- {issue.identifier}- </span>+ <span className="shrink-0 font-medium text-muted-foreground">{issue.identifier}</span>+ <span aria-hidden="true" className="text-faint-foreground">·</span>+ <span className="truncate text-muted-foreground">{resolveStatusLabel(issue.status)}</span>+ </div>+ {hasPriority && (+ <span className="flex shrink-0 items-center gap-1 text-caption text-muted-foreground">+ <PriorityIcon priority={issue.priority} />+ {t(($) => $.priority[issue.priority])}+ </span>+ )}</div>+{/* The full title is the point of the card, so it never truncates — but- an unbroken token (a pasted URL) would blow past the max-w-80 cap+ an unbroken token (a pasted URL) would blow past the card widthwithout a break opportunity. */}- <p className="text-body text-foreground break-words">{issue.title}</p>+ <p className="text-body font-medium text-foreground break-words">{issue.title}</p>- {preview && (- <p className="mt-1 text-caption text-muted-foreground line-clamp-2">{preview}</p>- )}+ {preview && <p className="text-caption text-muted-foreground line-clamp-2">{preview}</p>}- {(hasAssignee || hasProgress) && (- <div className="mt-1 flex items-center justify-between gap-3">+ <dl className="-mx-3 grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-4 gap-y-1.5 border-t border-border px-3 pt-2.5">+ <PropertyRow icon={UserRound} label={t(($) => $.detail.prop_assignee)}>{hasAssignee ? (- <IssueHoverCardAssignee actorType={assigneeType} actorId={assigneeId} />+ <>+ {/* This is already a hover card, and the agent live-peek variant+ would fire its own request — so no nested card, no link. */}+ <ActorAvatar+ actorType={issue.assignee_type!}+ actorId={issue.assignee_id!}+ size="xs"+ enableHoverCard={false}+ profileLink={false}+ className="shrink-0"+ />+ <span className="min-w-0 truncate">+ {getActorName(issue.assignee_type!, issue.assignee_id!)}+ </span>+ {(isWorking || isQueued) && (+ <ShimmerText active={isWorking} className="shrink-0 text-caption text-muted-foreground">+ {isWorking+ ? t(($) => $.agent_activity.status_running)+ : t(($) => $.agent_activity.status_queued)}+ </ShimmerText>+ )}+ </>) : (- <span />+ <span className="text-muted-foreground">{t(($) => $.actions.unassigned)}</span>)}- {hasProgress && (- <span className="inline-flex shrink-0 items-center gap-1">- <ProgressRing done={progress.done} total={progress.total} size={12} />- <span className="text-caption font-medium tabular-nums text-muted-foreground">- {progress.done}/{progress.total}+ </PropertyRow>++ {project && (+ <PropertyRow icon={Box} label={t(($) => $.detail.prop_project)}>+ <span className="min-w-0 truncate">{project.title}</span>+ </PropertyRow>+ )}++ {parent && (+ <PropertyRow icon={CornerLeftUp} label={t(($) => $.detail.section_parent_issue)}>+ <span className="shrink-0 font-medium text-muted-foreground">{parent.identifier}</span>+ <span className="min-w-0 truncate">{parent.title}</span>+ </PropertyRow>+ )}++ {labels.length > 0 && (+ <PropertyRow icon={Tag} label={t(($) => $.detail.prop_labels)}>+ <span className="flex min-w-0 items-center gap-1 overflow-hidden">+ {labels.slice(0, MAX_LABELS).map((label) => (+ <LabelChip key={label.id} label={label} className="py-0 text-micro" />+ ))}+ </span>+ {labels.length > MAX_LABELS && (+ <span className="shrink-0 text-micro text-muted-foreground">+ +{labels.length - MAX_LABELS}</span>+ )}+ </PropertyRow>+ )}++ {issue.due_date && (+ <PropertyRow icon={CalendarDays} label={t(($) => $.detail.prop_due_date)}>+ <span className={cn(isOverdue && "text-destructive")}>+ {formatDateOnly(issue.due_date, { month: "short", day: "numeric" }, locale)}</span>- )}- </div>- )}+ </PropertyRow>+ )}++ {hasProgress && (+ <PropertyRow icon={ListTree} label={t(($) => $.detail.sub_issues_label)}>+ <ProgressRing done={progress.done} total={progress.total} size={12} />+ <span className="font-medium tabular-nums text-muted-foreground">+ {progress.done}/{progress.total}+ </span>+ </PropertyRow>+ )}++ {leadPr && (+ <PropertyRow icon={GitPullRequest} label={t(($) => $.detail.section_pull_requests)}>+ <PullRequestInlineSummary pr={leadPr} />+ {prs.length > 1 && (+ <span className="shrink-0 text-micro text-muted-foreground">+{prs.length - 1}</span>+ )}+ </PropertyRow>+ )}+ </dl>++ <div className="-mx-3 flex min-w-0 items-center gap-1.5 border-t border-border px-3 pt-2.5 text-caption text-muted-foreground">+ <ActorAvatar+ actorType={issue.creator_type}+ actorId={issue.creator_id}+ size="xs"+ enableHoverCard={false}+ profileLink={false}+ className="shrink-0"+ />+ <span className="min-w-0 truncate text-foreground">+ {getActorName(issue.creator_type, issue.creator_id)}+ </span>+ <span className="shrink-0 whitespace-nowrap">+ {t(($) => $.hover_card.created_updated, {+ created: timeAgo(issue.created_at),+ updated: timeAgo(issue.updated_at),+ })}+ </span>+ </div></div>);}diff --git a/packages/views/issues/components/issue-mention-card.test.tsx b/packages/views/issues/components/issue-mention-card.test.tsxindex c6db9ca3ec..19ec0db0f9 100644--- a/packages/views/issues/components/issue-mention-card.test.tsx+++ b/packages/views/issues/components/issue-mention-card.test.tsx@@ -9,6 +9,10 @@ import {CurrentIssueRenderContextProvider,type CurrentIssueRenderContextValue,} from "../current-issue-render-context";+import {+ IssuePeekActionsContext,+ type IssuePeekActions,+} from "../surface/peek-context";vi.mock("@multica/core/paths", () => ({useWorkspacePaths: () => ({@@ -48,24 +52,33 @@ function makeAdapter(};}+function makePeek(): IssuePeekActions {+ return { open: vi.fn(), toggle: vi.fn(), close: vi.fn(), publishColumns: vi.fn() };+}+function renderCard(adapter: NavigationAdapter,context?: CurrentIssueRenderContextValue,issueId = "issue-1",+ peek?: IssuePeekActions,) {- const card = (+ let card = (<IssueMentionCard issueId={issueId} fallbackLabel="MUL-7" />);+ if (context) {+ card = (+ <CurrentIssueRenderContextProvider value={context}>+ {card}+ </CurrentIssueRenderContextProvider>+ );+ }+ if (peek) {+ card = (+ <IssuePeekActionsContext.Provider value={peek}>{card}</IssuePeekActionsContext.Provider>+ );+ }return renderWithI18n(- <NavigationProvider value={adapter}>- {context ? (- <CurrentIssueRenderContextProvider value={context}>- {card}- </CurrentIssueRenderContextProvider>- ) : (- card- )}- </NavigationProvider>,+ <NavigationProvider value={adapter}>{card}</NavigationProvider>,);}@@ -152,4 +165,61 @@ describe("IssueMentionCard", () => {expect(screen.getByTestId("issue-chip")).toHaveAttribute("data-current", "false");});++ describe("inside a peek host", () => {+ it("shift-click opens the mentioned issue in the side peek instead of navigating", () => {+ const push = vi.fn();+ const openInNewTab = vi.fn();+ const peek = makePeek();+ renderCard(makeAdapter({ push, openInNewTab }), undefined, "issue-1", peek);++ const defaultNotPrevented = fireEvent.click(screen.getByTestId("issue-chip"), {+ shiftKey: true,+ });+ expect(defaultNotPrevented).toBe(false);+ expect(peek.toggle).toHaveBeenCalledWith("issue-1");+ expect(push).not.toHaveBeenCalled();+ expect(openInNewTab).not.toHaveBeenCalled();+ });++ it("keeps shift-mousedown from extending the text selection", () => {+ renderCard(makeAdapter(), undefined, "issue-1", makePeek());++ expect(+ fireEvent.mouseDown(screen.getByTestId("issue-chip"), { shiftKey: true }),+ ).toBe(false);+ expect(fireEvent.mouseDown(screen.getByTestId("issue-chip"))).toBe(true);+ });++ it("plain click still navigates to the issue page", () => {+ const push = vi.fn();+ const peek = makePeek();+ renderCard(makeAdapter({ push }), undefined, "issue-1", peek);++ fireEvent.click(screen.getByTestId("issue-chip"));+ expect(push).toHaveBeenCalledWith("/acme/issues/issue-1");+ expect(peek.toggle).not.toHaveBeenCalled();+ });++ it("cmd+shift-click still opens a tab, not the peek", () => {+ const openInNewTab = vi.fn();+ const peek = makePeek();+ renderCard(makeAdapter({ openInNewTab }), undefined, "issue-1", peek);++ fireEvent.click(screen.getByTestId("issue-chip"), { shiftKey: true, metaKey: true });+ expect(openInNewTab).toHaveBeenCalled();+ expect(peek.toggle).not.toHaveBeenCalled();+ });+ });++ it("shift-click outside a peek host keeps the browser's own handling (web)", () => {+ const push = vi.fn();+ renderCard(makeAdapter({ push }));++ const defaultNotPrevented = fireEvent.click(screen.getByTestId("issue-chip"), {+ shiftKey: true,+ });+ expect(defaultNotPrevented).toBe(true);+ expect(push).not.toHaveBeenCalled();+ });});diff --git a/packages/views/issues/components/issue-mention-card.tsx b/packages/views/issues/components/issue-mention-card.tsxindex d6be8b6bbe..e2432b7856 100644--- a/packages/views/issues/components/issue-mention-card.tsx+++ b/packages/views/issues/components/issue-mention-card.tsx@@ -6,6 +6,18 @@ import { IssueChip } from "./issue-chip";import { IssueHoverCard } from "./issue-hover-card";import { useT } from "../../i18n";import { useCurrentIssueRenderContext } from "../current-issue-render-context";+import { useIssuePeekActions } from "../surface/peek-context";++/** Shift+Click with the primary button and no other modifier. */+function isPeekClick(event: React.MouseEvent) {+ return (+ event.button === 0 &&+ event.shiftKey &&+ !event.metaKey &&+ !event.ctrlKey &&+ !event.altKey+ );+}interface IssueMentionCardProps {issueId: string;@@ -32,7 +44,10 @@ function CurrentIssueChipContent({ identifier }: { identifier: string }) {** AppLink owns the click semantics: plain click navigates in place, modifier* and middle clicks open tabs. There is deliberately no per-surface or- * per-preference override.+ * per-preference override. The one exception is Shift+Click inside a peek+ * host (an issue list surface, the issue page, the inbox detail): it opens+ * the mentioned issue in the floating side peek, the same gesture board cards+ * and list rows use. Outside a host, Shift+Click keeps AppLink's behavior.** Hovering opens IssueHoverCard, which shows the detail the chip has no room* for. No `delay` is passed, so it opens on Base UI's default dwell. The same@@ -42,6 +57,7 @@ function CurrentIssueChipContent({ identifier }: { identifier: string }) {export function IssueMentionCard({ issueId, fallbackLabel }: IssueMentionCardProps) {const p = useWorkspacePaths();const currentIssue = useCurrentIssueRenderContext();+ const peek = useIssuePeekActions();const currentIdentifier =currentIssue && issueId === currentIssue.id? currentIssue.identifier@@ -52,6 +68,23 @@ export function IssueMentionCard({ issueId, fallbackLabel }: IssueMentionCardProhref={p.issueDetail(issueId)}newTabTitle={fallbackLabel}className="issue-mention align-middle"+ onMouseDown={+ peek+ ? (event) => {+ // Keep the shift-click from extending the text selection.+ if (isPeekClick(event)) event.preventDefault();+ }+ : undefined+ }+ onClick={+ peek+ ? (event) => {+ if (!isPeekClick(event)) return;+ event.preventDefault();+ peek.toggle(issueId);+ }+ : undefined+ }><IssueChipissueId={issueId}diff --git a/packages/views/issues/components/pull-request-list.tsx b/packages/views/issues/components/pull-request-list.tsxindex 31033f89f0..8b9daa3cf1 100644--- a/packages/views/issues/components/pull-request-list.tsx+++ b/packages/views/issues/components/pull-request-list.tsx@@ -490,14 +490,46 @@ function PullRequestRow({);}-function VerdictPill({ pill, stale, title }: { pill: VerdictPillConfig; stale: boolean; title?: string }) {+/**+ * One PR on a single line — state icon, `#number`, verdict pill — for+ * surfaces with no room for PullRequestRow, such as the issue hover card.+ * Not a link: the hover card that hosts it is read-only.+ */+export function PullRequestInlineSummary({ pr }: { pr: GitHubPullRequest }) {+ const { t } = useT("issues");+ const cfg = STATE_ICON[pr.state] ?? { icon: GitPullRequest, className: "" };+ const StateIcon = cfg.icon;+ const pill = getVerdictPill(derivePullRequestVerdict(pr), t);+ const isTerminal = pr.state === "merged" || pr.state === "closed";+ const stale = !isTerminal && pr.snapshot_stale === true;+ return (+ <span className="flex min-w-0 items-center gap-1.5" title={pr.title}>+ <StateIcon className={cn("size-3.5 shrink-0", cfg.className)} />+ <span className="shrink-0 font-medium tabular-nums">{prLabel(pr)}</span>+ {pill ? <VerdictPill pill={pill} stale={stale} inline /> : null}+ </span>+ );+}++function VerdictPill({+ pill,+ stale,+ title,+ inline = false,+}: {+ pill: VerdictPillConfig;+ stale: boolean;+ title?: string;+ inline?: boolean;+}) {const Icon = pill.icon;return (<spandata-testid="pull-request-verdict"title={title ?? pill.title}className={cn(- "ml-auto inline-flex h-4.5 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-1.5 text-micro font-medium tabular-nums",+ inline ? null : "ml-auto",+ "inline-flex h-4.5 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-1.5 text-micro font-medium tabular-nums",TONE_CLASS[pill.tone],stale ? "opacity-60" : null,)}diff --git a/packages/views/locales/en/issues.json b/packages/views/locales/en/issues.jsonindex 6e6ee9538d..7ae6b301fc 100644--- a/packages/views/locales/en/issues.json+++ b/packages/views/locales/en/issues.json@@ -1748,5 +1748,8 @@}}}+ },+ "hover_card": {+ "created_updated": "created {{created}} · updated {{updated}}"}}diff --git a/packages/views/locales/fr/issues.json b/packages/views/locales/fr/issues.jsonindex d9509196f0..0c9567879e 100644--- a/packages/views/locales/fr/issues.json+++ b/packages/views/locales/fr/issues.json@@ -1748,5 +1748,8 @@}}}+ },+ "hover_card": {+ "created_updated": "a créé {{created}} · mis à jour {{updated}}"}}diff --git a/packages/views/locales/ja/issues.json b/packages/views/locales/ja/issues.jsonindex 6245ce4e46..ae345273ad 100644--- a/packages/views/locales/ja/issues.json+++ b/packages/views/locales/ja/issues.json@@ -1683,5 +1683,8 @@}}}+ },+ "hover_card": {+ "created_updated": "{{created}}に作成 · {{updated}}に更新"}}diff --git a/packages/views/locales/ko/issues.json b/packages/views/locales/ko/issues.jsonindex afec7a7437..c69b496c07 100644--- a/packages/views/locales/ko/issues.json+++ b/packages/views/locales/ko/issues.json@@ -1683,5 +1683,8 @@}}}+ },+ "hover_card": {+ "created_updated": "{{created}} 생성 · {{updated}} 수정됨"}}diff --git a/packages/views/locales/zh-Hans/issues.json b/packages/views/locales/zh-Hans/issues.jsonindex d813d0d511..1598cee72d 100644--- a/packages/views/locales/zh-Hans/issues.json+++ b/packages/views/locales/zh-Hans/issues.json@@ -1683,5 +1683,8 @@}}}+ },+ "hover_card": {+ "created_updated": "创建于 {{created}} · 更新于 {{updated}}"}}