From 7fc1ac98dedd5b131570b58abbc7681253c26864 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 3 Oct 2026 14:32:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(user-home):=20match=20reference=20cover=20m?= =?UTF-8?q?etas=20with=20=E4=BA=BA=E6=B0=94=E5=80=BC/=E7=82=B9=E8=B5=9E=20?= =?UTF-8?q?pills?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The public user homepage cover showed a single bottom-right 粉丝 pill, which the reference theme does not render there — it shows 人气值 and 点赞 as a translucent pill group pinned to the cover's top-right corner. - Cover metas: replace 粉丝 with 人气值 (zibsvg-hot) + 点赞 (zibsvg-like), summed over the user's published posts via aksrt_get_user_posts_meta_sum() and abbreviated with aksrt_cut_count(); each is zero-suppressed independently, matching zib_get_author_header_metas() - Titles use the reference strings 人气值 N / 获得N个点赞 via data-toggle="tooltip" - CSS: adopt .single-metabox.cover-meta semantics (one rgba(0,0,0,.3) pill at right:1em/top:1.6em, 14px, 6px item gaps, 3px icon margins) plus the reference's <=480px override; drop the per-stat bottom-right pills - Drop the dead __stats / __stat / __contacts CSS blocks and the unused $tab_counts hero contract arg Follower counts remain in the content tab bar (tab_counts['follow']). Co-Authored-By: Claude Fable 5 --- assets/css/routes/user-home.css | 89 ++++++++-------------------- templates/pages/page-user-home.php | 1 - templates/parts/user/author-hero.php | 40 +++++++++---- 3 files changed, 54 insertions(+), 76 deletions(-) diff --git a/assets/css/routes/user-home.css b/assets/css/routes/user-home.css index 91f97147..d1a636af 100644 --- a/assets/css/routes/user-home.css +++ b/assets/css/routes/user-home.css @@ -42,32 +42,33 @@ pointer-events: none; } +/* Cover meta pills — legacy .single-metabox.cover-meta parity: + * 单个胶囊容器贴封面右上角,内含 人气值 / 点赞 计数值。 */ .aksrt-author-hero__cover-metas { position: absolute; - right: 58px; - bottom: 12px; + right: 1em; + top: 1.6em; z-index: 2; - display: flex; + display: inline-flex; + flex-wrap: wrap; align-items: center; - gap: 10px; + padding: 2px 6px; + border-radius: 100px; + background: rgba(0, 0, 0, 0.3); + color: rgba(255, 255, 255, 0.8); + font-size: 14px; } .aksrt-author-hero__cover-meta { display: inline-flex; align-items: center; - gap: 6px; - padding: 4px 10px; - border-radius: 999px; - font-size: 12px; - font-weight: 600; - color: #fff; - background: rgba(0, 0, 0, 0.35); - backdrop-filter: blur(4px); + margin: 0 6px; + font-size: 13px; } -.aksrt-author-hero__cover-meta i { - font-size: 11px; - opacity: 0.9; +.aksrt-author-hero__cover-meta .fa, +.aksrt-author-hero__cover-meta .icon { + margin-right: 3px; } .aksrt-author-hero__body { @@ -120,43 +121,7 @@ max-width: 520px; } -/* Body stats row removed for legacy author parity; counts live in tabs. */ -.aksrt-author-hero__stats { - display: flex; - flex-wrap: wrap; - gap: 10px; - margin-top: 14px; -} - -.aksrt-author-hero__stat { - display: inline-flex; - align-items: center; - gap: 6px; - min-height: 34px; - padding: 0 14px; - border-radius: var(--radius-pill); - background: var(--surface-2); - color: var(--color-ink-3); - font-size: 13px; - font-weight: 500; -} - -.aksrt-author-hero__stat strong { - color: var(--color-ink); - font-size: 14px; - font-weight: 700; -} - -.aksrt-author-hero__contacts { - margin-top: 10px; -} - -.aksrt-author-hero__contacts .profile-social-links { - display: flex; - flex-wrap: wrap; - gap: 8px; -} - +/* Counts live in the tab bar, not a hero body stats row (legacy parity). */ .aksrt-author-hero__actions { flex-shrink: 0; display: flex; @@ -235,18 +200,6 @@ max-width: 100%; } - .aksrt-author-hero__stats { - justify-content: center; - } - - .aksrt-author-hero__contacts { - justify-content: center; - } - - .aksrt-author-hero__contacts .profile-social-links { - justify-content: center; - } - .aksrt-author-hero__actions { padding-top: 0; justify-content: center; @@ -258,6 +211,14 @@ padding-bottom: calc(20% + 60px); } + .aksrt-author-hero__cover-metas { + font-size: 13px; + } + + .aksrt-author-hero__cover-meta { + margin: 0 4px; + } + .aksrt-author-hero__body { margin-top: -40px; gap: 14px; diff --git a/templates/pages/page-user-home.php b/templates/pages/page-user-home.php index d582c8db..e60365b5 100644 --- a/templates/pages/page-user-home.php +++ b/templates/pages/page-user-home.php @@ -44,7 +44,6 @@ require_once AKSRT_DIR . '/templates/parts/user-shared-helpers.php'; 'dashboard' => $dashboard, 'user_home_settings' => $user_home_settings, 'is_author_page' => false, - 'tab_counts' => $tab_counts ?? [], ]); ?> diff --git a/templates/parts/user/author-hero.php b/templates/parts/user/author-hero.php index 17a0c8be..b9acb016 100644 --- a/templates/parts/user/author-hero.php +++ b/templates/parts/user/author-hero.php @@ -3,14 +3,14 @@ * Author Hero — shared hero section for author archive and public user homepage. * * Aligns with legacy(): cover, avatar, name, identity, desc, - * and header actions. Content stats live in the tab bar, not a body stats row. + * and header actions. The cover carries the 人气值 / 点赞 meta pills + * (legacy zib_get_author_header_metas); follower counts stay in the tab bar. * * Contract: get_template_part(..., null, $args) * user WP_User * dashboard array from aksrt_get_user_dashboard_view() * user_home_settings array * is_author_page bool - * tab_counts array (optional) * * @package AKSRT */ @@ -22,7 +22,6 @@ $user = $args['user'] ?? null; $dashboard = is_array($args['dashboard'] ?? null) ? $args['dashboard'] : []; $settings = is_array($args['user_home_settings'] ?? null) ? $args['user_home_settings'] : []; $is_author = !empty($args['is_author_page']); -$tab_counts = is_array($args['tab_counts'] ?? null) ? $args['tab_counts'] : []; if (!($user instanceof WP_User)) { return; @@ -48,9 +47,26 @@ $show_report = !empty($dashboard['show_report']); $bg_url = function_exists('aksrt_get_user_cover_url') ? aksrt_get_user_cover_url($user_id) : ''; $is_own = !empty($dashboard['is_own_profile']); -$follower_count = (int) ($tab_counts['follow'] ?? 0); -if ($follower_count <= 0 && class_exists('\AKSRT\User\Follow')) { - $follower_count = (int) \AKSRT\User\Follow::get_instance()->get_follower_count($user_id); +// 封面右上角数据条(参考主题 zib_get_author_header_metas):人气值 + 点赞, +// 粉丝数只在内容 tab 上呈现,不进入封面。 +$cover_metas = []; +if (function_exists('aksrt_get_user_posts_meta_sum') && function_exists('aksrt_cut_count')) { + $view_n = aksrt_cut_count(aksrt_get_user_posts_meta_sum($user_id, 'aksrt_post_views')); + $like_n = aksrt_cut_count(aksrt_get_user_posts_meta_sum($user_id, '_aksrt_like_count')); + if ($view_n !== '' && $view_n !== '0') { + $cover_metas[] = [ + 'count' => $view_n, + 'title' => sprintf(__('人气值 %s', 'aksrt'), $view_n), + 'icon' => 'zibsvg-hot', + ]; + } + if ($like_n !== '' && $like_n !== '0') { + $cover_metas[] = [ + 'count' => $like_n, + 'title' => sprintf(__('获得%s个点赞', 'aksrt'), $like_n), + 'icon' => 'zibsvg-like', + ]; + } } $notification_settings = class_exists('\AKSRT\Settings\Settings') @@ -74,12 +90,14 @@ $show_cover_menu = $has_more_details || $show_cover_report || $cover_ban_html !=
alt="">
- 0) : ?> +
- - - - + + + + + +