From eb5edcedc7b41e3c91cfb590c3b1004775c83692 Mon Sep 17 00:00:00 2001 From: yetone Date: Mon, 5 Oct 2026 02:12:51 +0800 Subject: [PATCH] =?UTF-8?q?gui:=20a=20failed=20check-in's=20reason=20wraps?= =?UTF-8?q?=20on=20its=20card=20rather=20than=20ending=20in=20=E2=80=A6=20?= =?UTF-8?q?(#821,=20#808)=20=E2=80=94=20the=20Trae=20CN=20card's=20?= =?UTF-8?q?=E7=AD=BE=E5=88=B0=E5=A4=B1=E8=B4=A5=EF=BC=8Cmagpie=20=E7=A8=8D?= =?UTF-8?q?=E5=90=8E=E9=87=8D=E8=AF=95=20=C2=B7=20=20was=20one=20l?= =?UTF-8?q?ine=20cut=20with=20an=20ellipsis,=20so=20the=20reason=20after?= =?UTF-8?q?=20=C2=B7=20didn't=20show=20in=20the=20reporter's=20screenshot?= =?UTF-8?q?=20(only=20in=20the=20tooltip).=20A=20failed=20row=20now=20wrap?= =?UTF-8?q?s:=20the=20reason=20flows=20onto=20the=20next=20lines=20and=20t?= =?UTF-8?q?he=20Auto=20check-in=20/=20Check=20in=20now=20buttons=20go=20be?= =?UTF-8?q?side=20or=20under=20it.=20usage-quota-head.test.cjs=20asserts?= =?UTF-8?q?=20the=20reason=20isn't=20clipped=20(a=20long=209074=20message)?= =?UTF-8?q?,=20failing=20on=20the=20old=20CSS;=20it=20and=20usage-checkin.?= =?UTF-8?q?test.cjs=20pass=20on=20WebKit,=20en=20and=20zh;=20looked=20at?= =?UTF-8?q?=20in=20a=20screenshot.=20go=20vet,=20builds=20(darwin,=20GOOS?= =?UTF-8?q?=3Dlinux=20nogui,=20GOOS=3Dwindows)=20and=20go=20test=20-tags?= =?UTF-8?q?=20nogui=20./internal/gui/=20under=20a=20temp=20HOME=20pass.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/gui/assets/app.css | 5 +++++ internal/gui/tests/usage-quota-head.test.cjs | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css index f58c430b..07d74352 100644 --- a/internal/gui/assets/app.css +++ b/internal/gui/assets/app.css @@ -633,6 +633,11 @@ body.window .field.solo { grid-column: auto; } .wb-checkin { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; } .wb-checkin .ci-say { display: inline-flex; align-items: center; gap: 6px; min-width: 0; } .wb-checkin .ci-say > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +/* a failed check-in's reason wraps under it rather than ending in "…" (#821) */ +.wb-checkin[data-state="bad"] { flex-wrap: wrap; align-items: flex-start; } +.wb-checkin[data-state="bad"] .ci-say { flex: 1 1 180px; align-items: flex-start; } +.wb-checkin[data-state="bad"] .ci-say > span { white-space: normal; overflow-wrap: anywhere; } +.wb-checkin[data-state="bad"] .ci-dot { margin-top: 4px; } .wb-checkin .ci-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); } .wb-checkin .ci-dot.ok { background: var(--green); } .wb-checkin .ci-dot.bad { background: var(--red); } diff --git a/internal/gui/tests/usage-quota-head.test.cjs b/internal/gui/tests/usage-quota-head.test.cjs index 1c57507d..7f29035d 100644 --- a/internal/gui/tests/usage-quota-head.test.cjs +++ b/internal/gui/tests/usage-quota-head.test.cjs @@ -17,7 +17,7 @@ const today = new Date(Date.now() + 8 * 3600e3).toISOString().slice(0, 10); const quotas = [ { provider: "codex", name: "Codex", icon: "openai", plan: "Plus", windows: [{ name: "5 hours", used: 20 }] }, { provider: "trae-cn", name: "Trae CN", plan: "Free", user: "hu", windows: [{ name: "Credits", used: 3 }], - checkins: true, checkinBy: "trae", checkin: { user: "hu", day: today, outcome: "failed", msg: "code 9074: 当前参与用户太多" } }, + checkins: true, checkinBy: "trae", checkin: { user: "hu", day: today, outcome: "failed", msg: "code 9074: 当前参与用户太多,请稍后再试(今日签到人数较多,活动火爆,请耐心等待)" } }, ]; function serve(lang, gate) { @@ -58,7 +58,10 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await head.waitFor(); // the failed check-in's reason is in the row const say = (await page.locator(".wb-checkin .ci-say").innerText()).trim(); - assert.equal(say, (lang === "en" ? "Check-in failed; magpie tries again later" : "签到失败,magpie 稍后重试") + " · code 9074: 当前参与用户太多"); + assert.equal(say, (lang === "en" ? "Check-in failed; magpie tries again later" : "签到失败,magpie 稍后重试") + " · code 9074: 当前参与用户太多,请稍后再试(今日签到人数较多,活动火爆,请耐心等待)"); + // and all of it is seen, not cut off with "…" (#821) + const clipped = await page.locator(".wb-checkin .ci-say > span").evaluate((s) => s.scrollWidth > s.clientWidth + 1 || s.getBoundingClientRect().right > s.closest(".subscription-card").getBoundingClientRect().right); + assert.equal(clipped, false, "the check-in's reason is cut off"); // away and back, with the vendors and the log both slow to answer let free;