fix(frontend): align the user-card check-in badge with the reference theme
The legacy .jb-* compat layer in core/buttons.css restated .jb-yellow as #f99d4d -> #f7631d, and because the public bundle loads after main.min.css that value overrode the reference-accurate #f59f54 -> #ff6922 gradient, so the check-in bookmark (and every other .jb-yellow surface) painted the wrong orange. Correct the gradient and rebuild the public bundle. Also drop the dead is-done class and the attribute-less span wrapper from the signed card badge, which the reference theme does not have. The header dropdown variant keeps its class, locked by the navigation contract.
This commit is contained in:
@@ -1095,7 +1095,7 @@ strong, b {
|
||||
|
||||
/* gradient modifiers (legacy .jb-*) */
|
||||
.jb-red { --this-bg: linear-gradient(135deg, #fd7a64 10%, #fb2d2d 100%); }
|
||||
.jb-yellow { --this-bg: linear-gradient(135deg, #f99d4d 10%, #f7631d 100%); }
|
||||
.jb-yellow { --this-bg: linear-gradient(135deg, #f59f54 10%, #ff6922 100%); }
|
||||
.jb-blue { --this-bg: linear-gradient(135deg, #59c3fb 10%, #268df7 100%); }
|
||||
.jb-green { --this-bg: linear-gradient(135deg, #60e464 10%, #5cb85b 100%); }
|
||||
.jb-purple { --this-bg: linear-gradient(135deg, #f98dfb 10%, #ea00f9 100%); }
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -316,7 +316,7 @@
|
||||
|
||||
/* gradient modifiers (legacy .jb-*) */
|
||||
.jb-red { --this-bg: linear-gradient(135deg, #fd7a64 10%, #fb2d2d 100%); }
|
||||
.jb-yellow { --this-bg: linear-gradient(135deg, #f99d4d 10%, #f7631d 100%); }
|
||||
.jb-yellow { --this-bg: linear-gradient(135deg, #f59f54 10%, #ff6922 100%); }
|
||||
.jb-blue { --this-bg: linear-gradient(135deg, #59c3fb 10%, #268df7 100%); }
|
||||
.jb-green { --this-bg: linear-gradient(135deg, #60e464 10%, #5cb85b 100%); }
|
||||
.jb-purple { --this-bg: linear-gradient(135deg, #f98dfb 10%, #ea00f9 100%); }
|
||||
|
||||
@@ -56,11 +56,11 @@ if (!function_exists('aksrt_header_user_checkin_btn')) :
|
||||
// 已签到:与参考主题一致,入口按钮变为签到详情弹窗触发链接(可点击)。
|
||||
if ($signed) {
|
||||
if ($class !== null) {
|
||||
// 用户卡片签到书签:保留书签类与 is-done 视觉,仅将行为切换为打开详情弹窗。
|
||||
// 用户卡片签到书签:与参考主题一致,已签到态仅切换为详情弹窗触发链接,书签类名与文本不变。
|
||||
return aksrt_get_user_checkin_details_link(
|
||||
$class . ' is-done',
|
||||
$class,
|
||||
'<i class="fa far fa-calendar-check ml3 mr6" aria-hidden="true"></i>'
|
||||
. '<span>' . esc_html__('已签到', 'aksrt') . '</span>'
|
||||
. esc_html__('已签到', 'aksrt')
|
||||
);
|
||||
}
|
||||
return aksrt_get_user_checkin_details_link(
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
'use strict'
|
||||
|
||||
const assert = require('node:assert/strict')
|
||||
const fs = require('node:fs')
|
||||
const path = require('node:path')
|
||||
const test = require('node:test')
|
||||
|
||||
const root = path.resolve(__dirname, '..', '..')
|
||||
const read = (file) => fs.readFileSync(path.join(root, file), 'utf8')
|
||||
|
||||
// Reference theme (zibll css/main.css): .jb-yellow sets --this-bg-b: #f59f54 and
|
||||
// --this-bg: linear-gradient(135deg, #f59f54 10%, #ff6922 100%). build/public.min.css
|
||||
// is enqueued after main.min.css, so the legacy .jb-* compat layer in core/buttons.css
|
||||
// overrides main.css there; the two must agree or every .jb-yellow surface (the
|
||||
// user-card check-in badge first of all) paints the wrong gradient.
|
||||
const referenceGradient = /--this-bg:\s*linear-gradient\(135deg,\s*#f59f54 10%,\s*#ff6922 100%\)/
|
||||
const staleHexes = /#f99d4d|#f7631d/
|
||||
|
||||
test('buttons.css legacy .jb-yellow gradient matches the reference theme', () => {
|
||||
const buttons = read('assets/css/core/buttons.css')
|
||||
const start = buttons.indexOf('.jb-yellow {')
|
||||
assert.notEqual(start, -1, 'missing the legacy .jb-yellow rule')
|
||||
const block = buttons.slice(start, buttons.indexOf('}', start))
|
||||
assert.match(block, referenceGradient)
|
||||
assert.doesNotMatch(block, staleHexes)
|
||||
})
|
||||
|
||||
test('the built public bundle carries the reference .jb-yellow gradient', () => {
|
||||
const bundle = read('assets/css/build/public.min.css')
|
||||
assert.match(
|
||||
bundle,
|
||||
/\.jb-yellow\{--this-bg: linear-gradient\(135deg, #f59f54 10%, #ff6922 100%\)\}/
|
||||
)
|
||||
assert.doesNotMatch(
|
||||
bundle,
|
||||
/\.jb-yellow\{--this-bg: linear-gradient\(135deg, #f99d4d 10%, #f7631d 100%\)\}/
|
||||
)
|
||||
})
|
||||
|
||||
test('main.css still owns the reference .jb-yellow gradient', () => {
|
||||
const main = read('assets/css/main.css')
|
||||
assert.match(main, referenceGradient)
|
||||
assert.doesNotMatch(main, staleHexes)
|
||||
})
|
||||
|
||||
test('the user-card check-in badge renders without the dead is-done class and bare span', () => {
|
||||
const userbox = read('inc/helpers/aksrt-header-userbox.php')
|
||||
const fnStart = userbox.indexOf('function aksrt_header_user_checkin_btn')
|
||||
assert.notEqual(fnStart, -1, 'missing aksrt_header_user_checkin_btn')
|
||||
const fnEnd = userbox.indexOf('if (!function_exists', fnStart)
|
||||
assert.notEqual(fnEnd, -1)
|
||||
const fn = userbox.slice(fnStart, fnEnd)
|
||||
|
||||
// Signed card badge: the badge class passes through untouched and the done
|
||||
// label is bare text after the icon, matching the reference markup.
|
||||
assert.match(fn, /aksrt_get_user_checkin_details_link\(\s*\$class,/)
|
||||
assert.doesNotMatch(fn, /\$class \. ' is-done'/)
|
||||
assert.doesNotMatch(fn, /'<span>'/)
|
||||
|
||||
// The idle badge keeps the data-signin-label hook the sign-in controller
|
||||
// uses to swap labels in place.
|
||||
assert.match(fn, /<span data-signin-label>/)
|
||||
})
|
||||
Reference in New Issue
Block a user