Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

MUL-8377: feat(workflows): one-line project usage and named handoffs in the workflow list (#9689)

Jiayuan Zhanga802ce2c6fad
diff --git a/packages/views/locales/en/issues.json b/packages/views/locales/en/issues.json
index 85de9f20c0..dce19d4578 100644
--- a/packages/views/locales/en/issues.json
+++ b/packages/views/locales/en/issues.json
@@ -1539,11 +1539,12 @@
"handoffs_one": "{{count}} handoff step",
"handoffs_other": "{{count}} handoff steps",
"no_handoffs": "No handoffs",
- "used_by_one": "Used by {{count}} project: {{names}}",
- "used_by_other": "Used by {{count}} projects: {{names}}",
- "used_by_default_one": "Used by {{count}} project: {{names}}, and issues without a project",
- "used_by_default_other": "Used by {{count}} projects: {{names}}, and issues without a project",
- "used_by_default_none": "Used by issues without a project",
+ "usage_default_one": "{{count}} project + no-project issues",
+ "usage_default_other": "{{count}} projects + no-project issues",
+ "usage_default_none": "Issues without a project",
+ "filter_projects": "Filter projects",
+ "no_matching_projects": "No matching projects",
+ "default_covers_no_project": "Also applies to issues without a project",
"new_blank": "Blank workflow",
"from_template": "From a template"
},
diff --git a/packages/views/locales/fr/issues.json b/packages/views/locales/fr/issues.json
index 9551e06e30..737729ca0e 100644
--- a/packages/views/locales/fr/issues.json
+++ b/packages/views/locales/fr/issues.json
@@ -1538,11 +1538,12 @@
"handoffs_one": "{{count}} étape de passage",
"handoffs_other": "{{count}} étapes de passage",
"no_handoffs": "Sans passage de relais",
- "used_by_one": "Utilisé par {{count}} projet : {{names}}",
- "used_by_other": "Utilisé par {{count}} projets : {{names}}",
- "used_by_default_one": "Utilisé par {{count}} projet : {{names}}, et les tâches sans projet",
- "used_by_default_other": "Utilisé par {{count}} projets : {{names}}, et les tâches sans projet",
- "used_by_default_none": "Utilisé par les tâches sans projet",
+ "usage_default_one": "{{count}} projet + tâches sans projet",
+ "usage_default_other": "{{count}} projets + tâches sans projet",
+ "usage_default_none": "Tâches sans projet",
+ "filter_projects": "Filtrer les projets",
+ "no_matching_projects": "Aucun projet correspondant",
+ "default_covers_no_project": "S'applique aussi aux tâches sans projet",
"new_blank": "Workflow vide",
"from_template": "À partir d’un modèle"
},
diff --git a/packages/views/locales/ja/issues.json b/packages/views/locales/ja/issues.json
index a304e77648..5c5f706f96 100644
--- a/packages/views/locales/ja/issues.json
+++ b/packages/views/locales/ja/issues.json
@@ -1485,9 +1485,11 @@
"statuses_other": "ステータス {{count}} 件",
"handoffs_other": "自動引き継ぎ {{count}} ステップ",
"no_handoffs": "自動引き継ぎなし",
- "used_by_other": "{{count}} 件のプロジェクトで使用中:{{names}}",
- "used_by_default_other": "{{count}} 件のプロジェクト({{names}})とプロジェクトのないタスクで使用中",
- "used_by_default_none": "プロジェクトのないタスクで使用中",
+ "usage_default_other": "{{count}} 件のプロジェクト + プロジェクトのないタスク",
+ "usage_default_none": "プロジェクトのないタスク",
+ "filter_projects": "プロジェクトを絞り込む",
+ "no_matching_projects": "一致するプロジェクトはありません",
+ "default_covers_no_project": "プロジェクトのないタスクにも適用されます",
"new_blank": "空のワークフロー",
"from_template": "テンプレートから"
},
diff --git a/packages/views/locales/ko/issues.json b/packages/views/locales/ko/issues.json
index fabe001e3c..be3a7b7e4f 100644
--- a/packages/views/locales/ko/issues.json
+++ b/packages/views/locales/ko/issues.json
@@ -1485,9 +1485,11 @@
"statuses_other": "상태 {{count}}개",
"handoffs_other": "자동 인계 {{count}}단계",
"no_handoffs": "자동 인계 없음",
- "used_by_other": "프로젝트 {{count}}개에서 사용 중: {{names}}",
- "used_by_default_other": "프로젝트 {{count}}개({{names}})와 프로젝트가 없는 태스크에서 사용 중",
- "used_by_default_none": "프로젝트가 없는 태스크에서 사용 중",
+ "usage_default_other": "프로젝트 {{count}}개 + 프로젝트가 없는 태스크",
+ "usage_default_none": "프로젝트가 없는 태스크",
+ "filter_projects": "프로젝트 필터",
+ "no_matching_projects": "일치하는 프로젝트가 없습니다",
+ "default_covers_no_project": "프로젝트가 없는 태스크에도 적용됩니다",
"new_blank": "빈 워크플로",
"from_template": "템플릿으로"
},
diff --git a/packages/views/locales/zh-Hans/issues.json b/packages/views/locales/zh-Hans/issues.json
index e91eadd777..d556654957 100644
--- a/packages/views/locales/zh-Hans/issues.json
+++ b/packages/views/locales/zh-Hans/issues.json
@@ -1485,9 +1485,11 @@
"statuses_other": "{{count}} 个状态",
"handoffs_other": "{{count}} 步自动交接",
"no_handoffs": "无自动交接",
- "used_by_other": "用于 {{count}} 个项目:{{names}}",
- "used_by_default_other": "用于 {{count}} 个项目:{{names}},以及没有项目的任务",
- "used_by_default_none": "用于没有项目的任务",
+ "usage_default_other": "{{count}} 个项目 + 没有项目的任务",
+ "usage_default_none": "没有项目的任务",
+ "filter_projects": "筛选项目",
+ "no_matching_projects": "没有匹配的项目",
+ "default_covers_no_project": "也适用于没有项目的任务",
"new_blank": "空白工作流",
"from_template": "从模板创建"
},
diff --git a/packages/views/locales/zh-Hant/issues.json b/packages/views/locales/zh-Hant/issues.json
index 51bd8ec801..bcfd21c185 100644
--- a/packages/views/locales/zh-Hant/issues.json
+++ b/packages/views/locales/zh-Hant/issues.json
@@ -1484,9 +1484,11 @@
"statuses_other": "{{count}} 個狀態",
"handoffs_other": "{{count}} 步自動交接",
"no_handoffs": "無自動交接",
- "used_by_other": "用於 {{count}} 個專案:{{names}}",
- "used_by_default_other": "用於 {{count}} 個專案:{{names}},以及沒有專案的任務",
- "used_by_default_none": "用於沒有專案的任務",
+ "usage_default_other": "{{count}} 個專案 + 沒有專案的任務",
+ "usage_default_none": "沒有專案的任務",
+ "filter_projects": "篩選專案",
+ "no_matching_projects": "沒有符合的專案",
+ "default_covers_no_project": "也適用於沒有專案的任務",
"new_blank": "空白工作流",
"from_template": "從模板建立"
},
diff --git a/packages/views/workflows/workflows-tab.test.tsx b/packages/views/workflows/workflows-tab.test.tsx
new file mode 100644
index 0000000000..ece405c29b
--- /dev/null
+++ b/packages/views/workflows/workflows-tab.test.tsx
@@ -0,0 +1,142 @@
+// @vitest-environment jsdom
+
+import { cleanup, fireEvent, screen, within } from "@testing-library/react";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { buildIssueStatusCatalog } from "@multica/core/issue-statuses";
+import { projectListOptions } from "@multica/core/projects/queries";
+import { memberListOptions } from "@multica/core/workspace/queries";
+import type { IssueWorkflow, Project } from "@multica/core/types";
+import { renderWithI18n } from "../test/i18n";
+import { WorkflowsTab } from "./workflows-tab";
+
+const { workflows } = vi.hoisted(() => ({ workflows: [] as IssueWorkflow[] }));
+
+vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => "ws-1" }));
+vi.mock("@multica/core/auth", () => ({
+ useAuthStore: (select: (s: { user: { id: string } }) => unknown) => select({ user: { id: "user-1" } }),
+}));
+vi.mock("@multica/core/paths", () => ({
+ useWorkspacePaths: () => ({ projectDetail: (id: string) => `/acme/projects/${id}` }),
+}));
+vi.mock("@multica/core/issue-statuses/hooks", () => ({ useIssueStatuses: () => buildIssueStatusCatalog([]) }));
+vi.mock("@multica/core/workspace/hooks", () => ({ useActorName: () => ({ getActorName: () => "Lambda" }) }));
+vi.mock("@multica/core/issue-workflows", () => ({ useIssueWorkflows: () => ({ workflows, isLoaded: true }) }));
+vi.mock("../navigation", () => ({
+ AppLink: ({ href, children, ...props }: { href: string; children: React.ReactNode }) => (
+ <a href={href} {...props}>
+ {children}
+ </a>
+ ),
+ useNavigation: () => ({ searchParams: new URLSearchParams("tab=workflows"), pathname: "/acme/settings", push: vi.fn() }),
+}));
+vi.mock("../common/actor-avatar", () => ({
+ ActorAvatar: ({ actorId }: { actorId: string }) => <span data-testid={`avatar-${actorId}`} />,
+}));
+vi.mock("../settings/components/issue-statuses-tab", () => ({ IssueStatusesTab: () => null }));
+vi.mock("./workflow-editor-page", () => ({ WorkflowEditorPage: () => null }));
+
+function project(id: string, title: string, workflowId: string | null = null): Project {
+ return {
+ id,
+ title,
+ icon: null,
+ workflow_id: workflowId,
+ issue_count: 3,
+ updated_at: `2026-10-${String(10 + Number(id.replace(/\D/g, "")) % 20).padStart(2, "0")}T00:00:00Z`,
+ } as Project;
+}
+
+function workflow(partial: Partial<IssueWorkflow>): IssueWorkflow {
+ return {
+ workspace_id: "ws-1",
+ description: "",
+ is_default: false,
+ owner_id: null,
+ steps: [],
+ project_ids: [],
+ created_at: "",
+ updated_at: "",
+ ...partial,
+ } as IssueWorkflow;
+}
+
+function renderTab(projects: Project[]) {
+ const qc = new QueryClient({ defaultOptions: { queries: { retry: false } } });
+ qc.setQueryData(projectListOptions("ws-1").queryKey, { projects } as never);
+ qc.setQueryData(memberListOptions("ws-1").queryKey, [{ user_id: "user-1", role: "owner" }] as never);
+ renderWithI18n(
+ <QueryClientProvider client={qc}>
+ <WorkflowsTab />
+ </QueryClientProvider>,
+ );
+}
+
+afterEach(() => {
+ cleanup();
+ workflows.length = 0;
+});
+
+describe("WorkflowsTab list (MUL-8377)", () => {
+ it("summarises a long project list in one line and lists it on demand", async () => {
+ const projects = Array.from({ length: 25 }, (_, i) => project(`p${i}`, i === 7 ? "数据透明化" : `Sprint ${i}`));
+ workflows.push(workflow({ id: "wf-default", name: "Default", is_default: true }));
+ renderTab(projects);
+
+ // The row no longer spells out every project name.
+ expect(screen.queryByText(/Sprint 3/)).toBeNull();
+ const trigger = screen.getByRole("button", { name: "25 projects + no-project issues" });
+
+ fireEvent.click(trigger);
+ const filter = await screen.findByRole("textbox", { name: "Filter projects" });
+ const dialog = screen.getByRole("dialog", { name: "Default" });
+ expect(dialog.getAttribute("aria-describedby")).toBeTruthy();
+ expect(document.getElementById(dialog.getAttribute("aria-describedby")!)?.textContent).toBe("25 projects");
+ expect(screen.getAllByRole("link").filter((a) => a.getAttribute("href")?.startsWith("/acme/projects/"))).toHaveLength(25);
+ expect(screen.getByText("Also applies to issues without a project")).toBeTruthy();
+
+ fireEvent.change(filter, { target: { value: "shuju" } });
+ const remaining = screen.getAllByRole("link").filter((a) => a.getAttribute("href")?.startsWith("/acme/projects/"));
+ expect(remaining).toHaveLength(1);
+ expect(remaining[0]!.textContent).toContain("数据透明化");
+ });
+
+ it("names a single project, flags an unused workflow, and links the row by its name", () => {
+ workflows.push(
+ workflow({ id: "wf-default", name: "Default", is_default: true }),
+ workflow({ id: "wf-release", name: "版本发布", project_ids: ["p1"] }),
+ workflow({ id: "wf-community", name: "Community" }),
+ );
+ renderTab([project("p1", "Multica 线上发布", "wf-release")]);
+
+ expect(screen.getByRole("button", { name: "Multica 线上发布" })).toBeTruthy();
+ expect(screen.getByText("Not used yet")).toBeTruthy();
+ expect(screen.getByText("Issues without a project")).toBeTruthy();
+ expect(screen.getByRole("link", { name: "版本发布" }).getAttribute("href")).toBe(
+ "/acme/settings?tab=workflows&workflow=wf-release",
+ );
+ });
+
+ it("names who each handoff step goes to", () => {
+ workflows.push(
+ workflow({ id: "wf-default", name: "Default", is_default: true }),
+ workflow({
+ id: "wf-release",
+ name: "版本发布",
+ steps: [
+ { status_key: "todo", handler: { type: "agent", id: "agent-1" }, instructions: "" },
+ { status_key: "in_progress", handler: { type: "project_lead" }, instructions: "" },
+ { status_key: "in_review", handler: { type: "none" }, instructions: "" },
+ { status_key: "done", handler: { type: "none" }, instructions: "" },
+ ],
+ }),
+ );
+ renderTab([]);
+
+ // A step's arrow travels in a wrapper with the same text, so take the innermost match.
+ const chip = (text: string) => screen.getAllByText((_, el) => el?.tagName === "SPAN" && el.textContent === text).at(-1)!;
+ expect(within(chip("TodoLambda")).getByTestId("avatar-agent-1")).toBeTruthy();
+ expect(chip("In ProgressProject lead")).toBeTruthy();
+ expect(chip("In Review")).toBeTruthy();
+ });
+});
diff --git a/packages/views/workflows/workflows-tab.tsx b/packages/views/workflows/workflows-tab.tsx
index 7e033505a9..31c733e15a 100644
--- a/packages/views/workflows/workflows-tab.tsx
+++ b/packages/views/workflows/workflows-tab.tsx
@@ -1,10 +1,20 @@
"use client";
-import { Fragment, useMemo } from "react";
+import { useMemo, useState, type ReactNode } from "react";
import { useQuery } from "@tanstack/react-query";
-import { ChevronDown, ChevronRight, LayoutTemplate, Plus } from "@multica/ui/icons";
+import {
+ ArrowRight,
+ ChevronDown,
+ ChevronRight,
+ Info,
+ LayoutTemplate,
+ Plus,
+ Search,
+ User,
+} from "@multica/ui/icons";
import { useAuthStore } from "@multica/core/auth";
import { useWorkspaceId } from "@multica/core/hooks";
+import { useWorkspacePaths } from "@multica/core/paths";
import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";
import { statusColumnKeys } from "@multica/core/issues";
import { useIssueWorkflows } from "@multica/core/issue-workflows";
@@ -21,13 +31,23 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@multica/ui/components/ui/dropdown-menu";
+import {
+ Popover,
+ PopoverContent,
+ PopoverDescription,
+ PopoverTitle,
+ PopoverTrigger,
+} from "@multica/ui/components/ui/popover";
import { ActorAvatar } from "../common/actor-avatar";
+import { matchesPinyin } from "../editor/extensions/pinyin-match";
import { StatusIcon } from "../issues/components/status-icon";
import { useStatusLabel } from "../issues/utils/status-label";
-import { useNavigation } from "../navigation";
+import { AppLink, useNavigation } from "../navigation";
+import { ProjectIcon } from "../projects/components/project-icon";
import { IssueStatusesTab } from "../settings/components/issue-statuses-tab";
import { SettingsTab } from "../settings/components/settings-layout";
import { useT } from "../i18n";
+import { useStepHandlerLabel } from "./step-handler";
import { WORKFLOW_TEMPLATES, type WorkflowTemplateId } from "./templates";
import { WorkflowEditorPage } from "./workflow-editor-page";
@@ -71,8 +91,9 @@ export function WorkflowsTab() {
}
return `${navigation.pathname}?${next.toString()}`;
};
- const openEditor = (id: string, from: WorkflowTemplateId | null = null) =>
- navigation.push(hrefWith({ [WORKFLOW_PARAM]: id, [DUPLICATE_PARAM]: null, [TEMPLATE_PARAM]: from }));
+ const editorHref = (id: string, from: WorkflowTemplateId | null = null) =>
+ hrefWith({ [WORKFLOW_PARAM]: id, [DUPLICATE_PARAM]: null, [TEMPLATE_PARAM]: from });
+ const openEditor = (id: string, from: WorkflowTemplateId | null = null) => navigation.push(editorHref(id, from));
const backToList = () =>
navigation.push(hrefWith({ [WORKFLOW_PARAM]: null, [DUPLICATE_PARAM]: null, [TEMPLATE_PARAM]: null }));
@@ -153,7 +174,7 @@ export function WorkflowsTab() {
>
<div className="divide-y divide-surface-border overflow-hidden rounded-lg border border-surface-border bg-card">
{defaultRow ? (
- <WorkflowRow workflow={defaultRow} projects={defaultProjects} onOpen={() => openEditor(defaultRow.id)} />
+ <WorkflowRow workflow={defaultRow} projects={defaultProjects} href={editorHref(defaultRow.id)} />
) : (
<DefaultWorkflowRow projects={defaultProjects} />
)}
@@ -163,7 +184,7 @@ export function WorkflowsTab() {
key={workflow.id}
workflow={workflow}
projects={projects.filter((p) => workflow.project_ids.includes(p.id))}
- onOpen={() => openEditor(workflow.id)}
+ href={editorHref(workflow.id)}
/>
))}
</div>
@@ -182,75 +203,174 @@ function DefaultWorkflowRow({ projects }: { projects: Project[] }) {
const wsId = useWorkspaceId();
const catalog = useIssueStatuses(wsId);
const keys = statusColumnKeys(catalog);
- const separator = t(($) => $.workflows.list_separator);
return (
- <button
- type="button"
- className="flex w-full items-center gap-4 px-4 py-3.5 text-left transition-colors hover:bg-accent/40"
- onClick={() => document.getElementById("status-library")?.scrollIntoView({ behavior: "smooth", block: "start" })}
- >
- <div className="min-w-0 flex-1 space-y-2">
- <div className="flex flex-wrap items-center gap-2">
- <span className="text-body font-semibold">{t(($) => $.workflows.default_name)}</span>
- </div>
- <StepChain steps={keys.map((key) => ({ status_key: key, handler: { type: "none" }, instructions: "" }))} />
- <p className="text-caption text-muted-foreground">
- {projects.length > 0
- ? t(($) => $.workflows.settings.used_by_default, {
- count: projects.length,
- names: projects.map((p) => p.title).join(separator),
- })
- : t(($) => $.workflows.settings.used_by_default_none)}
- </p>
- </div>
- <ChevronRight aria-hidden className="size-4 shrink-0 text-muted-foreground" />
- </button>
+ <WorkflowRowLayout
+ name={
+ <button
+ type="button"
+ className={ROW_LINK_CLASS}
+ onClick={() => document.getElementById("status-library")?.scrollIntoView({ behavior: "smooth", block: "start" })}
+ >
+ {t(($) => $.workflows.default_name)}
+ </button>
+ }
+ description={t(($) => $.workflows.default_summary)}
+ usage={<WorkflowUsage name={t(($) => $.workflows.default_name)} projects={projects} isDefault />}
+ steps={keys.map((key) => ({ status_key: key, handler: { type: "none" }, instructions: "" }))}
+ />
+ );
+}
+
+function WorkflowRow({ workflow, projects, href }: { workflow: IssueWorkflow; projects: Project[]; href: string }) {
+ return (
+ <WorkflowRowLayout
+ name={
+ <AppLink href={href} className={ROW_LINK_CLASS}>
+ {workflow.name}
+ </AppLink>
+ }
+ description={workflow.description}
+ usage={<WorkflowUsage name={workflow.name} projects={projects} isDefault={workflow.is_default} />}
+ steps={workflow.steps}
+ />
);
}
-function WorkflowRow({
- workflow,
- projects,
- onOpen,
+/**
+ * The name's `::after` stretches over the whole row, so the row clicks
+ * through to the workflow while its accessible name stays the workflow name.
+ * Controls on the row sit above it with `relative z-10`.
+ */
+const ROW_LINK_CLASS =
+ "min-w-0 max-w-[40%] shrink-0 truncate text-body font-semibold outline-none after:absolute after:inset-0 focus-visible:after:outline-2 focus-visible:after:-outline-offset-2 focus-visible:after:outline-ring";
+
+function WorkflowRowLayout({
+ name,
+ description,
+ usage,
+ steps,
}: {
- workflow: IssueWorkflow;
- projects: Project[];
- onOpen: () => void;
+ name: ReactNode;
+ description?: string | null;
+ usage: ReactNode;
+ steps: IssueWorkflowStep[];
}) {
+ return (
+ <div className="relative flex items-center gap-4 px-4 py-3.5 transition-colors hover:bg-accent/40">
+ <div className="min-w-0 flex-1 space-y-2.5">
+ <div className="flex min-h-7 min-w-0 items-center gap-2">
+ {name}
+ {description && <span className="min-w-0 truncate text-caption text-muted-foreground">{description}</span>}
+ {usage}
+ </div>
+ <StepChain steps={steps} />
+ </div>
+ <ChevronRight aria-hidden className="size-4 shrink-0 text-faint-foreground" />
+ </div>
+ );
+}
+
+const USAGE_STACK_SIZE = 3;
+const USAGE_FILTER_MIN = 7;
+
+/**
+ * Which projects use a workflow, as one line: up to three project icons and a
+ * count (or the name, for a single project). The full list opens on click.
+ */
+function WorkflowUsage({ name, projects, isDefault }: { name: string; projects: Project[]; isDefault: boolean }) {
const { t } = useT("issues");
- const separator = t(($) => $.workflows.list_separator);
+ const paths = useWorkspacePaths();
+ const [open, setOpen] = useState(false);
+ const [filter, setFilter] = useState("");
+ const sorted = useMemo(
+ () => [...projects].sort((a, b) => b.updated_at.localeCompare(a.updated_at)),
+ [projects],
+ );
+
+ if (sorted.length === 0) {
+ return (
+ <span className="ml-auto shrink-0 text-label text-muted-foreground">
+ {isDefault ? t(($) => $.workflows.settings.usage_default_none) : t(($) => $.workflows.settings.no_projects)}
+ </span>
+ );
+ }
+
+ const query = filter.trim().toLowerCase();
+ const visible = query
+ ? sorted.filter((p) => p.title.toLowerCase().includes(query) || matchesPinyin(p.title, query))
+ : sorted;
+ const summary = isDefault
+ ? t(($) => $.workflows.settings.usage_default, { count: sorted.length })
+ : sorted.length === 1
+ ? sorted[0]!.title
+ : t(($) => $.workflows.settings.projects, { count: sorted.length });
+
return (
- <button
- type="button"
- onClick={onOpen}
- className="flex w-full items-center gap-4 px-4 py-3.5 text-left transition-colors hover:bg-accent/40"
+ <Popover
+ open={open}
+ onOpenChange={(next) => {
+ setOpen(next);
+ if (!next) setFilter("");
+ }}
>
- <div className="min-w-0 flex-1 space-y-2">
- <div className="flex flex-wrap items-center gap-2">
- <span className="text-body font-semibold">{workflow.name}</span>
- {workflow.description && (
- <span className="truncate text-caption text-muted-foreground">{workflow.description}</span>
+ <PopoverTrigger className="relative z-10 -mr-2 ml-auto inline-flex h-7 min-w-0 max-w-[45%] shrink-0 items-center gap-2 rounded-md px-2 text-label text-muted-foreground transition-colors hover:bg-surface-selected hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-popup-open:bg-surface-selected data-popup-open:text-foreground">
+ <span aria-hidden className="flex shrink-0 -space-x-1.5">
+ {sorted.slice(0, USAGE_STACK_SIZE).map((project) => (
+ <span key={project.id} className="flex size-5 items-center justify-center rounded-full bg-muted ring-2 ring-card">
+ <ProjectIcon project={project} size="sm" />
+ </span>
+ ))}
+ </span>
+ <span className="truncate">{summary}</span>
+ </PopoverTrigger>
+ <PopoverContent align="end" className="w-80 gap-0 p-0">
+ <div className="flex min-w-0 items-baseline gap-1.5 px-3 pb-2 pt-3">
+ <PopoverTitle className="truncate text-label font-semibold">{name}</PopoverTitle>
+ <PopoverDescription className="shrink-0 text-caption">
+ {t(($) => $.workflows.settings.projects, { count: sorted.length })}
+ </PopoverDescription>
+ </div>
+ {sorted.length >= USAGE_FILTER_MIN && (
+ <div className="relative mx-2 mb-1">
+ <Search aria-hidden className="pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground" />
+ <input
+ type="text"
+ value={filter}
+ onChange={(e) => setFilter(e.target.value)}
+ placeholder={t(($) => $.workflows.settings.filter_projects)}
+ aria-label={t(($) => $.workflows.settings.filter_projects)}
+ className="h-8 w-full rounded-md border border-input bg-transparent pl-8 pr-2 text-label outline-none placeholder:text-muted-foreground focus-visible:border-ring"
+ />
+ </div>
+ )}
+ <div className="max-h-72 overflow-y-auto p-1">
+ {visible.length === 0 ? (
+ <p className="px-2 py-3 text-center text-caption text-muted-foreground">
+ {t(($) => $.workflows.settings.no_matching_projects)}
+ </p>
+ ) : (
+ visible.map((project) => (
+ <AppLink
+ key={project.id}
+ href={paths.projectDetail(project.id)}
+ onClick={() => setOpen(false)}
+ className="flex h-8 items-center gap-2 rounded-md px-2 text-label transition-colors hover:bg-accent focus-visible:bg-accent focus-visible:outline-none"
+ >
+ <ProjectIcon project={project} size="sm" />
+ <span className="min-w-0 flex-1 truncate">{project.title}</span>
+ <span className="shrink-0 text-caption tabular-nums text-muted-foreground">{project.issue_count}</span>
+ </AppLink>
+ ))
)}
</div>
- <StepChain steps={workflow.steps} />
- <p className="text-caption text-muted-foreground">
- {workflow.is_default
- ? projects.length > 0
- ? t(($) => $.workflows.settings.used_by_default, {
- count: projects.length,
- names: projects.map((p) => p.title).join(separator),
- })
- : t(($) => $.workflows.settings.used_by_default_none)
- : projects.length > 0
- ? t(($) => $.workflows.settings.used_by, {
- count: projects.length,
- names: projects.map((p) => p.title).join(separator),
- })
- : t(($) => $.workflows.settings.no_projects)}
- </p>
- </div>
- <ChevronRight aria-hidden className="size-4 shrink-0 text-muted-foreground" />
- </button>
+ {isDefault && (
+ <p className="flex items-center gap-2 border-t border-surface-border px-3 py-2.5 text-caption text-muted-foreground">
+ <Info aria-hidden className="size-3.5 shrink-0" />
+ {t(($) => $.workflows.settings.default_covers_no_project)}
+ </p>
+ )}
+ </PopoverContent>
+ </Popover>
);
}
@@ -260,19 +380,26 @@ function WorkflowRow({
* path an issue takes.
*/
function StepChain({ steps }: { steps: IssueWorkflowStep[] }) {
- const { t } = useT("issues");
const wsId = useWorkspaceId();
const catalog = useIssueStatuses(wsId);
const labelOf = useStatusLabel(wsId);
+ const handlerLabel = useStepHandlerLabel(null);
const path = steps.filter((s) => s.status_key !== "blocked" && catalog.categoryOf(s.status_key) !== "closed");
return (
<div className="flex flex-wrap items-center gap-x-1 gap-y-1.5">
{path.map((step, index) => {
const { type, id } = step.handler;
+ const handler = handlerLabel(step);
+ const actor = (type === "agent" || type === "squad" || type === "member") && id ? { type, id } : null;
+ // The arrow travels with the step it points to, so a wrapped line
+ // starts with "→ step" instead of ending on an arrow beside the
+ // row's chevron.
return (
- <Fragment key={step.status_key}>
- {index > 0 && <ChevronRight aria-hidden className="size-3 text-muted-foreground" />}
- <span className="inline-flex items-center gap-1.5 rounded-full border border-surface-border px-2 py-0.5 text-caption">
+ <span key={step.status_key} className="inline-flex items-center gap-1">
+ {index > 0 && <ArrowRight aria-hidden className="size-3 text-faint-foreground" />}
+ <span
+ className={`inline-flex h-[22px] items-center gap-1.5 rounded-full border border-surface-border bg-card pl-2 text-caption ${handler ? "pr-0.5" : "pr-2"}`}
+ >
<StatusIcon
status={step.status_key}
category={catalog.categoryOf(step.status_key)}
@@ -281,17 +408,20 @@ function StepChain({ steps }: { steps: IssueWorkflowStep[] }) {
className="h-3 w-3"
/>
{labelOf(step.status_key)}
- {(type === "agent" || type === "squad" || type === "member") && id && (
- <ActorAvatar actorType={type} actorId={id} size="xs" profileLink={false} />
- )}
- {type === "project_lead" && (
- <span className="text-muted-foreground">· {t(($) => $.workflows.handler.project_lead)}</span>
- )}
- {type === "creator" && (
- <span className="text-muted-foreground">· {t(($) => $.workflows.handler.creator)}</span>
+ {handler && (
+ <span className="inline-flex h-4 max-w-40 items-center gap-1 rounded-full bg-muted pl-px pr-1.5 text-muted-foreground [--avatar-slot-size:14px]">
+ {actor ? (
+ <ActorAvatar actorType={actor.type} actorId={actor.id} size="xs" profileLink={false} />
+ ) : (
+ <span aria-hidden className="flex size-3.5 shrink-0 items-center justify-center rounded-full border border-dashed border-faint-foreground">
+ <User className="size-2" />
+ </span>
+ )}
+ <span className="truncate">{handler}</span>
+ </span>
)}
</span>
- </Fragment>
+ </span>
);
})}
</div>