v0.3.3 — minimize the transfer dialog to a floating chip (keeps running)

- Submit/Get-Latest progress dialog can be minimized to a small bottom-right
  chip (like the .sln build chip). Shows op + N/total + % + a thin progress bar;
  click to expand. Submit keeps a Cancel button on the chip.
- The transfer runs in the backend regardless, so minimizing never interrupts it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Bonchellon
2026-07-08 23:08:21 +03:00
parent 3954082e8d
commit 1c1153eee9
7 changed files with 68 additions and 13 deletions

View File

@ -384,6 +384,7 @@ function Workbench({ info, session, light, toggleTheme, lang, setLang, zoom, set
const [pending, setPending] = useState<Change[]>([]); // committed-but-not-pushed changelists
const [transfer, setTransfer] = useState<Transfer | null>(null); // live sync/submit file transfer
const [commitProg, setCommitProg] = useState<{ count: number; total: number } | null>(null); // live commit (reopen) progress
const [xferMin, setXferMin] = useState(false); // transfer dialog collapsed to a floating chip (keeps running)
const [showXfer, setShowXfer] = useState(false); // delayed so fast ops don't flash a dialog
const [uproject, setUproject] = useState(""); // local .uproject path when the scope is a UE project
const [slnPath, setSlnPath] = useState(""); // local .sln path in the scope (for building)
@ -626,7 +627,7 @@ function Workbench({ info, session, light, toggleTheme, lang, setLang, zoom, set
let un: (() => void) | undefined; let dead = false;
listen<{ op: "sync" | "submit"; count: number; total?: number; file?: string; done: boolean; cancelled?: boolean }>("p4-transfer", (e) => {
const p = e.payload;
if (p.done) { setTransfer(null); return; }
if (p.done) { setTransfer(null); setXferMin(false); return; }
setTransfer((prev) => {
const log = prev ? prev.log : [];
const next = p.file && (log.length === 0 || log[log.length - 1] !== p.file)
@ -1687,7 +1688,8 @@ function Workbench({ info, session, light, toggleTheme, lang, setLang, zoom, set
{resolveOpen && <ResolveModal files={needResolve} onResolve={doResolve} onClose={() => setResolveOpen(false)} />}
{ask && <ConfirmModal {...ask} onClose={(v) => { ask.resolve(v); setAsk(null); }} />}
{prompt && <TextPrompt title={prompt.title} label={prompt.label} value={prompt.value} onSave={prompt.onSave} onClose={() => setPrompt(null)} />}
{showXfer && transfer && <TransferDialog transfer={transfer} onCancel={cancelTransfer} />}
{showXfer && transfer && !xferMin && <TransferDialog transfer={transfer} onCancel={cancelTransfer} onMinimize={() => setXferMin(true)} />}
{showXfer && transfer && xferMin && <TransferChip transfer={transfer} onExpand={() => setXferMin(false)} onCancel={cancelTransfer} />}
{buildPick && <BuildPicker onPick={buildSln} onClose={() => setBuildPick(false)} />}
{buildOpen && !buildMin && <BuildOverlay lines={buildLog} building={building} ok={buildOk} sln={slnPath} onMinimize={() => setBuildMin(true)} onClose={() => setBuildOpen(false)} />}
{buildOpen && buildMin && <BuildChip building={building} ok={buildOk} onExpand={() => setBuildMin(false)} onClose={() => setBuildOpen(false)} />}
@ -2123,7 +2125,7 @@ function UnrealTab({ uproject }: { uproject: string }) {
}
/* ---------------- server transfer progress (P4V-style) ---------------- */
function TransferDialog({ transfer, onCancel }: { transfer: Transfer; onCancel: () => void }) {
function TransferDialog({ transfer, onCancel, onMinimize }: { transfer: Transfer; onCancel: () => void; onMinimize: () => void }) {
const up = transfer.op === "submit";
const total = transfer.total || 0;
const pct = total > 0 ? Math.min(100, Math.round((transfer.count / total) * 100)) : 0;
@ -2144,12 +2146,17 @@ function TransferDialog({ transfer, onCancel }: { transfer: Transfer; onCancel:
? `${transfer.count.toLocaleString()} / ${total.toLocaleString()} · ${pct}%`
: t("{n} files", { n: transfer.count })}</span>
</div>
{up && (
<button className="xfer-cancel" onClick={onCancel} disabled={transfer.cancelling}
title={t("Stop before the server commit. Files already sent are not applied; the changelist stays pending.")}>
{transfer.cancelling ? t("Cancelling") : t("Cancel")}
<div className="xfer-actions">
{up && (
<button className="xfer-cancel" onClick={onCancel} disabled={transfer.cancelling}
title={t("Stop before the server commit. Files already sent are not applied; the changelist stays pending.")}>
{transfer.cancelling ? t("Cancelling…") : t("Cancel")}
</button>
)}
<button className="xfer-min" onClick={onMinimize} title={t("Minimize — the transfer keeps running in the background")}>
<svg viewBox="0 0 24 24" fill="none"><path d="M5 12h14" stroke="currentColor" strokeWidth="2" strokeLinecap="round" /></svg>
</button>
)}
</div>
</div>
<div className={"xfer-bar" + (total > 0 ? " det" : "")}>
<span style={total > 0 ? { width: pct + "%" } : undefined} />
@ -2162,6 +2169,30 @@ function TransferDialog({ transfer, onCancel }: { transfer: Transfer; onCancel:
);
}
/* minimized transfer indicator — small floating chip; the transfer keeps running.
Click to expand back to the full dialog. */
function TransferChip({ transfer, onExpand, onCancel }: { transfer: Transfer; onExpand: () => void; onCancel: () => void }) {
const up = transfer.op === "submit";
const total = transfer.total || 0;
const pct = total > 0 ? Math.min(100, Math.round((transfer.count / total) * 100)) : 0;
return (
<div className={"xferchip" + (up ? " up" : " down")} onClick={onExpand} title={t("Expand")}>
<span className="xc-ic"><span className="ldr sm" /></span>
<span className="xc-txt">
<b>{up ? t("Submitting") : t("Getting latest")}</b>
<span>{total > 0 ? `${transfer.count.toLocaleString()} / ${total.toLocaleString()} · ${pct}%` : t("{n} files", { n: transfer.count })}</span>
</span>
{up && (
<button className="xc-cancel" disabled={transfer.cancelling} title={t("Cancel")}
onClick={(e) => { e.stopPropagation(); onCancel(); }}>
<svg viewBox="0 0 24 24" width="12" height="12" fill="none"><path d="M6 6l12 12M18 6L6 18" stroke="currentColor" strokeWidth="1.9" strokeLinecap="round" /></svg>
</button>
)}
{total > 0 && <span className="xc-bar"><span style={{ width: pct + "%" }} /></span>}
</div>
);
}
/* ---------------- build output (MSBuild) ---------------- */
function BuildOverlay({ lines, building, ok, sln, onMinimize, onClose }: { lines: string[]; building: boolean; ok: boolean | null; sln: string; onMinimize: () => void; onClose: () => void }) {
const ref = useRef<HTMLDivElement>(null);