Factory: project dropdown
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c5572cad54
commit
e1baf6f00f
6 files changed
+58
-12
No files matched your search
@@ -3,6 +3,12 @@
|
||||
All notable changes to CodeCraft. Versions follow [Semantic Versioning](https://semver.org/);
|
||||
until 1.0, minor versions may contain breaking changes.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
|
||||
- **Factory: project dropdown** instead of one button per project – choose "All projects" or a single one; the choice is remembered.
|
||||
|
||||
## [v202611-00060] – 2026-11-18
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -170,7 +170,19 @@ export function Factory({ onMenu }: { onMenu: () => void }) {
|
||||
function FactoryOverview({ onSettings }: { onSettings: () => void }) {
|
||||
const t = useT();
|
||||
const [data, setData] = useState<Overview>();
|
||||
const [repo, setRepo] = useState<string>("");
|
||||
const [repo, setRepoState] = useState<string>(() => {
|
||||
try {
|
||||
return localStorage.getItem("codecraft.factoryRepo") ?? "";
|
||||
} catch {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
const setRepo = (r: string) => {
|
||||
setRepoState(r);
|
||||
try {
|
||||
localStorage.setItem("codecraft.factoryRepo", r);
|
||||
} catch {}
|
||||
};
|
||||
const [sel, setSel] = useState<string>("");
|
||||
const [now, setNow] = useState(Date.now());
|
||||
const [busy, setBusy] = useState(false);
|
||||
@@ -189,6 +201,11 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
|
||||
return () => clearInterval(h);
|
||||
}, []);
|
||||
|
||||
// A remembered project that no longer exists falls back to "all".
|
||||
useEffect(() => {
|
||||
if (data && repo && !data.repos.some((r) => r.url === repo)) setRepo("");
|
||||
}, [data, repo]);
|
||||
|
||||
const newProject = async () => {
|
||||
setBusy(true);
|
||||
try {
|
||||
@@ -383,26 +400,33 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
|
||||
</div>
|
||||
|
||||
<div className="factory-repos">
|
||||
<button className={`factory-repo ${repo === "" ? "active" : ""}`} onClick={() => setRepo("")}>
|
||||
<b>{t("factory.allRepos")}</b>
|
||||
<span className="hint">{t("factory.kpi.issues", { n: data.issues.length })}</span>
|
||||
</button>
|
||||
{data.repos.map((r) => {
|
||||
const mine = data.issues.filter((i) => i.repo === r.url);
|
||||
<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>
|
||||
{data.repos.map((r) => (
|
||||
<option key={r.url} value={r.url}>
|
||||
{repoName(r.url)}
|
||||
{r.version ? ` · v${r.version}` : ""} ({data.issues.filter((i) => i.repo === r.url).length}){r.enabled ? "" : " – off"}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{(() => {
|
||||
const r = data.repos.find((x) => x.url === repo);
|
||||
if (!r) return null;
|
||||
return (
|
||||
<button key={r.url} className={`factory-repo ${repo === r.url ? "active" : ""} ${r.enabled ? "" : "off"}`} onClick={() => setRepo(r.url)}>
|
||||
<b>{repoName(r.url)}</b>
|
||||
<span className="factory-repo-info">
|
||||
<span className="chip">{KIND_NAME[r.kind] ?? r.kind}</span>
|
||||
{r.version && <span className="chip ok mono">v{r.version}</span>}
|
||||
<span className="hint">
|
||||
{r.running > 0 && <span className="factory-pulse" />}
|
||||
{t("factory.repoLine", { n: mine.length, run: r.running })}
|
||||
{t("factory.repoLine", { n: data.issues.filter((i) => i.repo === r.url).length, run: r.running })}
|
||||
</span>
|
||||
<span className="hint mono">{PHASES.map((p) => r.models[p] || "·").map((m) => m.split("/").pop()).join(" → ")}</span>
|
||||
{!r.has_token && <span className="chip warn">{t("factory.noToken")}</span>}
|
||||
</button>
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
})()}
|
||||
<button className="small primary" onClick={newProject} disabled={busy}>
|
||||
<Icon name="plus" /> {t("factory.newProject")}
|
||||
</button>
|
||||
|
||||
@@ -1324,6 +1324,7 @@ export const de: Messages = {
|
||||
"factory.test": "Verbindung testen",
|
||||
"factory.testOk": "Verbunden als {login} mit {repo}; {n} Labels angelegt, Repository geklont.",
|
||||
"factory.deleteConfirm": "{name} aus der Factory entfernen? Issues und Chats bleiben.",
|
||||
"factory.project": "Projekt",
|
||||
"factory.newProject": "Neues Projekt",
|
||||
"factory.connections": "Verbindungen",
|
||||
"factory.connectionsHint": "Deine Konten bei Gitea, GitHub oder GitLab. Jeder Nutzer richtet seine eigenen ein; Repositories nutzen den Token ihrer Verbindung, sofern sie keinen eigenen haben.",
|
||||
|
||||
@@ -1323,6 +1323,7 @@ export const en = {
|
||||
"factory.test": "Test connection",
|
||||
"factory.testOk": "Connected as {login} to {repo}; {n} labels created, repository cloned.",
|
||||
"factory.deleteConfirm": "Remove {name} from the factory? Issues and chats stay.",
|
||||
"factory.project": "Project",
|
||||
"factory.newProject": "New project",
|
||||
"factory.connections": "Connections",
|
||||
"factory.connectionsHint": "Your accounts at Gitea, GitHub or GitLab. Each user sets up their own; repositories use the token of their connection unless they have a token of their own.",
|
||||
|
||||
@@ -5044,6 +5044,16 @@ td.fold-indent {
|
||||
margin-bottom: 14px;
|
||||
align-items: stretch;
|
||||
}
|
||||
.factory-repo-select {
|
||||
min-width: 220px;
|
||||
max-width: 100%;
|
||||
}
|
||||
.factory-repo-info {
|
||||
display: inline-flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.factory-repo {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
* under "unreleased"; scripts/release.sh renames the key to the release version.
|
||||
*/
|
||||
export const WHATS_NEW: Record<string, { en: string[]; de: string[] }> = {
|
||||
unreleased: {
|
||||
en: ["Factory: projects are chosen from a dropdown (all projects or a single one)"],
|
||||
de: ["Factory: Projekte werden per Dropdown gewählt (alle oder nur eins)"],
|
||||
},
|
||||
"202611-00060": {
|
||||
en: ["Uploads are chunked everywhere and show progress per file and in total", "Factory: recreate mode – analyse existing software in depth and rebuild it clean-room from a specification with milestones"],
|
||||
de: ["Uploads laufen überall in Teilen und zeigen den Fortschritt je Datei und gesamt", "Factory: Nachbau-Modus – bestehende Software bis ins Detail analysieren und Cleanroom aus einer Spezifikation mit Meilensteinen neu bauen"],
|
||||
|
||||
Reference in new issue
Block a user