From 54945c94bff16071f7447a08546d0536a741ef5c Mon Sep 17 00:00:00 2001 From: DanS Date: Fri, 10 Jul 2026 17:37:12 -0500 Subject: [PATCH] refine(daemon-update): version cards show a text label + the icon badge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bring back the small status label next to the tag (installed / pre-release / latest), colored to match, alongside the right-aligned icon badge — both keyed to the same status. The label is bounded so it never overruns the icon. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/ui/windows/daemon_download_dialog.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/ui/windows/daemon_download_dialog.h b/src/ui/windows/daemon_download_dialog.h index 3ae1497..24115e7 100644 --- a/src/ui/windows/daemon_download_dialog.h +++ b/src/ui/windows/daemon_download_dialog.h @@ -272,21 +272,30 @@ private: mdl->AddRectFilled(rmn, rmx, fill, round); if (sel) mdl->AddRect(rmn, rmx, WithAlpha(Primary(), 150), round, 0, 1.6f * dp); if (hov || held) ImGui::SetMouseCursor(ImGuiMouseCursor_Hand); - // Right-aligned status icon badge — active (installed), pre-release, or newest. - const char* ico = nullptr; ImU32 icoC = 0; const char* tt = nullptr; - if (r.installed) { ico = ICON_MD_CHECK_CIRCLE; icoC = Success(); tt = TR("daemon_update_active_tt"); } - else if (r.prerelease) { ico = ICON_MD_SCIENCE; icoC = Warning(); tt = TR("daemon_update_prerelease_tt"); } - else if (i == 0) { ico = ICON_MD_NEW_RELEASES; icoC = Primary(); tt = TR("daemon_update_latest_tt"); } + // Status — one of active (installed), pre-release, or newest — shown as a small text + // label next to the tag AND a matching right-aligned icon badge. + const char* ico = nullptr; ImU32 statusC = 0; const char* tt = nullptr; const char* lbl = nullptr; + if (r.installed) { ico = ICON_MD_CHECK_CIRCLE; statusC = Success(); tt = TR("daemon_update_active_tt"); lbl = TR("upd_installed_badge"); } + else if (r.prerelease) { ico = ICON_MD_SCIENCE; statusC = Warning(); tt = TR("daemon_update_prerelease_tt"); lbl = TR("upd_prerelease"); } + else if (i == 0) { ico = ICON_MD_NEW_RELEASES; statusC = Primary(); tt = TR("daemon_update_latest_tt"); lbl = TR("daemon_update_latest_badge"); } + float rightLimit = rmx.x - Layout::spacingMd(); if (ico) { float cs = bodyF->LegacySize * 1.3f; ImVec2 cp(rmx.x - Layout::spacingMd() - cs, (rmn.y + rmx.y) * 0.5f - cs * 0.5f); - mdl->AddText(icoF, cs, cp, icoC, ico); + mdl->AddText(icoF, cs, cp, statusC, ico); if ((hov || sel) && tt) Tooltip("%s", tt); + rightLimit = cp.x - Layout::spacingSm(); } float x = rmn.x + Layout::spacingMd(); float tagY = rmn.y + Layout::spacingMd(); mdl->AddText(bodyF, bodyF->LegacySize, ImVec2(x, tagY), r.hasAsset ? OnSurface() : OnSurfaceDisabled(), r.tag.c_str()); + if (lbl) { + float bx = x + bodyF->CalcTextSizeA(bodyF->LegacySize, FLT_MAX, 0, r.tag.c_str()).x + Layout::spacingSm(); + float by = tagY + (bodyF->LegacySize - capF->LegacySize) * 0.5f; + if (bx + capF->CalcTextSizeA(capF->LegacySize, FLT_MAX, 0, lbl).x <= rightLimit) + mdl->AddText(capF, capF->LegacySize, ImVec2(bx, by), statusC, lbl); + } if (!r.date.empty()) mdl->AddText(capF, capF->LegacySize, ImVec2(x, rmx.y - Layout::spacingMd() - capF->LegacySize),