fix(profile): restore route styles and hidden modals
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.aksrt-modal[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
.aksrt-modal.is-open {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
@@ -518,6 +518,7 @@
|
||||
.aksrt-author-hero__identity .aksrt-medal-entry,
|
||||
.aksrt-author-hero__identity .badg { height: 26px; box-sizing: border-box; margin: 0; padding: 0 8px; border-radius: 999px; font-size: 12px; line-height: 26px; }
|
||||
.aksrt-profile-details-modal { position: fixed; inset: 0; z-index: 10001; display: grid; place-items: center; padding: 20px; }
|
||||
.aksrt-profile-details-modal[hidden] { display: none !important; }
|
||||
.aksrt-profile-details-modal__backdrop { position: absolute; inset: 0; background: rgba(10, 15, 22, .52); }
|
||||
.aksrt-profile-details-modal__dialog { position: relative; width: min(100%, 420px); padding: 24px; border-radius: 16px; background: var(--color-card, #fff); box-shadow: 0 24px 64px rgba(0,0,0,.24); }
|
||||
.aksrt-profile-details-modal__dialog h2 { margin: 0 28px 16px 0; font-size: 18px; }
|
||||
|
||||
@@ -590,6 +590,7 @@
|
||||
if (typeof m === 'string') m = document.getElementById(m);
|
||||
if (!m) return;
|
||||
m.classList.remove('is-open');
|
||||
m.hidden = true;
|
||||
document.body.style.overflow = '';
|
||||
var f = m.querySelector('form');
|
||||
var sceneMap = { 'pwd-modal': 'change_password', 'email-modal': 'change_email', 'phone-modal': 'bind_phone' };
|
||||
@@ -605,7 +606,6 @@
|
||||
if (scene && store && store[scene] && typeof store[scene].reset === 'function') {
|
||||
store[scene].reset();
|
||||
}
|
||||
if (m.id === 'phone-modal') m.hidden = true;
|
||||
}
|
||||
|
||||
root.querySelectorAll('.security-trigger').forEach(function(btn) {
|
||||
|
||||
@@ -5,7 +5,7 @@ $context = is_array($args['context'] ?? null) ? $args['context'] : [];
|
||||
extract($context, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
|
||||
?>
|
||||
<!-- ==================== 修改密码弹窗 ==================== -->
|
||||
<div id="pwd-modal" class="aksrt-modal" role="dialog" aria-modal="true" aria-label="<?php esc_attr_e( '修改密码', 'aksrt' ); ?>">
|
||||
<div id="pwd-modal" class="aksrt-modal" hidden role="dialog" aria-modal="true" aria-label="<?php esc_attr_e( '修改密码', 'aksrt' ); ?>">
|
||||
<div class="aksrt-modal__overlay" data-close-modal></div>
|
||||
<div class="aksrt-modal__box">
|
||||
<div class="aksrt-modal__header">
|
||||
@@ -54,7 +54,7 @@ extract($context, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_
|
||||
</div>
|
||||
|
||||
<!-- ==================== 更改邮箱弹窗 ==================== -->
|
||||
<div id="email-modal" class="aksrt-modal" role="dialog" aria-modal="true" aria-label="<?php esc_attr_e( '更改邮箱', 'aksrt' ); ?>">
|
||||
<div id="email-modal" class="aksrt-modal" hidden role="dialog" aria-modal="true" aria-label="<?php esc_attr_e( '更改邮箱', 'aksrt' ); ?>">
|
||||
<div class="aksrt-modal__overlay" data-close-modal></div>
|
||||
<div class="aksrt-modal__box">
|
||||
<div class="aksrt-modal__header">
|
||||
|
||||
+45
-17
@@ -333,14 +333,22 @@ trait ScriptsPart1b {
|
||||
);
|
||||
}
|
||||
|
||||
// 共享基础 profile 样式(兼容层)
|
||||
$profile_css_path = get_template_directory() . '/assets/css/routes/profile.css';
|
||||
wp_enqueue_style(
|
||||
'aksrt-route-profile',
|
||||
$base_uri . '/assets/css/routes/profile.css',
|
||||
['aksrt-tokens'],
|
||||
file_exists($profile_css_path) ? (string) filemtime($profile_css_path) : $version
|
||||
);
|
||||
// Enqueue every profile leaf directly. Nested @imports are not versioned,
|
||||
// so browsers can otherwise retain stale layout/modal rules after deploys.
|
||||
$profile_parts = ['layout', 'lists', 'modals'];
|
||||
$profile_deps = [$core_dep];
|
||||
foreach ($profile_parts as $part_index => $part) {
|
||||
$part_path = get_template_directory() . '/assets/css/routes/profile/' . $part . '.css';
|
||||
$is_last_part = $part_index === count($profile_parts) - 1;
|
||||
$part_handle = $is_last_part ? 'aksrt-route-profile' : 'aksrt-route-profile-' . $part;
|
||||
wp_enqueue_style(
|
||||
$part_handle,
|
||||
$base_uri . '/assets/css/routes/profile/' . $part . '.css',
|
||||
$profile_deps,
|
||||
file_exists($part_path) ? (string) filemtime($part_path) : $version
|
||||
);
|
||||
$profile_deps = [$part_handle];
|
||||
}
|
||||
|
||||
// 本人中心 vs 公开主页拆分加载
|
||||
$is_public_user_home = $is_profile_route
|
||||
@@ -356,14 +364,34 @@ trait ScriptsPart1b {
|
||||
file_exists($user_home_css_path) ? (string) filemtime($user_home_css_path) : $version
|
||||
);
|
||||
} else {
|
||||
// 本人中心(page template)
|
||||
$user_center_css_path = get_template_directory() . '/assets/css/routes/user-center.css';
|
||||
wp_enqueue_style(
|
||||
'aksrt-route-user-center',
|
||||
$base_uri . '/assets/css/routes/user-center.css',
|
||||
['aksrt-route-profile'],
|
||||
file_exists($user_center_css_path) ? (string) filemtime($user_center_css_path) : $version
|
||||
);
|
||||
// Keep the legacy aggregate's cascade order, but give every leaf its
|
||||
// own cache version. The final leaf retains the public aggregate handle.
|
||||
$user_center_parts = [
|
||||
'user-center/shell',
|
||||
'user-center/credits',
|
||||
'user-center/vip',
|
||||
'user-center/level',
|
||||
'user-center/settings',
|
||||
'revenue',
|
||||
'user-center/revenue',
|
||||
'user-center/revenue-earnings',
|
||||
'user-center/responsive',
|
||||
];
|
||||
$user_center_deps = ['aksrt-route-profile'];
|
||||
foreach ($user_center_parts as $part_index => $part) {
|
||||
$part_path = get_template_directory() . '/assets/css/routes/' . $part . '.css';
|
||||
$is_last_part = $part_index === count($user_center_parts) - 1;
|
||||
$part_handle = $is_last_part
|
||||
? 'aksrt-route-user-center'
|
||||
: 'aksrt-route-' . str_replace('/', '-', $part);
|
||||
wp_enqueue_style(
|
||||
$part_handle,
|
||||
$base_uri . '/assets/css/routes/' . $part . '.css',
|
||||
$user_center_deps,
|
||||
file_exists($part_path) ? (string) filemtime($part_path) : $version
|
||||
);
|
||||
$user_center_deps = [$part_handle];
|
||||
}
|
||||
// Orders is a lazy user-center panel, so its independent assets must
|
||||
// be ready before client-side panel replacement can insert its markup.
|
||||
$has_orders_panel = false;
|
||||
@@ -377,7 +405,7 @@ trait ScriptsPart1b {
|
||||
wp_enqueue_style(
|
||||
'aksrt-orders',
|
||||
$base_uri . '/assets/css/routes/orders.css',
|
||||
['aksrt-tokens'],
|
||||
[$core_dep],
|
||||
(string) filemtime($orders_css)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -283,3 +283,25 @@ test('article visual matrix pins every breakpoint, state and strict threshold',
|
||||
assert.equal(matrix.acceptance.dimensionDeltaPxMax, 1);
|
||||
assert.equal(matrix.acceptance.pixelDifferencePercentMax, 1.5);
|
||||
});
|
||||
|
||||
test('profile routes load versioned leaf styles and keep dialogs hidden initially', () => {
|
||||
const scripts = read('src/Core/ScriptsPart1b.php');
|
||||
const accountModals = read('inc/helpers/user-center-renderers/profile-account-modals.php');
|
||||
const userCenterJs = read('assets/js/routes/user-center.js');
|
||||
const userHomeCss = read('assets/css/routes/user-home.css');
|
||||
|
||||
assert.ok(scripts.includes("$profile_parts = ['layout', 'lists', 'modals'];"));
|
||||
for (const part of ['user-center/shell', 'user-center/credits', 'user-center/vip', 'user-center/level', 'user-center/settings', 'revenue', 'user-center/revenue', 'user-center/revenue-earnings', 'user-center/responsive']) {
|
||||
assert.ok(scripts.includes(`'${part}'`), `missing direct route leaf ${part}`);
|
||||
}
|
||||
assert.match(scripts, /assets\/css\/routes\/profile\/' \. \$part \. '\.css/);
|
||||
assert.match(scripts, /assets\/css\/routes\/' \. \$part \. '\.css/);
|
||||
assert.match(scripts, /filemtime\(\$part_path\)/);
|
||||
assert.doesNotMatch(scripts, /assets\/css\/routes\/profile\.css/);
|
||||
assert.doesNotMatch(scripts, /assets\/css\/routes\/user-center\.css/);
|
||||
|
||||
assert.match(accountModals, /id="pwd-modal" class="aksrt-modal" hidden/);
|
||||
assert.match(accountModals, /id="email-modal" class="aksrt-modal" hidden/);
|
||||
assert.match(userCenterJs, /function closeModal\(m\)[\s\S]*?m\.hidden = true;/);
|
||||
assert.match(userHomeCss, /\.aksrt-profile-details-modal\[hidden\]\s*\{\s*display:\s*none\s*!important;\s*\}/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user