fix(navigation): align header wallet tiles with reference
This commit is contained in:
@@ -2875,6 +2875,22 @@ main.container,
|
|||||||
|
|
||||||
.aksrt-header-userbox {
|
.aksrt-header-userbox {
|
||||||
color: var(--color-ink-2);
|
color: var(--color-ink-2);
|
||||||
|
line-height: 1.42857143;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* public.css redeclares .muted-box after the legacy utility rules, which
|
||||||
|
* otherwise overrides the wallet tiles' padding-6 and radius4 utilities. */
|
||||||
|
.aksrt-header-userbox .muted-box.padding-6 {
|
||||||
|
background-color: var(--this-bg, var(--color-line-soft));
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Keep the header check-in action flush with the VIP row's padded inner width. */
|
||||||
|
.aksrt-header-userbox > .mt6.em09 > .but.block {
|
||||||
|
display: block;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Top-nav bell badge (the card itself uses the legacy badge.top element). */
|
/* Top-nav bell badge (the card itself uses the legacy badge.top element). */
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -168,6 +168,22 @@
|
|||||||
|
|
||||||
.aksrt-header-userbox {
|
.aksrt-header-userbox {
|
||||||
color: var(--color-ink-2);
|
color: var(--color-ink-2);
|
||||||
|
line-height: 1.42857143;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* public.css redeclares .muted-box after the legacy utility rules, which
|
||||||
|
* otherwise overrides the wallet tiles' padding-6 and radius4 utilities. */
|
||||||
|
.aksrt-header-userbox .muted-box.padding-6 {
|
||||||
|
background-color: var(--this-bg, var(--color-line-soft));
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Keep the header check-in action flush with the VIP row's padded inner width. */
|
||||||
|
.aksrt-header-userbox > .mt6.em09 > .but.block {
|
||||||
|
display: block;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Top-nav bell badge (the card itself uses the legacy badge.top element). */
|
/* Top-nav bell badge (the card itself uses the legacy badge.top element). */
|
||||||
|
|||||||
+14
-4
@@ -38,6 +38,14 @@
|
|||||||
return (BigInt(match[1]) * 100n) + BigInt((match[2] || '').padEnd(2, '0') || '0');
|
return (BigInt(match[1]) * 100n) + BigInt((match[2] || '').padEnd(2, '0') || '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatCutCount(value) {
|
||||||
|
var number = Number(value);
|
||||||
|
if (!Number.isFinite(number)) return String(value);
|
||||||
|
if (number > 999999) return String(Math.round(number / 10000)) + 'W+';
|
||||||
|
if (number > 9999) return String(Math.round(number / 1000) / 10) + 'W+';
|
||||||
|
return String(number);
|
||||||
|
}
|
||||||
|
|
||||||
function api(path, options) {
|
function api(path, options) {
|
||||||
return window.AksrtRequest.request(path, options || {}).then(function (response) {
|
return window.AksrtRequest.request(path, options || {}).then(function (response) {
|
||||||
return {
|
return {
|
||||||
@@ -64,16 +72,18 @@
|
|||||||
var walletNumber = Number(wallet);
|
var walletNumber = Number(wallet);
|
||||||
var walletText = Number.isFinite(walletNumber) ? walletNumber.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) : String(wallet);
|
var walletText = Number.isFinite(walletNumber) ? walletNumber.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) : String(wallet);
|
||||||
document.querySelectorAll('[data-aksrt-wallet-value]').forEach(function (element) {
|
document.querySelectorAll('[data-aksrt-wallet-value]').forEach(function (element) {
|
||||||
element.textContent = walletText;
|
var text = element.dataset.aksrtCountFormat === 'cut-count' ? formatCutCount(wallet) : walletText;
|
||||||
element.title = walletText;
|
element.textContent = text;
|
||||||
|
element.title = text;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (points !== undefined && points !== null && points !== '') {
|
if (points !== undefined && points !== null && points !== '') {
|
||||||
var pointsNumber = Number(points);
|
var pointsNumber = Number(points);
|
||||||
var pointsText = Number.isFinite(pointsNumber) ? pointsNumber.toLocaleString() : String(points);
|
var pointsText = Number.isFinite(pointsNumber) ? pointsNumber.toLocaleString() : String(points);
|
||||||
document.querySelectorAll('[data-aksrt-points-value]').forEach(function (element) {
|
document.querySelectorAll('[data-aksrt-points-value]').forEach(function (element) {
|
||||||
element.textContent = pointsText;
|
var text = element.dataset.aksrtCountFormat === 'cut-count' ? formatCutCount(points) : pointsText;
|
||||||
element.title = pointsText;
|
element.textContent = text;
|
||||||
|
element.title = text;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ if (!function_exists('aksrt_header_user_wallet_mini')) :
|
|||||||
$box .= '<a rel="nofollow" style="flex: 1;" class="muted-box padding-6 flex1 radius4" href="' . esc_url($center) . '">'
|
$box .= '<a rel="nofollow" style="flex: 1;" class="muted-box padding-6 flex1 radius4" href="' . esc_url($center) . '">'
|
||||||
. '<div class="muted-2-color px12">' . esc_html__('余额', 'aksrt')
|
. '<div class="muted-2-color px12">' . esc_html__('余额', 'aksrt')
|
||||||
. '<i class="ml6 fa fas fa-angle-right em12" aria-hidden="true"></i></div>'
|
. '<i class="ml6 fa fas fa-angle-right em12" aria-hidden="true"></i></div>'
|
||||||
. '<div class="flex jsb"><span class="font-bold c-blue-2" data-aksrt-wallet-value>'
|
. '<div class="flex jsb"><span class="font-bold c-blue-2" data-aksrt-wallet-value data-aksrt-count-format="cut-count">'
|
||||||
. esc_html(aksrt_cut_count((float) aksrt_user_balance_decimal($user_id)))
|
. esc_html(aksrt_cut_count((float) aksrt_user_balance_decimal($user_id)))
|
||||||
. '</span><i class="fa fas fa-money-bill-wave em14 c-blue-2" aria-hidden="true"></i></div></a>';
|
. '</span><i class="fa fas fa-money-bill-wave em14 c-blue-2" aria-hidden="true"></i></div></a>';
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ if (!function_exists('aksrt_header_user_wallet_mini')) :
|
|||||||
$box .= '<a rel="nofollow" style="flex: 1;" class="muted-box padding-6 flex1 radius4" href="' . esc_url($center) . '">'
|
$box .= '<a rel="nofollow" style="flex: 1;" class="muted-box padding-6 flex1 radius4" href="' . esc_url($center) . '">'
|
||||||
. '<div class="muted-2-color px12">' . esc_html($currency)
|
. '<div class="muted-2-color px12">' . esc_html($currency)
|
||||||
. '<i class="ml6 fa fas fa-angle-right em12" aria-hidden="true"></i></div>'
|
. '<i class="ml6 fa fas fa-angle-right em12" aria-hidden="true"></i></div>'
|
||||||
. '<div class="flex jsb"><span class="font-bold c-yellow" data-aksrt-points-value>'
|
. '<div class="flex jsb"><span class="font-bold c-yellow" data-aksrt-points-value data-aksrt-count-format="cut-count">'
|
||||||
. esc_html(aksrt_cut_count(aksrt_user_points($user_id)))
|
. esc_html(aksrt_cut_count(aksrt_user_points($user_id)))
|
||||||
. '</span><i class="fa fas fa-coins em14 c-yellow" aria-hidden="true"></i></div></a>';
|
. '</span><i class="fa fas fa-coins em14 c-yellow" aria-hidden="true"></i></div></a>';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,6 +175,9 @@ test('guest account member VIP and publish contracts share reference header DOM'
|
|||||||
assert.match(userboxCss, /\.aksrt-nav-notification \.aksrt-notification-badge/);
|
assert.match(userboxCss, /\.aksrt-nav-notification \.aksrt-notification-badge/);
|
||||||
assert.doesNotMatch(userboxCss, /aksrt-header-wallet|aksrt-header-checkin|aksrt-header-payvip|\.aksrt-header-userbox \.aksrt-notification-badge/);
|
assert.doesNotMatch(userboxCss, /aksrt-header-wallet|aksrt-header-checkin|aksrt-header-payvip|\.aksrt-header-userbox \.aksrt-notification-badge/);
|
||||||
assert.doesNotMatch(userboxCss, /width:\s*260px/);
|
assert.doesNotMatch(userboxCss, /width:\s*260px/);
|
||||||
|
assert.match(userboxCss, /\.aksrt-header-userbox\s*\{[^}]*line-height:\s*1\.42857143/s);
|
||||||
|
assert.match(userboxCss, /\.aksrt-header-userbox\s+\.muted-box\.padding-6\s*\{[^}]*background-color:\s*var\(--this-bg,\s*var\(--color-line-soft\)\)[^}]*border-radius:\s*4px[^}]*padding:\s*6px/s);
|
||||||
|
assert.match(userboxCss, /\.aksrt-header-userbox\s*>\s*\.mt6\.em09\s*>\s*\.but\.block\s*\{[^}]*display:\s*block;[^}]*box-sizing:\s*border-box;[^}]*width:\s*100%;/s);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('the account popover rows match the reference user box structure', () => {
|
test('the account popover rows match the reference user box structure', () => {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ const test = require('node:test')
|
|||||||
const assert = require('node:assert/strict')
|
const assert = require('node:assert/strict')
|
||||||
const fs = require('node:fs')
|
const fs = require('node:fs')
|
||||||
const path = require('node:path')
|
const path = require('node:path')
|
||||||
|
const vm = require('node:vm')
|
||||||
|
|
||||||
const root = path.resolve(__dirname, '..', '..')
|
const root = path.resolve(__dirname, '..', '..')
|
||||||
|
|
||||||
@@ -421,6 +422,23 @@ test('asset purchases share the order center and refresh every wallet surface',
|
|||||||
assert.match(sidebar, /data-aksrt-points-value/)
|
assert.match(sidebar, /data-aksrt-points-value/)
|
||||||
assert.match(header, /data-aksrt-wallet-value/)
|
assert.match(header, /data-aksrt-wallet-value/)
|
||||||
assert.match(header, /data-aksrt-points-value/)
|
assert.match(header, /data-aksrt-points-value/)
|
||||||
|
assert.match(header, /data-aksrt-wallet-value data-aksrt-count-format="cut-count"/)
|
||||||
|
assert.match(header, /data-aksrt-points-value data-aksrt-count-format="cut-count"/)
|
||||||
|
assert.match(creditsJs, /element\.dataset\.aksrtCountFormat === 'cut-count' \? formatCutCount\(/)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('header wallet count formatting matches the server cut-count thresholds', () => {
|
||||||
|
const creditsJs = fs.readFileSync(path.join(root, 'assets', 'js', 'credits.js'), 'utf8')
|
||||||
|
const formatterSource = creditsJs.match(/function formatCutCount\(value\) \{[\s\S]*?\n\t\}/)
|
||||||
|
|
||||||
|
assert.ok(formatterSource, 'credits runtime must define the header cut-count formatter')
|
||||||
|
const formatCutCount = vm.runInNewContext('(' + formatterSource[0] + ')')
|
||||||
|
|
||||||
|
assert.equal(formatCutCount('0.00'), '0')
|
||||||
|
assert.equal(formatCutCount('9999'), '9999')
|
||||||
|
assert.equal(formatCutCount('10000'), '1W+')
|
||||||
|
assert.equal(formatCutCount('12345'), '1.2W+')
|
||||||
|
assert.equal(formatCutCount('1000000'), '100W+')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('recharge completion always credits the ledger and expiry SQL is strict-mode safe', () => {
|
test('recharge completion always credits the ledger and expiry SQL is strict-mode safe', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user