feat(user-center): redesign sidebar and wallet tips

This commit is contained in:
kate522 committed 2026-07-28 13:41:00 +08:00
1 parent 82e71d1bf9
commit a7f3caec59
24 files changed
+895 -528

No files matched your search

@@ -1,34 +1,43 @@
<?php
/**
* User center sidebar: stats section.
*
* Expects extracted $context vars.
* User center sidebar: one-line account statistics.
*
* @package AKSRT
*/
defined('ABSPATH') || exit;
$public_home_url = function_exists('aksrt_get_user_home_url') ? aksrt_get_user_home_url($target_user ?? null) : '';
$stats = [
[
'label' => __('文章', 'aksrt'),
'value' => (int) ($post_count ?? 0),
'url' => isset($dashboard_tabs['posts']) ? aksrt_get_user_center_tab_url('posts') : $public_home_url,
],
[
'label' => __('评论', 'aksrt'),
'value' => (int) ($comment_count ?? 0),
'url' => isset($dashboard_tabs['comments']) ? aksrt_get_user_center_tab_url('comments') : $public_home_url,
],
[
'label' => __('收藏', 'aksrt'),
'value' => (int) ($favorite_count ?? 0),
'url' => isset($dashboard_tabs['favorites']) ? aksrt_get_user_center_tab_url('favorites') : $public_home_url,
],
[
'label' => __('粉丝', 'aksrt'),
'value' => (int) ($follower_count ?? 0),
'url' => $public_home_url !== '' ? add_query_arg(['tab' => 'follow', 'follow_sub' => 'followers'], $public_home_url) : '',
],
];
?>
<div class="uc-sidebar__section">
<div class="uc-sidebar__title"><?php esc_html_e('数据统计', 'aksrt'); ?></div>
<div class="uc-sidebar__section uc-sidebar__section--stats" aria-label="<?php esc_attr_e('账号统计', 'aksrt'); ?>">
<div class="uc-stats">
<?php foreach (['posts', 'comments', 'favorites'] as $stat_tab) : ?>
<?php if (!isset($dashboard_tabs[$stat_tab])) { continue; } ?>
<?php
$stat_count = 'posts' === $stat_tab
? $post_count
: ('comments' === $stat_tab ? $comment_count : $favorite_count);
?>
<a class="uc-stats__item" href="<?php echo esc_url(add_query_arg('tab', $stat_tab, remove_query_arg('tab'))); ?>">
<span class="uc-stats__value"><?php echo esc_html((string) $stat_count); ?></span>
<span class="uc-stats__label"><?php echo esc_html($dashboard_tabs[$stat_tab]['label']); ?></span>
<?php foreach ($stats as $stat) : ?>
<a class="uc-stats__item" href="<?php echo esc_url((string) $stat['url']); ?>">
<span class="uc-stats__value"><?php echo esc_html(number_format_i18n((int) $stat['value'])); ?></span>
<span class="uc-stats__label"><?php echo esc_html((string) $stat['label']); ?></span>
</a>
<?php endforeach; ?>
<?php if (!empty($messages_url)) : ?>
<a class="uc-stats__item" href="<?php echo esc_url($messages_url); ?>">
<span class="uc-stats__value"><?php echo esc_html((string) $notification_unread_count); ?></span>
<span class="uc-stats__label"><?php esc_html_e('通知', 'aksrt'); ?></span>
</a>
<?php endif; ?>
</div>
</div>