diff --git a/assets/css/frontend/nav/header-menu-buttons.css b/assets/css/frontend/nav/header-menu-buttons.css index afda8ee3..d1fca48a 100644 --- a/assets/css/frontend/nav/header-menu-buttons.css +++ b/assets/css/frontend/nav/header-menu-buttons.css @@ -17,14 +17,18 @@ display: inline-flex; align-items: center; min-width: 0; + flex: 0 0 auto; + width: auto; + max-width: none; } -/* CTA button base: flex icon + text, never stack or clip glyphs */ -.navbar-but-cluster .navbar-cta, -.navbar-but-cluster .btn-primary, -.navbar-but-cluster .but.btn-primary, -.navbar-but-cluster .navbar-newposts.but, -.navbar-but-cluster a.but { +/* CTA paint only on actual anchors/buttons — never on hover wrappers */ +.navbar-but-cluster a.navbar-cta, +.navbar-but-cluster a.btn-primary, +.navbar-but-cluster a.but.btn-primary, +.navbar-but-cluster a.navbar-newposts.but, +.navbar-but-cluster a.but, +.navbar-but-cluster button.navbar-cta { display: inline-flex !important; align-items: center; justify-content: center; @@ -32,7 +36,7 @@ padding: 6px 14px; border-radius: var(--navbar-cta-radius, 20px); background: var(--color-primary, #2f6df6); - color: #fff; + color: #fff !important; text-decoration: none; border: 0; font-size: 13px; @@ -40,27 +44,44 @@ white-space: nowrap; box-sizing: border-box; vertical-align: middle; + flex: 0 0 auto; + width: auto; + max-width: none; + height: auto; + min-height: 0; } -.navbar-but-cluster .navbar-cta > i, +.navbar-but-cluster a.navbar-cta > i, .navbar-but-cluster a.but > i, -.navbar-but-cluster .btn-primary > i { +.navbar-but-cluster a.btn-primary > i, +.navbar-but-cluster a.navbar-cta .navbar-cta-text, +.navbar-but-cluster a.navbar-cta > span:not(.badge) { display: inline-flex; align-items: center; justify-content: center; - width: 1em; - height: 1em; margin: 0 !important; flex: 0 0 auto; - line-height: 1; - font-size: 1em; -} - -.navbar-but-cluster .navbar-cta-text, -.navbar-but-cluster .navbar-cta > span:not(.badge) { - display: inline-block; line-height: 1.2; white-space: nowrap; + color: inherit !important; +} + +.navbar-but-cluster a.navbar-cta > i, +.navbar-but-cluster a.but > i, +.navbar-but-cluster a.btn-primary > i { + width: 1em; + height: 1em; + font-size: 1em; + line-height: 1; +} + +/* Multi-type toggle keeps fixed CTA size when menu opens (focus-within). */ +.navbar-but-cluster .newadd-btns__toggle.navbar-cta, +.navbar-but-cluster a.newadd-btns__toggle { + flex: 0 0 auto !important; + width: auto !important; + min-width: 0; + max-width: none; } .navbar-but-cluster .payvip-icon.but, @@ -78,52 +99,70 @@ } /* Publish multi-type dropdown */ +.navbar-but-cluster .newadd-btns.hover-show, .newadd-btns.hover-show { position: relative; display: inline-flex; align-items: center; + align-self: center; z-index: 20; - /* Wrapper must not inherit CTA paint (pink/primary fill + white text). */ + /* Wrapper must never look like the CTA (no fill, no stretch when open). */ background: transparent !important; - color: inherit; - padding: 0; - border: 0; - box-shadow: none; + color: inherit !important; + padding: 0 !important; + margin: 0; + border: 0 !important; + box-shadow: none !important; + width: auto !important; + min-width: 0; + max-width: none; + height: auto !important; + flex: 0 0 auto; + white-space: nowrap; } +.navbar-but-cluster .newadd-btns .drop-newadd, +.navbar-but-cluster .newadd-btns .hover-show-con, .newadd-btns .drop-newadd, .newadd-btns .hover-show-con { - display: block; - position: absolute; - top: calc(100% + 0px); - right: 0; - min-width: 148px; - margin: 0; - padding: 6px 0; - padding-top: 10px; /* bridge gap so pointer can move into menu */ - background: transparent; - border: 0; - box-shadow: none; + display: block !important; + position: absolute !important; + top: calc(100% + 4px) !important; + right: 0 !important; + left: auto !important; + float: none !important; + width: max-content !important; + min-width: 160px; + max-width: min(240px, 80vw); + margin: 0 !important; + /* Top bridge so pointer can move into menu without collapsing hover */ + padding: 8px 0 6px !important; + /* Solid plate — guarantees readable ink contrast in light mode */ + background: #ffffff !important; + color: #222222 !important; + border: 1px solid rgba(0, 0, 0, 0.08) !important; + border-radius: 8px !important; + box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important; opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s; - z-index: 50; + z-index: 1200 !important; pointer-events: none; + box-sizing: border-box; } +/* Hide decorative plate — real background is on the panel itself */ .newadd-btns .drop-newadd::before, .newadd-btns .hover-show-con.drop-newadd::before { - content: ""; - display: block; - background: var(--main-bg-color, #fff); - border-radius: 8px; - box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); - position: absolute; - inset: 6px 0 0 0; - z-index: -1; + content: none !important; + display: none !important; } +.navbar-but-cluster .newadd-btns.hover-show:hover .drop-newadd, +.navbar-but-cluster .newadd-btns.hover-show:hover .hover-show-con, +.navbar-but-cluster .newadd-btns.hover-show:focus-within .drop-newadd, +.navbar-but-cluster .newadd-btns.hover-show:focus-within .hover-show-con, .newadd-btns.hover-show:hover .drop-newadd, .newadd-btns.hover-show:hover .hover-show-con, .newadd-btns.hover-show:focus-within .drop-newadd, @@ -134,40 +173,77 @@ pointer-events: auto; } +.navbar-but-cluster .newadd-btns .newadd-btns__item, +.newadd-btns .drop-newadd .newadd-btns__item, .newadd-btns__item { - display: flex; + display: flex !important; align-items: center; gap: 8px; - padding: 8px 14px; - /* Explicit ink color — never inherit white from CTA toggle. */ - color: var(--color-ink, #222); - text-decoration: none; + padding: 8px 14px !important; + margin: 0; + width: 100% !important; + height: auto !important; + min-height: 0; + border: 0 !important; + border-radius: 0; + background: transparent !important; + /* Force dark ink — never inherit CTA white */ + color: #222 !important; + text-decoration: none !important; white-space: nowrap; position: relative; + box-sizing: border-box; + font-size: 13px !important; + font-weight: 500; + line-height: 1.35; + opacity: 1 !important; } +.navbar-but-cluster .newadd-btns .newadd-btns__item > i, .newadd-btns__item > i { width: 1em; - margin: 0; + margin: 0 !important; text-align: center; flex: 0 0 auto; + color: inherit !important; + opacity: 0.9; } +.navbar-but-cluster .newadd-btns .newadd-btns__item > span, +.newadd-btns__item > span { + color: inherit !important; + line-height: 1.35; +} + +.navbar-but-cluster .newadd-btns .newadd-btns__item:hover, +.newadd-btns .drop-newadd .newadd-btns__item:hover, .newadd-btns__item:hover { - background: var(--surface-2, rgba(0, 0, 0, 0.04)); - color: var(--focus-color, var(--color-primary)); + background: var(--surface-2, rgba(0, 0, 0, 0.06)) !important; + color: var(--color-primary, #f04494) !important; +} + +html.dark .newadd-btns .drop-newadd, +html.dark .newadd-btns .hover-show-con, +body.dark-theme .newadd-btns .drop-newadd, +body.dark-theme .newadd-btns .hover-show-con, +body.theme-dark .newadd-btns .drop-newadd, +body.theme-dark .newadd-btns .hover-show-con { + background: #323335 !important; + color: #f8fafc !important; + border-color: rgba(255, 255, 255, 0.08) !important; } html.dark .newadd-btns__item, body.dark-theme .newadd-btns__item, body.theme-dark .newadd-btns__item { - color: var(--color-ink, #f8fafc); + color: #f1f5f9 !important; } html.dark .newadd-btns__item:hover, body.dark-theme .newadd-btns__item:hover, body.theme-dark .newadd-btns__item:hover { - color: var(--focus-color, var(--color-primary)); + color: var(--color-primary, #f04494) !important; + background: rgba(255, 255, 255, 0.06) !important; } /* Generic hover-show (zibll parity) */ diff --git a/assets/css/frontend/nav/header-userbox.css b/assets/css/frontend/nav/header-userbox.css index 0c2e6d3b..f2a1e20c 100644 --- a/assets/css/frontend/nav/header-userbox.css +++ b/assets/css/frontend/nav/header-userbox.css @@ -32,36 +32,76 @@ color: var(--color-ink-3, #666); } -/* Check-in: readable on light theme */ +/* Check-in: beat generic `.user-dropdown button { height:44px; background:none }` */ +.user-dropdown button.aksrt-header-checkin, .aksrt-header-checkin { - width: 100%; - border: 0; - border-radius: 6px; - padding: 8px 10px; + width: 100% !important; + max-width: 100%; + height: auto !important; + min-height: 36px; + border: 0 !important; + border-radius: 6px !important; + padding: 8px 10px !important; + margin: 0; cursor: pointer; - background: #fff6db; - color: #8a5a00; + background: #fff6db !important; + color: #8a5a00 !important; font-weight: 600; - display: inline-flex; - align-items: center; - justify-content: center; - gap: 6px; + font-size: 13px !important; + line-height: 1.3; + display: inline-flex !important; + flex-direction: row !important; + align-items: center !important; + justify-content: center !important; + gap: 6px !important; + text-align: center !important; + box-sizing: border-box; + white-space: nowrap; } +.user-dropdown button.aksrt-header-checkin > i, .aksrt-header-checkin > i { margin: 0 !important; - color: #b78103; + color: #b78103 !important; + flex: 0 0 auto; + line-height: 1; } -.aksrt-header-checkin.is-done { +.user-dropdown button.aksrt-header-checkin > span, +.aksrt-header-checkin > span { + line-height: 1.3; + color: inherit; +} + +.user-dropdown button.aksrt-header-checkin.is-done, +.aksrt-header-checkin.is-done, +.user-dropdown button.aksrt-header-checkin:disabled, +.aksrt-header-checkin:disabled { opacity: 0.85; cursor: default; - background: #f3f4f6; - color: #555; + background: #f3f4f6 !important; + color: #555 !important; } -.aksrt-header-checkin.is-done > i { - color: #777; +.user-dropdown button.aksrt-header-checkin.is-done > i, +.aksrt-header-checkin.is-done > i, +.user-dropdown button.aksrt-header-checkin:disabled > i, +.aksrt-header-checkin:disabled > i { + color: #777 !important; +} + +.user-dropdown button.aksrt-header-checkin:hover, +.aksrt-header-checkin:hover { + background: #fff0c2 !important; + color: #8a5a00 !important; +} + +.user-dropdown button.aksrt-header-checkin.is-done:hover, +.aksrt-header-checkin.is-done:hover, +.user-dropdown button.aksrt-header-checkin:disabled:hover, +.aksrt-header-checkin:disabled:hover { + background: #f3f4f6 !important; + color: #555 !important; } .aksrt-header-checkin-details { @@ -200,11 +240,31 @@ } /* Dark theme overrides */ +html.dark .user-dropdown button.aksrt-header-checkin, html.dark .aksrt-header-checkin, +body.dark-theme .user-dropdown button.aksrt-header-checkin, body.dark-theme .aksrt-header-checkin, +body.theme-dark .user-dropdown button.aksrt-header-checkin, body.theme-dark .aksrt-header-checkin { - background: rgba(255, 193, 7, 0.18); - color: #f0c14b; + background: rgba(255, 193, 7, 0.18) !important; + color: #f0c14b !important; +} + +html.dark .user-dropdown button.aksrt-header-checkin > i, +html.dark .aksrt-header-checkin > i, +body.dark-theme .user-dropdown button.aksrt-header-checkin > i, +body.dark-theme .aksrt-header-checkin > i, +body.theme-dark .user-dropdown button.aksrt-header-checkin > i, +body.theme-dark .aksrt-header-checkin > i { + color: #f0c14b !important; +} + +html.dark .user-dropdown button.aksrt-header-checkin.is-done, +html.dark .aksrt-header-checkin.is-done, +body.dark-theme .user-dropdown button.aksrt-header-checkin.is-done, +body.dark-theme .aksrt-header-checkin.is-done { + background: rgba(255, 255, 255, 0.08) !important; + color: #bbb !important; } html.dark .aksrt-header-wallet, diff --git a/assets/js/aksrt-runtime.js b/assets/js/aksrt-runtime.js index b5095aff..76e71527 100644 --- a/assets/js/aksrt-runtime.js +++ b/assets/js/aksrt-runtime.js @@ -206,6 +206,10 @@ window.aksrtToast = function (msg, type) { aksrt.notyf(msg, { type: type || 'info', duration: 2200 }); }; + // Alias used by several modules that call aksrt.toast(...) + aksrt.toast = function (msg, type) { + return aksrt.notyf(msg, typeof type === 'string' ? { type: type, duration: 2200 } : (type || { duration: 2200 })); + }; // ══════════════════════════════════════════════════════════════ // §10.10 — confirm: i18n confirm dialog + [data-confirm] diff --git a/assets/js/header-userbox.js b/assets/js/header-userbox.js index c3547c2d..4a29ec5e 100644 --- a/assets/js/header-userbox.js +++ b/assets/js/header-userbox.js @@ -17,12 +17,24 @@ } function toast(msg, type) { - if (window.aksrt && typeof window.aksrt.toast === 'function') { - window.aksrt.toast(msg, type || 'info'); + type = type || 'info'; + // Site-wide notification widget (aksrt-runtime notyf). + if (window.aksrt && typeof window.aksrt.notyf === 'function') { + window.aksrt.notyf(msg, { type: type, duration: 2200 }); return; } - // eslint-disable-next-line no-alert - window.alert(msg); + if (typeof window.aksrtToast === 'function') { + window.aksrtToast(msg, type); + return; + } + if (typeof window.AksrtToast === 'function') { + window.AksrtToast(msg, type); + return; + } + // Last resort: non-blocking console (never native alert for UX). + if (window.console && typeof window.console.log === 'function') { + window.console.log('[aksrt]', type, msg); + } } function openModal(id) { @@ -91,7 +103,12 @@ } toast((res.data && res.data.message) || '签到成功', 'success'); btn.classList.add('is-done'); - btn.innerHTML = ' 今日已签到'; + btn.disabled = true; + btn.setAttribute('disabled', 'disabled'); + // Keep existing structure so CSS layout (.but.block flex) is not lost. + btn.innerHTML = + '' + + '今日已签到'; }) .catch(function () { toast('网络错误', 'danger'); diff --git a/inc/helpers/aksrt-header-userbox.php b/inc/helpers/aksrt-header-userbox.php index 1a1ef9af..b892e5c1 100644 --- a/inc/helpers/aksrt-header-userbox.php +++ b/inc/helpers/aksrt-header-userbox.php @@ -41,14 +41,14 @@ if (!function_exists('aksrt_header_user_checkin_btn')) : if ($signed) { return ''; } return ''; } endif;