Skip to content

Commit 2750c3b

Browse files
Wibiaslidge-jun
authored andcommitted
fix(gui): polish update modal close button, switch contrast, and command wrap
(cherry picked from commit 7750806)
1 parent afb011f commit 2750c3b

6 files changed

Lines changed: 107 additions & 8 deletions

File tree

‎gui/src/i18n/de.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ export const de = {
7676
"dash.updateSource": "Dies ist ein Source-Checkout. Aktualisiere es im Terminal mit dem angezeigten Befehl.",
7777
"dash.updateUnavailable": "Die neueste Version konnte nicht von npm gelesen werden. Versuche es später erneut.",
7878
"dash.updateRetry": "Wiederholen",
79+
"dash.updateRecheck": "Erneut prüfen",
80+
"dash.updateCannotAuto": "Ein-Klick-Update ist nicht verfügbar ({reason}).",
81+
"dash.updateReason.source_checkout": "Quellcode-Checkout",
82+
"dash.updateReason.latest_unavailable": "npm-Registry nicht erreichbar",
83+
"dash.updateReason.already_latest": "bereits auf dem neuesten Stand",
84+
"dash.updateReason.unknown": "Update nicht verfügbar",
7985
"dash.updateRestart": "Nach Update neu starten",
8086
"dash.updateRestartHint": "Empfohlen. Die aktuelle GUI läuft weiter mit altem Code, bis der Proxy neu startet.",
8187
"dash.runUpdate": "Aktualisieren",

‎gui/src/i18n/en.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ export const en = {
8080
"dash.updateSource": "This is a source checkout. Update it from the terminal with the shown command.",
8181
"dash.updateUnavailable": "Could not read the latest version from npm. Try again later.",
8282
"dash.updateRetry": "Retry",
83+
"dash.updateRecheck": "Re-check",
84+
"dash.updateCannotAuto": "One-click update is unavailable ({reason}).",
85+
"dash.updateReason.source_checkout": "source checkout",
86+
"dash.updateReason.latest_unavailable": "npm registry unreachable",
87+
"dash.updateReason.already_latest": "already on latest",
88+
"dash.updateReason.unknown": "update unavailable",
8389
"dash.updateRestart": "Restart after update",
8490
"dash.updateRestartHint": "Recommended. The current GUI keeps running the old code until the proxy restarts.",
8591
"dash.runUpdate": "Update",

‎gui/src/i18n/ko.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ export const ko: Record<TKey, string> = {
8080
"dash.updateSource": "현재는 소스 체크아웃입니다. 표시된 명령을 터미널에서 실행해 업데이트하세요.",
8181
"dash.updateUnavailable": "npm에서 최신 버전을 읽지 못했습니다. 잠시 후 다시 시도하세요.",
8282
"dash.updateRetry": "재시도",
83+
"dash.updateRecheck": "다시 확인",
84+
"dash.updateCannotAuto": "원클릭 업데이트를 사용할 수 없습니다 ({reason}).",
85+
"dash.updateReason.source_checkout": "소스 체크아웃",
86+
"dash.updateReason.latest_unavailable": "npm 레지스트리에 연결할 수 없음",
87+
"dash.updateReason.already_latest": "이미 최신 버전",
88+
"dash.updateReason.unknown": "업데이트 불가",
8389
"dash.updateRestart": "업데이트 후 재시작",
8490
"dash.updateRestartHint": "권장. 프록시를 재시작하기 전까지 현재 GUI는 이전 코드로 계속 실행됩니다.",
8591
"dash.runUpdate": "업데이트",

‎gui/src/i18n/zh.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ export const zh: Record<TKey, string> = {
8080
"dash.updateSource": "当前是源码检出。请在终端运行显示的命令进行更新。",
8181
"dash.updateUnavailable": "无法从 npm 读取最新版本。请稍后重试。",
8282
"dash.updateRetry": "重试",
83+
"dash.updateRecheck": "重新检查",
84+
"dash.updateCannotAuto": "无法一键更新({reason})。",
85+
"dash.updateReason.source_checkout": "源码检出",
86+
"dash.updateReason.latest_unavailable": "无法连接 npm 注册表",
87+
"dash.updateReason.already_latest": "已是最新版本",
88+
"dash.updateReason.unknown": "无法更新",
8389
"dash.updateRestart": "更新后重启",
8490
"dash.updateRestartHint": "推荐开启。代理重启前,当前 GUI 仍运行旧代码。",
8591
"dash.runUpdate": "更新",

‎gui/src/pages/Dashboard.tsx‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ function defaultUpdateChannel(version: string | undefined): UpdateChannel {
7373
return version?.includes("-preview.") ? "preview" : "latest";
7474
}
7575

76+
function updateReasonLabel(reason: string | undefined, t: (key: import("../i18n").TKey) => string): string {
77+
switch (reason) {
78+
case "source_checkout": return t("dash.updateReason.source_checkout");
79+
case "latest_unavailable": return t("dash.updateReason.latest_unavailable");
80+
case "already_latest": return t("dash.updateReason.already_latest");
81+
default: return t("dash.updateReason.unknown");
82+
}
83+
}
84+
7685
export default function Dashboard({ apiBase }: { apiBase: string }) {
7786
const { locale, t } = useI18n();
7887
const [health, setHealth] = useState<HealthData | null>(null);
@@ -700,7 +709,7 @@ export default function Dashboard({ apiBase }: { apiBase: string }) {
700709
<div className="modal-card">
701710
<div className="modal-head">
702711
<h3 id="update-title">{t("dash.updateTitle")}</h3>
703-
<button type="button" className="btn-icon" onClick={closeUpdateDialog} aria-label={t("common.cancel")}>
712+
<button type="button" className="btn btn-ghost btn-icon" onClick={closeUpdateDialog} aria-label={t("common.cancel")}>
704713
<IconX />
705714
</button>
706715
</div>
@@ -752,6 +761,21 @@ export default function Dashboard({ apiBase }: { apiBase: string }) {
752761
</button>
753762
</div>
754763
)}
764+
{!updateCheck.canUpdate && updateCheck.reason !== "latest_unavailable" && updateCheck.reason !== "source_checkout" && (
765+
<div className="update-recheck">
766+
<span className="muted update-recheck-reason">
767+
{t("dash.updateCannotAuto", { reason: updateReasonLabel(updateCheck.reason, t) })}
768+
</span>
769+
<button
770+
type="button"
771+
className="btn btn-ghost btn-sm"
772+
disabled={updateLoading}
773+
onClick={() => { void fetchUpdateCheck(updateChannel, true); }}
774+
>
775+
<IconRefresh /> {updateLoading ? t("dash.updateChecking") : t("dash.updateRecheck")}
776+
</button>
777+
</div>
778+
)}
755779
{updateCheck.canUpdate && (
756780
<div className="spread update-restart">
757781
<div>
@@ -791,7 +815,7 @@ export default function Dashboard({ apiBase }: { apiBase: string }) {
791815
<div className="modal-card" onClick={e => e.stopPropagation()}>
792816
<div className="modal-head">
793817
<h3>{t("dash.multiAgent")}</h3>
794-
<button type="button" className="btn btn-ghost btn-sm" onClick={() => setMaHelpOpen(false)} aria-label="Close">&times;</button>
818+
<button type="button" className="btn btn-ghost btn-icon" onClick={() => setMaHelpOpen(false)} aria-label="Close"><IconX /></button>
795819
</div>
796820
<div className="modal-desc" style={{ whiteSpace: "pre-line", lineHeight: 1.6 }}>
797821
{t("models.v2Help")}

‎gui/src/styles.css‎

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,26 @@ input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
205205
.btn-danger { background: transparent; color: var(--red); border-color: rgba(248, 113, 113, 0.3); }
206206
.btn-danger:hover:not(:disabled) { background: var(--red-soft); }
207207
.btn-sm { padding: 4px 12px; font-size: 12px; border-radius: var(--radius-pill); }
208-
.btn-icon { padding: 5px; color: var(--muted); border-radius: var(--radius-sm); transition: background 0.12s, color 0.12s; }
208+
.btn-icon {
209+
appearance: none;
210+
border: none;
211+
background: transparent;
212+
font: inherit;
213+
cursor: pointer;
214+
display: inline-flex;
215+
align-items: center;
216+
justify-content: center;
217+
width: 28px;
218+
height: 28px;
219+
padding: 0;
220+
color: var(--muted);
221+
border-radius: var(--radius-sm);
222+
transition: background 0.12s, color 0.12s;
223+
}
209224
.btn-icon:hover { background: var(--raised-hover); color: var(--text); }
225+
.btn-icon:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 1px; }
226+
.btn-icon svg { width: 16px; height: 16px; display: block; }
227+
.btn.btn-ghost.btn-icon { width: 28px; height: 28px; padding: 0; }
210228

211229
/* ---- cards / panels ---- */
212230
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
@@ -242,7 +260,19 @@ input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
242260
.update-row .field-label { margin: 0; }
243261
.update-empty { padding: 18px; margin-bottom: 14px; }
244262
.update-box { display: flex; flex-direction: column; gap: 12px; }
245-
.update-command { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
263+
.update-command { display: flex; align-items: flex-start; gap: 6px; flex-wrap: wrap; font-size: 12px; }
264+
.update-command .chip {
265+
max-width: 100%;
266+
min-width: 0;
267+
flex: 1 1 auto;
268+
white-space: pre-wrap;
269+
word-break: break-all;
270+
overflow-wrap: anywhere;
271+
line-height: 1.5;
272+
}
273+
.update-recheck { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
274+
.update-recheck .btn { flex: 0 0 auto; }
275+
.update-recheck-reason { flex: 1 1 200px; min-width: 0; font-size: 12px; color: var(--muted); }
246276
.update-restart { border-top: 1px solid var(--border-soft); padding-top: 12px; }
247277
.injection-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
248278
.injection-label { font-weight: 650; }
@@ -376,11 +406,32 @@ select.input { appearance: none; }
376406
.select-option.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
377407

378408
/* ---- switch ---- */
379-
.switch { width: 34px; height: 19px; border-radius: 99px; border: none; cursor: pointer; background: light-dark(#c5c9d2, #3a3f4b); position: relative; flex-shrink: 0; transition: background 0.15s; padding: 0; }
380-
.switch.on { background: var(--accent); }
409+
.switch {
410+
width: 34px;
411+
height: 19px;
412+
border-radius: 99px;
413+
border: 1px solid var(--border);
414+
cursor: pointer;
415+
background: var(--raised);
416+
position: relative;
417+
flex-shrink: 0;
418+
transition: background 0.15s, border-color 0.15s;
419+
padding: 0;
420+
}
421+
.switch.on { background: var(--accent); border-color: var(--accent); }
381422
.switch:disabled { opacity: 0.6; cursor: default; }
382-
.switch .knob { position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.3); transition: left 0.15s; }
383-
.switch.on .knob { left: 17px; }
423+
.switch .knob {
424+
position: absolute;
425+
top: 2px;
426+
left: 2px;
427+
width: 15px;
428+
height: 15px;
429+
border-radius: 50%;
430+
background: light-dark(#ffffff, #ececec);
431+
box-shadow: 0 1px 2px rgba(16, 24, 40, 0.3);
432+
transition: left 0.15s, background 0.15s;
433+
}
434+
.switch.on .knob { left: 17px; background: var(--accent-ink); }
384435

385436
/* ---- misc ---- */
386437
.muted { color: var(--muted); }

0 commit comments

Comments
 (0)