From f9bc0f69c4fa28c03fb235b41fac4e6e9e6884aa Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Sep 2026 18:13:58 +0800 Subject: [PATCH] fix(ban): align user center ban notice with adjacent meta info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用户中心页头治理提示与相邻元信息(用户名/邮箱/城市)排版不一致: - 高度不一致:原实现为 badg 胶囊 + 箭头作为 的内联兄弟节点,箭头 游离在胶囊之外且按基线对齐,整行高度被 pill 撑高; - 字号不一致:badg-sm 的 0.8em 使提示文字小于相邻项的 13px; - 箭头位置:参考主题 zib_get_user_ban_info_link 的箭头位于按钮内部。 现复用 uc-header__meta-item(inline-flex 居中、12px 图标、13px 字号), 与相邻元信息完全同构:状态图标 + 状态文案(c-red/c-yellow)+ 内部箭头; 链接默认色经作用域规则回归行内墨色。契约测试锁定新结构,361 项全通过。 --- assets/css/routes/profile/layout.css | 5 ++++ inc/helpers/user-ban.php | 24 +++++++++++-------- .../report-ban-contract.test.cjs | 7 ++++++ 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/assets/css/routes/profile/layout.css b/assets/css/routes/profile/layout.css index 1d69bfc4..d6c599ea 100644 --- a/assets/css/routes/profile/layout.css +++ b/assets/css/routes/profile/layout.css @@ -295,6 +295,11 @@ opacity: 0.65; } +/* 治理状态提示:与相邻元信息同排版;链接默认色会让箭头/图标偏离行内墨色 */ +.uc-header__meta .aksrt-user-ban-notice { + color: var(--color-ink-3); +} + .uc-header__actions { flex-shrink: 0; padding-top: 68px; diff --git a/inc/helpers/user-ban.php b/inc/helpers/user-ban.php index 1f294684..6814772a 100644 --- a/inc/helpers/user-ban.php +++ b/inc/helpers/user-ban.php @@ -95,8 +95,12 @@ function aksrt_get_ban_appeal_page_url(): string } /** - * 治理状态徽章 +「查看详情」入口(用户中心页头,参考主题 - * user_page_header_desc 钩子 / zib_get_user_ban_info_link 语义)。 + * 治理状态提示(用户中心页头,参考主题 user_page_header_desc 钩子 / + * zib_get_user_ban_info_link 语义:状态 + 箭头 + 查看入口)。 + * + * 排版复用 uc-header__meta-item(inline-flex 居中、12px 图标、13px 字号), + * 与相邻元信息(用户名 / 邮箱 / 城市)高度与字号完全一致;箭头置于提示内部, + * 不使用 badg-sm(0.8em 会破坏与相邻项的字号一致性)。 */ function aksrt_get_user_ban_notice_html(int $user_id): string { @@ -104,16 +108,16 @@ function aksrt_get_user_ban_notice_html(int $user_id): string if (empty($state['state'])) { return ''; } - $tone = 'banned' === $state['state'] ? 'c-red' : 'c-yellow'; - $chip = '' - . '' - . esc_html((string) $state['label']) . ''; - $link = aksrt_get_ban_appeal_page_url(); + $tone = 'banned' === $state['state'] ? 'c-red' : 'c-yellow'; + $inner = '' + . '' . esc_html((string) $state['label']) . '' + . ''; + $class = 'uc-header__meta-item aksrt-user-ban-notice'; + $link = aksrt_get_ban_appeal_page_url(); if ($link === '') { - return $chip; + return '' . $inner . ''; } - return '' . $chip - . ''; + return '' . $inner . ''; } /** diff --git a/tests/widget-system/report-ban-contract.test.cjs b/tests/widget-system/report-ban-contract.test.cjs index ee91acd2..dc7608a1 100644 --- a/tests/widget-system/report-ban-contract.test.cjs +++ b/tests/widget-system/report-ban-contract.test.cjs @@ -176,6 +176,13 @@ test('ban prompt surface mirrors the reference theme entry points', () => { assert.match(userBanHelper, /function aksrt_get_user_ban_notice_html/) assert.match(userBanHelper, /function aksrt_get_ban_appeal_page_url/) assert.match(ucHeader, /aksrt_get_user_ban_notice_html/) + // 用户中心提示排版与相邻元信息一致:复用 uc-header__meta-item 结构, + // 不用 badg-sm(0.8em 破坏字号一致性),箭头置于提示内部。 + const noticeFn = userBanHelper.slice(userBanHelper.indexOf('function aksrt_get_user_ban_notice_html')) + const noticeBody = noticeFn.slice(0, noticeFn.indexOf('\n}')) + assert.match(noticeBody, /\$class = 'uc-header__meta-item aksrt-user-ban-notice';/) + assert.ok(!noticeBody.includes('badg-sm'), 'user center notice must not use badg-sm (shrinks font vs meta row)') + assert.match(noticeBody, /fa-angle-right/) // 评论拒绝态(参考主题 zib_get_user_ban_nocan_info)。 assert.match(userBanHelper, /function aksrt_get_user_ban_nocan_html/) assert.match(commentsHelper, /aksrt_get_user_ban_nocan_html/)