fix(profile): full-bleed the user center only and keep public profile at content width

This commit is contained in:
2026-09-23 13:39:57 +08:00
parent bbd5e97bac
commit 9a40ad18c7
4 changed files with 29 additions and 17 deletions
+10 -6
View File
@@ -3467,16 +3467,20 @@ html.dark body.has-scrolled .site-nav--glass {
max-width: var(--container); max-width: var(--container);
} }
/* 用户中心(双栏)与公开主页整页铺满视口,不受后台「内容最大宽度」限制。 /* 用户中心(双栏)铺满视口:左栏 320 + 间距 20 + 右栏需要横向空间,被
* 内容最大宽度只约束文章/归档等单栏阅读场景;两栏需要横向空间, * 阅读宽度收窄会在左右两侧留下大片空白。只有 page-profile.php 的 main 带
* 被 1200 一类阅读宽度收窄会在左右两侧留下大片空白。 * .aksrt-profile(公开主页的该类只打在 body 上),因此不会误伤其它路由。 */
* 统一在此声明,避免路由 CSS 与 legacy .container 规则各自漂移。 */ .site-main.content-shell.aksrt-profile {
.site-main.content-shell.aksrt-profile,
.site-main.content-shell.aksrt-user-home {
max-width: 100%; max-width: 100%;
box-sizing: border-box; box-sizing: border-box;
} }
/* 公开主页是单栏,继续沿用后台「内容最大宽度」。 */
.site-main.content-shell.aksrt-user-home {
max-width: var(--container, 1440px);
box-sizing: border-box;
}
@media (min-width: 768px) { @media (min-width: 768px) {
.content-shell { .content-shell {
padding: 40px 24px 56px; padding: 40px 24px 56px;
+1 -1
View File
File diff suppressed because one or more lines are too long
+10 -6
View File
@@ -16,16 +16,20 @@
max-width: var(--container); max-width: var(--container);
} }
/* 用户中心(双栏)与公开主页整页铺满视口,不受后台「内容最大宽度」限制。 /* 用户中心(双栏)铺满视口:左栏 320 + 间距 20 + 右栏需要横向空间,被
* 内容最大宽度只约束文章/归档等单栏阅读场景;两栏需要横向空间, * 阅读宽度收窄会在左右两侧留下大片空白。只有 page-profile.php 的 main 带
* 被 1200 一类阅读宽度收窄会在左右两侧留下大片空白。 * .aksrt-profile(公开主页的该类只打在 body 上),因此不会误伤其它路由。 */
* 统一在此声明,避免路由 CSS 与 legacy .container 规则各自漂移。 */ .site-main.content-shell.aksrt-profile {
.site-main.content-shell.aksrt-profile,
.site-main.content-shell.aksrt-user-home {
max-width: 100%; max-width: 100%;
box-sizing: border-box; box-sizing: border-box;
} }
/* 公开主页是单栏,继续沿用后台「内容最大宽度」。 */
.site-main.content-shell.aksrt-user-home {
max-width: var(--container, 1440px);
box-sizing: border-box;
}
@media (min-width: 768px) { @media (min-width: 768px) {
.content-shell { .content-shell {
padding: 40px 24px 56px; padding: 40px 24px 56px;
@@ -453,12 +453,16 @@ test('profile routes load versioned leaf styles and keep dialogs hidden initiall
assert.match(panelFavorites, /aksrt_render_user_home_pagination\(\(int\) \$favorites_query->max_num_pages, \(int\) \$favorites_page\)/); assert.match(panelFavorites, /aksrt_render_user_home_pagination\(\(int\) \$favorites_query->max_num_pages, \(int\) \$favorites_page\)/);
assert.match(panelFavorites, /array_merge\(\$user_home_render_config, \['wrapper_class' => 'aksrt-user-home__post-list'\]\), \$favorites_query\)/); assert.match(panelFavorites, /array_merge\(\$user_home_render_config, \['wrapper_class' => 'aksrt-user-home__post-list'\]\), \$favorites_query\)/);
assert.doesNotMatch(panelFavorites, /profile-list-item|\$_GET|add_query_arg/); assert.doesNotMatch(panelFavorites, /profile-list-item|\$_GET|add_query_arg/);
// User center (two columns) and the public profile fill the viewport; the admin // Only the two-column user center spans the viewport; the single-column public
// content max width stays a single-column reading constraint. // profile keeps following the admin content max width.
assert.match(frontendLayoutCss, /\.site-main\.content-shell\.aksrt-profile,[\s\S]*?\.site-main\.content-shell\.aksrt-user-home\s*\{[\s\S]*?max-width:\s*100%/); assert.match(frontendLayoutCss, /\.site-main\.content-shell\.aksrt-profile\s*\{[\s\S]*?max-width:\s*100%/);
assert.match(frontendLayoutCss, /\.site-main\.content-shell\.aksrt-user-home\s*\{[\s\S]*?max-width:\s*var\(--container, 1440px\)/);
// The front end enqueues build/public.min.css, not the frontend/ sources, so a // The front end enqueues build/public.min.css, not the frontend/ sources, so a
// source-only edit never reaches the page. The bundle must carry the contract. // source-only edit never reaches the page. The bundle must carry the contract.
assert.match(publicBundleCss, /\.site-main\.content-shell\.aksrt-profile,[\s\S]*?\.site-main\.content-shell\.aksrt-user-home\s*\{[\s\S]*?max-width:\s*100%/); assert.match(publicBundleCss, /\.site-main\.content-shell\.aksrt-profile\s*\{[\s\S]*?max-width:\s*100%/);
assert.match(publicBundleCss, /\.site-main\.content-shell\.aksrt-user-home\s*\{[\s\S]*?max-width:\s*var\(--container, 1440px\)/);
// .aksrt-profile on <main> is the user center only; other routes must not carry it.
assert.equal(read('templates/pages/page-user-home.php').includes('aksrt-profile"'), false);
assert.doesNotMatch(profileLayoutCss, /\.aksrt-profile\.content-shell\s*,[\s\S]*?max-width:\s*var\(--container/); assert.doesNotMatch(profileLayoutCss, /\.aksrt-profile\.content-shell\s*,[\s\S]*?max-width:\s*var\(--container/);
assert.doesNotMatch(userCenterShellCss, /\.aksrt-user-center \.content-shell\s*,[\s\S]*?max-width:\s*var\(--container/); assert.doesNotMatch(userCenterShellCss, /\.aksrt-user-center \.content-shell\s*,[\s\S]*?max-width:\s*var\(--container/);
assert.match(profileLayoutCss, /\.aksrt-cover-menu__panel\[hidden\]\s*\{\s*display:\s*none\s*!important;\s*\}/); assert.match(profileLayoutCss, /\.aksrt-cover-menu__panel\[hidden\]\s*\{\s*display:\s*none\s*!important;\s*\}/);