Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-6422: refactor(settings): strip the duplicated chrome from the issue-status list (#7244)
Bohan Jiang9573ec22745d
diff --git a/packages/views/locales/en/settings.json b/packages/views/locales/en/settings.jsonindex c588960776..3230795425 100644--- a/packages/views/locales/en/settings.json+++ b/packages/views/locales/en/settings.json@@ -1,13 +1,12 @@{"issue_statuses": {"title": "Issue Statuses",- "description": "Add statuses of your own on top of the seven built-in ones. Every status belongs to a category, and the category is what determines its behavior.",+ "description": "Define the workflow your issues move through. Each status inherits its behavior from its category.","loading": "Loading statuses…","add": "Add status","show_archived": "Show archived ({{count}})","archived_badge": "Archived","archived_hint": "Retired from new assignments. Issues already on it keep it.",- "built_in_locked": "Built-in status. Name, color and category are fixed.","flag_off": "Custom statuses are not enabled for this deployment yet. The built-in statuses below work as usual.","reorder_failed": "Could not save the new order.","actions": {@@ -22,6 +21,7 @@"behavior_hint": "This status behaves exactly like {{category}}.","name": "Name","name_placeholder": "e.g. Code Review",+ "key_hint": "Referred to as {{key}} by the API and the CLI.","category": "Category","category_locked": "Category cannot be changed — issues already on this status depend on it.","description": "Description",diff --git a/packages/views/locales/ja/settings.json b/packages/views/locales/ja/settings.jsonindex 107c848a79..e038ac16b8 100644--- a/packages/views/locales/ja/settings.json+++ b/packages/views/locales/ja/settings.json@@ -1,13 +1,12 @@{"issue_statuses": {- "title": "イシューステータス",- "description": "組み込みの 7 つのステータスに加えて独自のステータスを追加できます。各ステータスはカテゴリに属し、カテゴリが挙動を決めます。",+ "title": "タスクステータス",+ "description": "タスクが辿るワークフローを定義します。各ステータスの挙動は所属するカテゴリが決めます。","loading": "ステータスを読み込み中…","add": "ステータスを追加","show_archived": "アーカイブ済みを表示({{count}})","archived_badge": "アーカイブ済み",- "archived_hint": "新規の割り当てには使えません。すでにこのステータスのイシューはそのままです。",- "built_in_locked": "組み込みステータス。名前・色・カテゴリは変更できません。",+ "archived_hint": "新規の割り当てには使えません。すでにこのステータスのタスクはそのままです。","flag_off": "このデプロイではカスタムステータスがまだ有効化されていません。下の組み込みステータスは通常どおり使えます。","reorder_failed": "並び順を保存できませんでした。","actions": {@@ -22,8 +21,9 @@"behavior_hint": "このステータスは「{{category}}」とまったく同じ挙動になります。","name": "名前","name_placeholder": "例: Code Review",+ "key_hint": "API と CLI では {{key}} として参照されます。","category": "カテゴリ",- "category_locked": "カテゴリは変更できません。すでにこのステータスのイシューが依存しています。",+ "category_locked": "カテゴリは変更できません。すでにこのステータスのタスクが依存しています。","description": "説明","description_placeholder": "チームにとってこのステータスが意味すること","color": "色",@@ -34,7 +34,7 @@},"archive_dialog": {"title": "このステータスをアーカイブしますか?",- "description": "「{{name}}」は新しいイシューに割り当てられなくなります。すでにこのステータスのイシューはそのまま残り、挙動も変わりません。",+ "description": "「{{name}}」は新しいタスクに割り当てられなくなります。すでにこのステータスのタスクはそのまま残り、挙動も変わりません。","cancel": "キャンセル","confirm": "アーカイブ","failed": "アーカイブできませんでした。"diff --git a/packages/views/locales/ko/settings.json b/packages/views/locales/ko/settings.jsonindex 07072a26f4..4b979bbc00 100644--- a/packages/views/locales/ko/settings.json+++ b/packages/views/locales/ko/settings.json@@ -1,13 +1,12 @@{"issue_statuses": {- "title": "이슈 상태",- "description": "기본 제공되는 7개 상태에 더해 직접 상태를 추가할 수 있습니다. 모든 상태는 카테고리에 속하며, 동작은 카테고리가 결정합니다.",+ "title": "태스크 상태",+ "description": "태스크가 거치는 워크플로를 정의합니다. 각 상태의 동작은 속한 카테고리가 결정합니다.","loading": "상태를 불러오는 중…","add": "상태 추가","show_archived": "보관됨 표시 ({{count}})","archived_badge": "보관됨",- "archived_hint": "새로 지정할 수 없습니다. 이미 이 상태인 이슈는 그대로 유지됩니다.",- "built_in_locked": "기본 제공 상태입니다. 이름, 색상, 카테고리를 바꿀 수 없습니다.",+ "archived_hint": "새로 지정할 수 없습니다. 이미 이 상태인 태스크는 그대로 유지됩니다.","flag_off": "이 배포에서는 사용자 지정 상태가 아직 활성화되지 않았습니다. 아래 기본 상태는 평소대로 동작합니다.","reorder_failed": "새 순서를 저장하지 못했습니다.","actions": {@@ -22,8 +21,9 @@"behavior_hint": "이 상태는 \"{{category}}\"와 정확히 같게 동작합니다.","name": "이름","name_placeholder": "예: Code Review",+ "key_hint": "API와 CLI에서는 {{key}}로 참조합니다.","category": "카테고리",- "category_locked": "카테고리는 변경할 수 없습니다. 이미 이 상태인 이슈가 이에 의존합니다.",+ "category_locked": "카테고리는 변경할 수 없습니다. 이미 이 상태인 태스크가 이에 의존합니다.","description": "설명","description_placeholder": "팀에게 이 상태가 의미하는 것","color": "색상",@@ -34,7 +34,7 @@},"archive_dialog": {"title": "이 상태를 보관할까요?",- "description": "\"{{name}}\"은(는) 새 이슈에 지정할 수 없게 됩니다. 이미 이 상태인 이슈는 그대로 유지되며 동작도 달라지지 않습니다.",+ "description": "\"{{name}}\"은(는) 새 태스크에 지정할 수 없게 됩니다. 이미 이 상태인 태스크는 그대로 유지되며 동작도 달라지지 않습니다.","cancel": "취소","confirm": "보관","failed": "보관하지 못했습니다."diff --git a/packages/views/locales/zh-Hans/settings.json b/packages/views/locales/zh-Hans/settings.jsonindex e0469af60b..1b4187d13c 100644--- a/packages/views/locales/zh-Hans/settings.json+++ b/packages/views/locales/zh-Hans/settings.json@@ -1,13 +1,12 @@{"issue_statuses": {- "title": "议题状态",- "description": "在内置的 7 个状态之外添加自己的状态。每个状态都属于一个分类,分类决定了它的行为。",+ "title": "任务状态",+ "description": "定义任务流转的工作流。每个状态的行为由它所属的分类决定。","loading": "正在加载状态…","add": "添加状态","show_archived": "显示已归档({{count}})","archived_badge": "已归档",- "archived_hint": "已停止用于新的指派,已经在该状态上的议题保持不变。",- "built_in_locked": "内置状态,名称、颜色和分类均不可修改。",+ "archived_hint": "已停止用于新的指派,已经在该状态上的任务保持不变。","flag_off": "当前部署尚未开启自定义状态,下面的内置状态照常使用。","reorder_failed": "排序保存失败。","actions": {@@ -22,8 +21,9 @@"behavior_hint": "该状态的行为与「{{category}}」完全一致。","name": "名称","name_placeholder": "例如:Code Review",+ "key_hint": "API 和 CLI 中通过 {{key}} 引用。","category": "分类",- "category_locked": "分类不可修改 —— 已经处于该状态的议题依赖它。",+ "category_locked": "分类不可修改 —— 已经处于该状态的任务依赖它。","description": "描述","description_placeholder": "这个状态对团队意味着什么","color": "颜色",@@ -34,14 +34,14 @@},"archive_dialog": {"title": "归档这个状态?",- "description": "「{{name}}」将不再能被指派给新的议题。已经处于该状态的议题保持不变,行为也完全不变。",+ "description": "「{{name}}」将不再能被指派给新的任务。已经处于该状态的任务保持不变,行为也完全不变。","cancel": "取消","confirm": "归档","failed": "归档失败。"},"categories": {- "backlog": "搁置。把议题移到这里不会启动 agent。",- "todo": "排队中。把议题移到这里会启动指派的 agent。",+ "backlog": "搁置。把任务移到这里不会启动 agent。",+ "todo": "排队中。把任务移到这里会启动指派的 agent。","in_progress": "正在进行。","in_review": "已交付,等待人工 review。会结束 autopilot 运行。","done": "已完成。",@@ -321,7 +321,7 @@"labs": "实验室","members": "成员","labels": "标签",- "issue_statuses": "议题状态",+ "issue_statuses": "任务状态","properties": "属性","quick_actions": "快捷操作","plugins": "Plugins",diff --git a/packages/views/settings/components/issue-statuses-tab.test.tsx b/packages/views/settings/components/issue-statuses-tab.test.tsxindex 146ebdd00b..b19917ec44 100644--- a/packages/views/settings/components/issue-statuses-tab.test.tsx+++ b/packages/views/settings/components/issue-statuses-tab.test.tsx@@ -91,7 +91,7 @@ describe("IssueStatusesTab", () => {catalog = [BUILT_IN_IN_REVIEW];render(<IssueStatusesTab />);- expect(screen.getAllByText(en.issue_statuses.add).length).toBeGreaterThan(0);+ expect(screen.getAllByLabelText(en.issue_statuses.add).length).toBeGreaterThan(0);expect(screen.queryByText(en.issue_statuses.flag_off)).toBeNull();});@@ -102,7 +102,7 @@ describe("IssueStatusesTab", () => {flagOn = false;render(<IssueStatusesTab />);- expect(screen.queryByText(en.issue_statuses.add)).toBeNull();+ expect(screen.queryByLabelText(en.issue_statuses.add)).toBeNull();expect(screen.getByText(en.issue_statuses.flag_off)).toBeInTheDocument();expect(screen.getByText("QA")).toBeInTheDocument();});@@ -112,7 +112,7 @@ describe("IssueStatusesTab", () => {role = "member";render(<IssueStatusesTab />);- expect(screen.queryByText(en.issue_statuses.add)).toBeNull();+ expect(screen.queryByLabelText(en.issue_statuses.add)).toBeNull();expect(screen.getByText("QA")).toBeInTheDocument();expect(screen.queryByLabelText(@@ -136,6 +136,23 @@ describe("IssueStatusesTab", () => {expect(screen.getByRole("switch")).toBeEnabled();});+ // The category header used to repeat the sentence its built-in row already+ // carried, so every category said the same thing twice. (MUL-6422)+ it("states a category's behavior once, on its built-in row", () => {+ catalog = [BUILT_IN_IN_REVIEW];+ render(<IssueStatusesTab />);++ expect(screen.getAllByText(en.issue_statuses.categories.in_review)).toHaveLength(1);+ });++ // A toggle that can only ever reveal nothing is not worth a row of chrome.+ it("offers the archived toggle only once something is archived", () => {+ catalog = [BUILT_IN_IN_REVIEW, entry({ key: "qa", name: "QA" })];+ render(<IssueStatusesTab />);++ expect(screen.queryByRole("switch")).toBeNull();+ });+it("does not offer reorder when a category holds a single custom status", () => {catalog = [BUILT_IN_IN_REVIEW, entry({ key: "qa", name: "QA" })];render(<IssueStatusesTab />);diff --git a/packages/views/settings/components/issue-statuses-tab.tsx b/packages/views/settings/components/issue-statuses-tab.tsxindex 4a3023adf1..d27bf86172 100644--- a/packages/views/settings/components/issue-statuses-tab.tsx+++ b/packages/views/settings/components/issue-statuses-tab.tsx@@ -4,9 +4,7 @@ import { useEffect, useMemo, useState } from "react";import { useQuery } from "@tanstack/react-query";import {Archive,- ArchiveRestore,GripVertical,- Lock,MoreHorizontal,Pencil,Plus,@@ -101,6 +99,11 @@ import { SettingsTab } from "./settings-layout";* Built-ins are shown but locked. Each one is its category's canonical* definition, and the default workspace has to look identical for every user* who never opens this page.+ *+ * The chrome is deliberately thin (MUL-6422). A category and its built-in row+ * are the same concept seen twice, so anything the row already carries — the+ * glyph, the behavior sentence — is noise on the header above it. What is left+ * on a header is the label and the one action it owns.*/interface StatusDraft {@@ -160,30 +163,32 @@ export function IssueStatusesTab() {title={t(($) => $.issue_statuses.title)}description={t(($) => $.issue_statuses.description)}>- <div className="space-y-5">- <div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">- <label className="flex items-center gap-2 text-body text-muted-foreground">- <Switch- checked={showArchived}- onCheckedChange={setShowArchived}- disabled={archivedCount === 0}- />- {t(($) => $.issue_statuses.show_archived, { count: archivedCount })}- </label>- </div>-+ <div className="space-y-4">{!canCreate && (<p className="rounded-lg border border-surface-border bg-muted/20 px-4 py-3 text-caption text-muted-foreground">{t(($) => $.issue_statuses.flag_off)}</p>)}+ {/* Offered only once the workspace has something archived. A permanently+ disabled "Show archived (0)" is a control that can never do+ anything. */}+ {archivedCount > 0 && (+ <label className="flex items-center justify-end gap-2 text-caption text-muted-foreground">+ {t(($) => $.issue_statuses.show_archived, { count: archivedCount })}+ <Switch checked={showArchived} onCheckedChange={setShowArchived} />+ </label>+ )}+{isLoading ? (<div className="rounded-lg border border-surface-border bg-card px-4 py-12 text-center text-body text-muted-foreground">{t(($) => $.issue_statuses.loading)}</div>) : (- <div className="space-y-4">+ // One list, not seven cards: the categories are sections of a single+ // workflow, and seven separate borders made them read as seven+ // unrelated settings.+ <div className="overflow-hidden rounded-lg border border-surface-border bg-card">{groups.map((group) => (<CategorySectionkey={group.category}@@ -282,23 +287,41 @@ function CategorySection({const canReorder = canManage && sortableIds.length > 1;return (- <div className="overflow-hidden rounded-lg border border-surface-border bg-card">- <div className="flex items-center gap-2 border-b border-surface-border bg-muted/20 px-4 py-2.5">- <StatusIcon status={category} category={category} className="size-3.5" />- <span className="text-caption font-medium">{labelOf(category)}</span>- <span className="flex-1 text-caption text-muted-foreground">- {t(($) => $.issue_statuses.categories[category])}+ <section className="border-b border-surface-border last:border-b-0">+ {/* Label plus the one action the header owns. The category glyph is the+ same glyph the built-in row renders directly below it, so it said+ nothing the eye had not already read. */}+ <div className="flex items-center justify-between gap-2 bg-muted/20 px-4 py-1.5">+ <span className="text-caption font-medium text-muted-foreground">+ {labelOf(category)}</span>{canCreate && (- <Button variant="ghost" size="sm" className="gap-1.5" onClick={onCreate}>- <Plus className="size-3.5" />- {t(($) => $.issue_statuses.add)}- </Button>+ <Tooltip>+ <TooltipTrigger+ render={+ <Button+ variant="ghost"+ size="icon-sm"+ aria-label={t(($) => $.issue_statuses.add)}+ onClick={onCreate}+ >+ <Plus className="size-4" />+ </Button>+ }+ />+ <TooltipContent>{t(($) => $.issue_statuses.add)}</TooltipContent>+ </Tooltip>)}</div><div className="divide-y divide-surface-border">- {builtIn && <BuiltInRow entry={builtIn} label={labelOf(builtIn.key)} />}+ {builtIn && (+ <BuiltInRow+ entry={builtIn}+ label={labelOf(builtIn.key)}+ behavior={t(($) => $.issue_statuses.categories[category])}+ />+ )}<DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleDragEnd}><SortableContext items={sortableIds} strategy={verticalListSortingStrategy}>{order.map((entry) => (@@ -314,30 +337,31 @@ function CategorySection({</SortableContext></DndContext></div>- </div>+ </section>);}-function BuiltInRow({ entry, label }: { entry: IssueStatusEntry; label: string }) {- const { t } = useT("settings");+function BuiltInRow({+ entry,+ label,+ behavior,+}: {+ entry: IssueStatusEntry;+ label: string;+ behavior: string;+}) {return (- <div className="flex items-center gap-3 px-4 py-3">- <span className="w-4 shrink-0" />- <StatusIcon status={entry.key} category={entry.category} className="size-3.5" />- <span className="min-w-0 truncate text-body font-medium">{label}</span>- <Tooltip>- <TooltipTrigger- render={- <span className="inline-flex items-center text-muted-foreground">- <Lock className="size-3.5" />- </span>- }- />- <TooltipContent>{t(($) => $.issue_statuses.built_in_locked)}</TooltipContent>- </Tooltip>- <span className="ml-auto truncate text-caption text-muted-foreground">- {entry.description || "—"}- </span>+ <div className="flex min-h-12 items-center gap-3 px-4 py-2">+ <StatusIcon status={entry.key} category={entry.category} className="size-4" />+ <div className="min-w-0">+ <p className="truncate text-body font-medium">{label}</p>+ {/* The catalog's own description is seeded in English by the server;+ the category sentence is the translated form of the same fact, so+ it is the one that ships. No lock icon rides along — a built-in is+ the row with no actions menu, and seven padlocks said that seven+ times. */}+ <p className="truncate text-caption text-muted-foreground">{behavior}</p>+ </div></div>);}@@ -367,39 +391,52 @@ function CustomStatusRow({<divref={setNodeRef}style={{ transform: CSS.Transform.toString(transform), transition }}- className={`flex items-center gap-3 bg-card px-4 py-3 ${isDragging ? "relative z-10 shadow-[var(--surface-shadow)]" : ""} ${archived ? "opacity-60" : ""}`}+ className={`group/row relative flex min-h-12 items-center gap-3 bg-card px-4 py-2 ${isDragging ? "z-10 shadow-[var(--surface-shadow)]" : ""} ${archived ? "opacity-60" : ""}`}>- {canReorder ? (+ {/* The handle rides inside the row's own left padding instead of taking a+ column of its own. A reserved gutter indents every status away from+ the card edge — including the built-in rows, which can never be+ dragged — and that indent is what the list reads as. (MUL-6422) */}+ {canReorder && (<buttontype="button"aria-label={t(($) => $.issue_statuses.actions.reorder, { name: entry.name })}- className="w-4 shrink-0 cursor-grab text-muted-foreground active:cursor-grabbing"+ className="absolute left-0 top-1/2 flex w-4 -translate-y-1/2 cursor-grab justify-center text-faint-foreground opacity-0 transition-opacity group-hover/row:opacity-100 focus-visible:opacity-100 active:cursor-grabbing"{...attributes}{...listeners}><GripVertical className="size-4" /></button>- ) : (- <span className="w-4 shrink-0" />)}<StatusIconstatus={entry.key}category={entry.category}color={entry.color}- className="size-3.5"+ className="size-4"/>- <span className="min-w-0 truncate text-body font-medium">{entry.name}</span>- <code className="shrink-0 rounded bg-muted/60 px-1.5 py-0.5 text-micro text-muted-foreground">- {entry.key}- </code>- {archived && (- <span className="shrink-0 rounded-full bg-muted/60 px-1.5 py-0.5 text-micro text-muted-foreground">- {t(($) => $.issue_statuses.archived_badge)}- </span>- )}- <span className="ml-auto min-w-0 flex-1 truncate text-right text-caption text-muted-foreground">- {entry.description || "—"}- </span>+ {/* Name over description, the way the row is read. The old layout pinned+ the description to the far right, which left a column of em dashes on+ every status nobody had described. */}+ <div className="min-w-0 flex-1">+ <div className="flex min-w-0 items-center gap-2">+ <span className="truncate text-body font-medium">{entry.name}</span>+ {archived && (+ <Tooltip>+ <TooltipTrigger+ render={+ <span className="shrink-0 rounded-full bg-muted/60 px-1.5 py-0.5 text-micro text-muted-foreground">+ {t(($) => $.issue_statuses.archived_badge)}+ </span>+ }+ />+ <TooltipContent>{t(($) => $.issue_statuses.archived_hint)}</TooltipContent>+ </Tooltip>+ )}+ </div>+ {entry.description && (+ <p className="truncate text-caption text-muted-foreground">{entry.description}</p>+ )}+ </div>{canManage && !archived && (<DropdownMenu><DropdownMenuTrigger@@ -425,18 +462,6 @@ function CustomStatusRow({</DropdownMenuContent></DropdownMenu>)}- {archived && (- <Tooltip>- <TooltipTrigger- render={- <span className="inline-flex size-8 items-center justify-center text-muted-foreground">- <ArchiveRestore className="size-4" />- </span>- }- />- <TooltipContent>{t(($) => $.issue_statuses.archived_hint)}</TooltipContent>- </Tooltip>- )}</div>);}@@ -544,6 +569,16 @@ function StatusEditorDialog({}placeholder={t(($) => $.issue_statuses.editor.name_placeholder)}/>+ {/* The key is the string the API and the CLI take, and renaming a+ status does not move it — so it has to be readable somewhere.+ Here, not as a chip on every row: the list is for scanning+ names, and a slug beside each one is what turned it into a+ table of internals. (MUL-6422) */}+ {status && (+ <p className="text-caption text-muted-foreground">+ {t(($) => $.issue_statuses.editor.key_hint, { key: status.key })}+ </p>+ )}</div><div className="space-y-2"><FieldLabel>{t(($) => $.issue_statuses.editor.category)}</FieldLabel>