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:
1 parent
90b9ab6670
commit
6b1a1742b2
79 files changed
+2628
-1393
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import { Button, Checkbox, Input, Segmented } from "antd";
|
||||
import { Select } from "../ui/Select";
|
||||
import { Icon } from "./Icon";
|
||||
import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";
|
||||
import { post } from "../api";
|
||||
@@ -353,9 +355,9 @@ export function NewSession({ onMenu, onCreated }: { onMenu: () => void; onCreate
|
||||
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("new.title")}</h1>
|
||||
</div>
|
||||
@@ -433,9 +435,9 @@ export function NewSession({ onMenu, onCreated }: { onMenu: () => void; onCreate
|
||||
<i style={{ width: `${Math.round(progress[f.name] * 100)}%` }} />
|
||||
</span>
|
||||
) : (
|
||||
<button className="small ghost" onClick={() => setOriginals((c) => c.filter((_, j) => j !== i))} aria-label={t("common.remove")}>
|
||||
<Button type="text" size="small" onClick={() => setOriginals((c) => c.filter((_, j) => j !== i))} aria-label={t("common.remove")}>
|
||||
<Icon name="close" />
|
||||
</button>
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
@@ -446,7 +448,7 @@ export function NewSession({ onMenu, onCreated }: { onMenu: () => void; onCreate
|
||||
|
||||
<Step n={n++} title={t("wizard.sayWhat")}>
|
||||
{needsUrl && (
|
||||
<input
|
||||
<Input
|
||||
className="wiz-url"
|
||||
type="url"
|
||||
value={url}
|
||||
@@ -462,7 +464,7 @@ export function NewSession({ onMenu, onCreated }: { onMenu: () => void; onCreate
|
||||
void addFiles(e.dataTransfer.files);
|
||||
}}
|
||||
>
|
||||
<textarea
|
||||
<Input.TextArea
|
||||
value={text}
|
||||
placeholder={t(task === "craft" ? (`wizard.placeholder.${target}` as Key) : task === "cad" ? "wizard.placeholder.cad" : task === "chat" ? "wizard.placeholder.chat" : "wizard.placeholder.task")}
|
||||
onChange={(e) => setText(e.target.value)}
|
||||
@@ -484,26 +486,26 @@ export function NewSession({ onMenu, onCreated }: { onMenu: () => void; onCreate
|
||||
{images.map((img, i) => (
|
||||
<div className="att" key={`i${i}`}>
|
||||
<img src={imageSrc(img)} alt="" />
|
||||
<button onClick={() => setImages((c) => c.filter((_, j) => j !== i))} aria-label={t("common.remove")}>
|
||||
<Button onClick={() => setImages((c) => c.filter((_, j) => j !== i))} aria-label={t("common.remove")}>
|
||||
<Icon name="close" />
|
||||
</button>
|
||||
</Button>
|
||||
</div>
|
||||
))}
|
||||
{files.map((f, i) => (
|
||||
<div className="att file" key={`f${i}`}>
|
||||
<span><Icon name="file" /> {f.name}</span>
|
||||
<small>{formatSize(f.size)}</small>
|
||||
<button onClick={() => setFiles((c) => c.filter((_, j) => j !== i))} aria-label={t("common.remove")}>
|
||||
<Button onClick={() => setFiles((c) => c.filter((_, j) => j !== i))} aria-label={t("common.remove")}>
|
||||
<Icon name="close" />
|
||||
</button>
|
||||
</Button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<div className="wiz-input-foot">
|
||||
<button type="button" className="ghost small" onClick={() => fileInput.current?.click()} title={t("wizard.attach")}>
|
||||
<Button type="text" size="small" onClick={() => fileInput.current?.click()} title={t("wizard.attach")}>
|
||||
{ICONS.clip}
|
||||
</button>
|
||||
</Button>
|
||||
<span>{target === "software" && task === "craft" ? t("wizard.softwareHint") : t("wizard.enterHint")}</span>
|
||||
<input ref={fileInput} type="file" multiple hidden onChange={(e) => e.target.files && void addFiles(e.target.files)} />
|
||||
</div>
|
||||
@@ -512,9 +514,9 @@ export function NewSession({ onMenu, onCreated }: { onMenu: () => void; onCreate
|
||||
<div className="wiz-ideas">
|
||||
<span>{t("wizard.ideas")}</span>
|
||||
{ideas.map((k) => (
|
||||
<button key={k} type="button" className="chip-btn" onClick={() => setText(t(k))}>
|
||||
<Button key={k} size="small" shape="round" onClick={() => setText(t(k))}>
|
||||
{t(k)}
|
||||
</button>
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
@@ -536,7 +538,7 @@ export function NewSession({ onMenu, onCreated }: { onMenu: () => void; onCreate
|
||||
))}
|
||||
</div>
|
||||
{folderMode === "git" && (
|
||||
<input className="wiz-url" value={repoUrl} placeholder="https://git.example.com/user/repo.git" onChange={(e) => setRepoUrl(e.target.value)} />
|
||||
<Input className="wiz-url" value={repoUrl} placeholder="https://git.example.com/user/repo.git" onChange={(e) => setRepoUrl(e.target.value)} />
|
||||
)}
|
||||
{folderMode !== "existing" && (
|
||||
<div className="wiz-folder">
|
||||
@@ -544,18 +546,18 @@ export function NewSession({ onMenu, onCreated }: { onMenu: () => void; onCreate
|
||||
<span className="wiz-folder-text">
|
||||
{t(folderMode === "git" ? "wizard.cloneInto" : "wizard.newFolderIn")}{" "}
|
||||
{roots.length > 1 ? (
|
||||
<select value={rootPath} onChange={(e) => setRootPath(e.target.value)}>
|
||||
<Select value={rootPath} onChange={(e) => setRootPath(e.target.value)}>
|
||||
{roots.map((r) => (
|
||||
<option key={r.path} value={r.path}>
|
||||
{r.name === "/" ? "workspace" : r.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Select>
|
||||
) : (
|
||||
<code>{!roots[0] || roots[0].name === "/" ? "workspace" : roots[0].name}</code>
|
||||
)}
|
||||
<span>/</span>
|
||||
<input
|
||||
<Input
|
||||
className="wiz-folder-name"
|
||||
value={folderName}
|
||||
onChange={(e) => {
|
||||
@@ -568,22 +570,21 @@ export function NewSession({ onMenu, onCreated }: { onMenu: () => void; onCreate
|
||||
)}
|
||||
{folderMode === "existing" && <FolderPicker path={picked} onPick={setPicked} />}
|
||||
{folderMode !== "new" && (
|
||||
<label className="wiz-check-row">
|
||||
<input type="checkbox" checked={isolated} onChange={(e) => setIsolated(e.target.checked)} />
|
||||
<Checkbox className="wiz-check-row" checked={isolated} onChange={(e) => setIsolated(e.target.checked)}>
|
||||
<span>
|
||||
<b>{t("worktree.isolate")}</b>
|
||||
<span className="hint"> – {t("worktree.isolateHint")}</span>
|
||||
</span>
|
||||
</label>
|
||||
</Checkbox>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{error && <div className="notice err">{error}</div>}
|
||||
<div className="wiz-start-row">
|
||||
<button className="primary wiz-start" disabled={!canStart} onClick={create}>
|
||||
<Button type="primary" className="wiz-start" disabled={!canStart} onClick={create}>
|
||||
{ICONS.start}
|
||||
{creating ?? t("wizard.start")}
|
||||
</button>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -624,37 +625,37 @@ export function FolderPicker({ path, onPick }: { path: string; onPick: (p: strin
|
||||
return (
|
||||
<div className="wiz-picker">
|
||||
{roots.length > 1 && (
|
||||
<div className="mode-tabs" style={{ marginBottom: 8, flexWrap: "wrap" }}>
|
||||
{roots.map((r) => (
|
||||
<button key={r.path} className={listing?.root === r.path ? "active" : ""} onClick={() => setBrowse(r.path)}>
|
||||
{r.name}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<Segmented
|
||||
className="seg-wrap"
|
||||
style={{ marginBottom: 8 }}
|
||||
value={listing?.root ?? ""}
|
||||
onChange={(path) => setBrowse(path)}
|
||||
options={roots.map((r) => ({ value: r.path, label: r.name }))}
|
||||
/>
|
||||
)}
|
||||
<div className="row" style={{ marginBottom: 8 }}>
|
||||
<code className="grow" style={{ flex: 1 }}>
|
||||
{rel}
|
||||
</code>
|
||||
{listing?.parent && (
|
||||
<button className="small" onClick={() => setBrowse(listing.parent!)}>
|
||||
<Button size="small" onClick={() => setBrowse(listing.parent!)}>
|
||||
<Icon name="arrow-up" /> {t("new.up")}
|
||||
</button>
|
||||
</Button>
|
||||
)}
|
||||
{listing && (
|
||||
<button className="small" onClick={() => void newFolder()}>
|
||||
<Button size="small" onClick={() => void newFolder()}>
|
||||
<Icon name="plus" /> {t("files.newFolder")}
|
||||
</button>
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
<div className="dir-list">
|
||||
{listing?.dirs.length === 0 && <div className="empty" style={{ padding: 16 }}>{t("new.noSubdirs")}</div>}
|
||||
{listing?.dirs.map((d) => (
|
||||
<button key={d.path} onClick={() => setBrowse(d.path)}>
|
||||
<Button key={d.path} onClick={() => setBrowse(d.path)}>
|
||||
{ICONS.folder}
|
||||
<span style={{ flex: 1 }}>{d.name}</span>
|
||||
{d.git && <span className="chip">git</span>}
|
||||
</button>
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user