Web UI on Ant Design, scrollable factory columns, fix empty page after deleting the open chat

Buttons, fields, drop-downs, check boxes, tabs, dialogs and notices are Ant Design components;
their tokens come from the theme variables (web/src/ui). Every factory board column has its own
vertical scrollbar. ChatView rendered fewer hooks once its chat was deleted.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Sonnet 5.5 committed 2026-11-27 12:32:57 +01:00
1 parent 90b9ab6670
commit 6b1a1742b2
79 files changed
+2628 -1393

No files matched your search

+89 -95
View File
@@ -1,3 +1,5 @@
import { Button, Checkbox, Input, Segmented } from "antd";
import { Select } from "../ui/Select";
import { useEffect, useMemo, useState } from "react";
import { get, post, put } from "../api";
import { fmtCompact, fmtCost, fmtRelative, useT } from "../i18n";
@@ -166,19 +168,17 @@ export function Factory({ onMenu, overlayId }: { onMenu: () => void; overlayId?:
return (
<>
<div className="topbar">
<button className="ghost menu-btn" onClick={onMenu} aria-label={t("nav.menu")}>
<Button type="text" className="menu-btn" onClick={onMenu} aria-label={t("nav.menu")}>
<Icon name="menu" />
</button>
</Button>
<div className="grow">
<h1>{t("factory.title")}</h1>
</div>
<div className="segmented">
{(["overview", "settings"] as const).map((x) => (
<button key={x} className={tab === x ? "active" : ""} onClick={() => setTab(x)}>
{t(`factory.tab.${x}` as any)}
</button>
))}
</div>
<Segmented
value={tab}
onChange={(x) => setTab(x)}
options={(["overview", "settings"] as const).map((x) => ({ value: x, label: t(`factory.tab.${x}` as any) }))}
/>
</div>
<div className="page">
<div className="page-inner" style={{ maxWidth: tab === "overview" ? "none" : 1280 }}>
@@ -373,13 +373,13 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
{recreate && <RecreateDialog onClose={() => setRecreate(false)} />}
<p>{t("factory.empty")}</p>
<div className="row" style={{ gap: 8, justifyContent: "center" }}>
<button className="primary" onClick={newProject} disabled={busy}>
<Button type="primary" onClick={newProject} disabled={busy}>
<Icon name="plus" /> {t("factory.newProject")}
</button>
<button onClick={() => setRecreate(true)} disabled={busy}>
</Button>
<Button onClick={() => setRecreate(true)} disabled={busy}>
<Icon name="search" /> {t("recreate.button")}
</button>
<button onClick={onSettings}>{t("factory.tab.settings")}</button>
</Button>
<Button onClick={onSettings}>{t("factory.tab.settings")}</Button>
</div>
</div>
);
@@ -515,7 +515,7 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
</div>
<div className="factory-repos">
<select className="factory-repo-select" value={repo} onChange={(e) => setRepo(e.target.value)} aria-label={t("factory.project")}>
<Select className="factory-repo-select" value={repo} onChange={(e) => setRepo(e.target.value)} aria-label={t("factory.project")}>
<option value="">
{t("factory.allRepos")} ({data.issues.length})
</option>
@@ -525,7 +525,7 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
{r.version ? ` · v${r.version}` : ""} ({data.issues.filter((i) => i.repo === r.url).length}){r.enabled ? "" : " – off"}
</option>
))}
</select>
</Select>
{(() => {
const r = data.repos.find((x) => x.url === repo);
if (!r) return null;
@@ -542,24 +542,24 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
</span>
);
})()}
<button className="small primary" onClick={newProject} disabled={busy}>
<Button type="primary" size="small" onClick={newProject} disabled={busy}>
<Icon name="plus" /> {t("factory.newProject")}
</button>
<button className="small" onClick={() => setRecreate(true)} disabled={busy} title={t("recreate.hint")}>
</Button>
<Button size="small" onClick={() => setRecreate(true)} disabled={busy} title={t("recreate.hint")}>
<Icon name="search" /> {t("recreate.button")}
</button>
<button className="small" onClick={() => issueChat("feature")} disabled={busy} title={t("issues.featureHint")}>
</Button>
<Button size="small" onClick={() => issueChat("feature")} disabled={busy} title={t("issues.featureHint")}>
<Icon name="sparkle" /> {t("issues.feature")}
</button>
<button className="small" onClick={() => issueChat("slice")} disabled={busy} title={t("issues.sliceHint")}>
</Button>
<Button size="small" onClick={() => issueChat("slice")} disabled={busy} title={t("issues.sliceHint")}>
<Icon name="sparkle" /> {t("issues.slice")}
</button>
<button className="small" onClick={startRelease} disabled={busy} title={t("release.hint")}>
</Button>
<Button size="small" onClick={startRelease} disabled={busy} title={t("release.hint")}>
<Icon name="download" /> {t("release.button")}
</button>
<button className="small" onClick={poll} disabled={busy} title={t("factory.pollNow")}>
</Button>
<Button size="small" onClick={poll} disabled={busy} title={t("factory.pollNow")}>
<Icon name="refresh" /> {t("factory.pollNow")}
</button>
</Button>
</div>
<div className="factory-board">
@@ -568,9 +568,9 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
{t("factory.col.backlog")} <span className="chip">{backlogShown.length}</span>
</h4>
{backlogShown.length > 1 && (
<button className="small" onClick={() => void enqueue(backlogShown.filter((i) => i.allowed))} disabled={busy || !backlogShown.some((i) => i.allowed)} title={t("factory.backlog.queueAllHint")}>
<Button size="small" onClick={() => void enqueue(backlogShown.filter((i) => i.allowed))} disabled={busy || !backlogShown.some((i) => i.allowed)} title={t("factory.backlog.queueAllHint")}>
<Icon name="plus" /> {t("factory.backlog.queueAll")}
</button>
</Button>
)}
{backlogShown.map((i) => (
<div key={`${i.repo}#${i.number}`} className="factory-card backlog">
@@ -580,9 +580,9 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
<a href={i.url || issueUrl(i.repo, i.number)} target="_blank" rel="noreferrer" title={i.title}>
<b>{i.title || `#${i.number}`}</b>
</a>
<button className="small" onClick={() => void enqueue([i])} disabled={busy || !i.allowed} title={i.allowed ? t("factory.backlog.queueHint") : t("factory.backlog.notAllowed", { user: i.author })}>
<Button size="small" onClick={() => void enqueue([i])} disabled={busy || !i.allowed} title={i.allowed ? t("factory.backlog.queueHint") : t("factory.backlog.notAllowed", { user: i.author })}>
<Icon name="plus" /> {t("factory.backlog.queue")}
</button>
</Button>
</div>
))}
{backlogShown.length === 0 && <span className="hint">{t("factory.backlog.empty")}</span>}
@@ -677,26 +677,26 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
{selected && !phaseRunning && (
<>
<span className="hint">{t("factory.restartAt")}</span>
<button className="small" onClick={() => restart("new")} disabled={busy}>
<Button size="small" onClick={() => restart("new")} disabled={busy}>
{t("factory.col.review")}
</button>
<button className="small" onClick={() => restart("approved")} disabled={busy}>
</Button>
<Button size="small" onClick={() => restart("approved")} disabled={busy}>
{t("factory.col.build")}
</button>
<button className="small" onClick={() => restart("qa")} disabled={busy || !selected.branch}>
</Button>
<Button size="small" onClick={() => restart("qa")} disabled={busy || !selected.branch}>
{t("factory.col.qa")}
</button>
</Button>
</>
)}
{selected && !["review", "building", "testing"].includes(selected.state) && (
<button className="small" onClick={removeIssue} disabled={busy} title={t("factory.removeHint")}>
<Button size="small" onClick={removeIssue} disabled={busy} title={t("factory.removeHint")}>
<Icon name="trash" /> {t("factory.remove")}
</button>
</Button>
)}
{selected && selected.state === "done" && selected.merged && (
<button className="small" onClick={closeIssue} disabled={busy}>
<Button size="small" onClick={closeIssue} disabled={busy}>
<Icon name="check" /> {t("factory.close")}
</button>
</Button>
)}
{selected && (
<>
@@ -728,16 +728,16 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
<span className="spacer" />
{pr.state === "open" && selected?.state === "done" && (
<>
<select value={prMethod} onChange={(e) => setPrMethod(e.target.value)} disabled={busy}>
<Select value={prMethod} onChange={(e) => setPrMethod(e.target.value)} disabled={busy}>
{["merge", "squash", "rebase"].map((m) => (
<option key={m} value={m}>
{t(`factory.merge.${m}` as any)}
</option>
))}
</select>
<button className="small primary" onClick={mergePr} disabled={busy || pr.mergeable === false}>
</Select>
<Button type="primary" size="small" onClick={mergePr} disabled={busy || pr.mergeable === false}>
{t("factory.mergeBtn")}
</button>
</Button>
</>
)}
</div>
@@ -785,9 +785,9 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
</td>
<td>{fmtCost(r.cost, "USD")}</td>
<td>
<button className="small" onClick={() => openFactoryChat(r.session_id)}>
<Button size="small" onClick={() => openFactoryChat(r.session_id)}>
<Icon name="eye" /> {t("factory.openChat")}
</button>
</Button>
</td>
</tr>
))}
@@ -825,14 +825,14 @@ function PhaseSkills({ value, onChange }: { value: string[]; onChange: (v: strin
</button>
))}
{rest.length > 0 && value.length < 10 && (
<select value="" onChange={(e) => e.target.value && onChange([...value, e.target.value])}>
<Select value="" onChange={(e) => e.target.value && onChange([...value, e.target.value])}>
<option value="">{t("factory.skillAdd")}</option>
{rest.map((s) => (
<option key={s.name} value={s.name} title={s.description}>
{s.name}
</option>
))}
</select>
</Select>
)}
</div>
<div className="hint">{t("factory.skillsHint")}</div>
@@ -851,33 +851,33 @@ function PhaseForm({ phase, value, onChange }: { phase: Phase; value: PhaseCfg;
</label>
<label>
<span>{t("factory.agent")}</span>
<select value={value.agent} onChange={(e) => onChange({ agent: e.target.value })}>
<Select value={value.agent} onChange={(e) => onChange({ agent: e.target.value })}>
<option value="codecraft">CodeCraft</option>
<option value="claude-code">Claude Code</option>
</select>
</Select>
</label>
<label>
<span>{t("factory.mode")}</span>
<select value={value.permission_mode} onChange={(e) => onChange({ permission_mode: e.target.value })}>
<Select value={value.permission_mode} onChange={(e) => onChange({ permission_mode: e.target.value })}>
{MODES.map((m) => (
<option key={m} value={m}>
{t(`permissionMode.${m}` as any)}
</option>
))}
</select>
</Select>
</label>
<label>
<span>{t("factory.timeout")}</span>
<input type="number" min={1} value={value.timeout_minutes} onChange={(e) => onChange({ timeout_minutes: Number(e.target.value) || 60 })} />
<Input type="number" min={1} value={value.timeout_minutes} onChange={(e) => onChange({ timeout_minutes: Number(e.target.value) || 60 })} />
</label>
<label>
<span>{t("factory.attempts")}</span>
<input type="number" min={1} max={10} value={value.max_attempts} title={t("factory.attemptsHint")} onChange={(e) => onChange({ max_attempts: Math.max(1, Number(e.target.value) || 1) })} />
<Input type="number" min={1} max={10} value={value.max_attempts} title={t("factory.attemptsHint")} onChange={(e) => onChange({ max_attempts: Math.max(1, Number(e.target.value) || 1) })} />
</label>
<PhaseSkills value={value.skills ?? []} onChange={(skills) => onChange({ skills })} />
<label>
<span>{t("factory.extraPrompt")}</span>
<textarea rows={3} value={value.extra_prompt} onChange={(e) => onChange({ extra_prompt: e.target.value })} />
<Input.TextArea rows={3} value={value.extra_prompt} onChange={(e) => onChange({ extra_prompt: e.target.value })} />
</label>
</div>
);
@@ -933,8 +933,7 @@ function FactorySettings() {
<div className="row" style={{ gap: 8, flexWrap: "wrap" }}>
<h3 style={{ margin: 0 }}>{c.name || KIND_NAME[c.kind]}</h3>
<span className="spacer" />
<button
className="small"
<Button size="small"
disabled={busy !== undefined}
onClick={() =>
act(`c${i}`, async () => {
@@ -947,9 +946,8 @@ function FactorySettings() {
}
>
{busy === `c${i}` ? <Spinner small /> : <Icon name="plug" />} {t("factory.testConn")}
</button>
<button
className="small"
</Button>
<Button size="small"
title={t("common.delete")}
aria-label={t("common.delete")}
onClick={async () => {
@@ -957,35 +955,35 @@ function FactorySettings() {
}}
>
<Icon name="trash" />
</button>
</Button>
</div>
<div className="factory-form">
<label>
<span>{t("factory.connName")}</span>
<input value={c.name} onChange={(e) => upConn(i, { name: e.target.value })} />
<Input value={c.name} onChange={(e) => upConn(i, { name: e.target.value })} />
</label>
<label>
<span>{t("factory.kind")}</span>
<select value={c.kind} onChange={(e) => upConn(i, { kind: e.target.value as Connection["kind"] })}>
<Select value={c.kind} onChange={(e) => upConn(i, { kind: e.target.value as Connection["kind"] })}>
{Object.entries(KIND_NAME).map(([k, n]) => (
<option key={k} value={k}>
{n}
</option>
))}
</select>
</Select>
</label>
<label>
<span>{t("factory.serviceUrl")}</span>
<input value={c.url} placeholder={URL_PLACEHOLDER[c.kind]} onChange={(e) => upConn(i, { url: e.target.value })} />
<Input value={c.url} placeholder={URL_PLACEHOLDER[c.kind]} onChange={(e) => upConn(i, { url: e.target.value })} />
</label>
<label>
<span>{t("factory.token")}</span>
<input type="password" autoComplete="new-password" value={c.token} placeholder={t("factory.tokenPlaceholder")} onChange={(e) => upConn(i, { token: e.target.value })} onFocus={(e) => c.token.startsWith("•") && e.currentTarget.select()} />
<Input.Password autoComplete="new-password" value={c.token} placeholder={t("factory.tokenPlaceholder")} onChange={(e) => upConn(i, { token: e.target.value })} onFocus={(e) => c.token.startsWith("•") && e.currentTarget.select()} />
<span className="hint">{c.token.startsWith("•") ? t("factory.tokenSet") : t(`factory.tokenHint.${c.kind}` as any)}</span>
</label>
<label>
<span>{t("factory.defaultOwner")}</span>
<input list={`orgs-${c.id}`} value={c.owner} placeholder={t("draft.ownerPlaceholder")} onChange={(e) => upConn(i, { owner: e.target.value })} />
<Input list={`orgs-${c.id}`} value={c.owner} placeholder={t("draft.ownerPlaceholder")} onChange={(e) => upConn(i, { owner: e.target.value })} />
<datalist id={`orgs-${c.id}`}>
{(orgs[c.id] ?? []).map((o) => (
<option key={o} value={o} />
@@ -995,9 +993,9 @@ function FactorySettings() {
</div>
</div>
))}
<button onClick={() => setConns([...conns, blankConn()])}>
<Button onClick={() => setConns([...conns, blankConn()])}>
<Icon name="plus" /> {t("factory.addConn")}
</button>
</Button>
<h3 className="factory-h">{t("factory.defaults")}</h3>
<div className="hint" style={{ marginBottom: 8 }}>{t("factory.defaultsHint")}</div>
@@ -1020,12 +1018,10 @@ function FactorySettings() {
<h3 style={{ margin: 0 }}>{r.url ? repoName(r.url) : t("factory.newRepo")}</h3>
<span className="chip">{KIND_NAME[conns.find((c) => c.id === r.connection)?.kind ?? r.kind] ?? r.kind}</span>
<span className="spacer" />
<label className="switch">
<input type="checkbox" checked={r.enabled} onChange={(e) => up(i, { enabled: e.target.checked })} />
<Checkbox className="switch" checked={r.enabled} onChange={(e) => up(i, { enabled: e.target.checked })}>
<span>{t(r.enabled ? "jobs.on" : "jobs.off")}</span>
</label>
<button
className="small"
</Checkbox>
<Button size="small"
disabled={busy !== undefined}
onClick={() =>
act(`t${i}`, async () => {
@@ -1036,9 +1032,8 @@ function FactorySettings() {
}
>
{busy === `t${i}` ? <Spinner small /> : <Icon name="plug" />} {t("factory.test")}
</button>
<button
className="small"
</Button>
<Button size="small"
title={t("common.delete")}
aria-label={t("common.delete")}
onClick={async () => {
@@ -1046,12 +1041,12 @@ function FactorySettings() {
}}
>
<Icon name="trash" />
</button>
</Button>
</div>
<div className="factory-form">
<label>
<span>{t("factory.connection")}</span>
<select
<Select
value={r.connection}
onChange={(e) => up(i, { connection: e.target.value, kind: conns.find((c) => c.id === e.target.value)?.kind ?? r.kind })}
>
@@ -1063,44 +1058,44 @@ function FactorySettings() {
{c.name || KIND_NAME[c.kind]}
</option>
))}
</select>
</Select>
</label>
{!r.connection && (
<label>
<span>{t("factory.kind")}</span>
<select value={r.kind} onChange={(e) => up(i, { kind: e.target.value })}>
<Select value={r.kind} onChange={(e) => up(i, { kind: e.target.value })}>
{Object.entries(KIND_NAME).map(([k, n]) => (
<option key={k} value={k}>
{n}
</option>
))}
</select>
</Select>
</label>
)}
<label>
<span>{t("factory.url")}</span>
<input value={r.url} placeholder="https://host/owner/repo.git" onChange={(e) => up(i, { url: e.target.value })} />
<Input value={r.url} placeholder="https://host/owner/repo.git" onChange={(e) => up(i, { url: e.target.value })} />
</label>
<label>
<span>{t("factory.repoToken")}</span>
<input type="password" autoComplete="new-password" value={r.token} placeholder={t("factory.repoTokenPlaceholder")} onChange={(e) => up(i, { token: e.target.value })} onFocus={(e) => r.token.startsWith("•") && e.currentTarget.select()} />
<Input.Password autoComplete="new-password" value={r.token} placeholder={t("factory.repoTokenPlaceholder")} onChange={(e) => up(i, { token: e.target.value })} onFocus={(e) => r.token.startsWith("•") && e.currentTarget.select()} />
<span className="hint">{r.token.startsWith("•") ? t("factory.tokenSet") : t("factory.repoTokenHint")}</span>
</label>
<label>
<span>{t("factory.label")}</span>
<input value={r.label} onChange={(e) => up(i, { label: e.target.value })} />
<Input value={r.label} onChange={(e) => up(i, { label: e.target.value })} />
</label>
<label>
<span>{t("factory.parallel")}</span>
<input type="number" min={1} max={4} value={r.max_parallel} onChange={(e) => up(i, { max_parallel: Number(e.target.value) || 1 })} />
<Input type="number" min={1} max={4} value={r.max_parallel} onChange={(e) => up(i, { max_parallel: Number(e.target.value) || 1 })} />
</label>
<label>
<span>{t("factory.rework")}</span>
<input type="number" min={0} max={10} value={r.max_rework} title={t("factory.reworkHint")} onChange={(e) => up(i, { max_rework: Math.max(0, Number(e.target.value) || 0) })} />
<Input type="number" min={0} max={10} value={r.max_rework} title={t("factory.reworkHint")} onChange={(e) => up(i, { max_rework: Math.max(0, Number(e.target.value) || 0) })} />
</label>
<label>
<span>{t("factory.allowed")}</span>
<input value={r.allowed_users.join(", ")} placeholder={t("factory.allowedPlaceholder")} onChange={(e) => up(i, { allowed_users: e.target.value.split(",").map((u) => u.trim()).filter(Boolean) })} />
<Input value={r.allowed_users.join(", ")} placeholder={t("factory.allowedPlaceholder")} onChange={(e) => up(i, { allowed_users: e.target.value.split(",").map((u) => u.trim()).filter(Boolean) })} />
</label>
</div>
<div className="factory-phases">
@@ -1111,11 +1106,10 @@ function FactorySettings() {
</div>
))}
<div className="row" style={{ gap: 8, marginTop: 12 }}>
<button onClick={() => setRepos([...repos, blankRepo(conns.find((c) => c.id)?.id ?? "", conns.find((c) => c.id)?.kind ?? "gitea")])}>
<Button onClick={() => setRepos([...repos, blankRepo(conns.find((c) => c.id)?.id ?? "", conns.find((c) => c.id)?.kind ?? "gitea")])}>
<Icon name="plus" /> {t("factory.addRepo")}
</button>
<button
className="primary"
</Button>
<Button type="primary"
disabled={busy !== undefined}
onClick={() =>
act("save", async () => {
@@ -1125,7 +1119,7 @@ function FactorySettings() {
}
>
{busy === "save" ? <Spinner small /> : <Icon name="check" />} {t("common.save")}
</button>
</Button>
</div>
</>
);