fix(nav): header publish menu + userbox card polish
Unpaint multi-type 发布 wrapper, fix light-menu ink, avatar unread dot clipping, check-in REST double namespace, and user-card VIP/check-in layout.
This commit is contained in:
1 parent
df2874698c
commit
77164fee45
9 files changed
+126
-38
No files matched your search
@@ -157,18 +157,36 @@ if (!function_exists('aksrt_render_new_add_btns')) :
|
||||
$label = __('发布', 'aksrt');
|
||||
}
|
||||
$label_html = aksrt_normalize_header_cta_label((string) $label, 'fas fa-pen');
|
||||
$class = trim('newadd-btns ' . $class);
|
||||
// Keep CTA paint classes (e.g. btn-primary) off multi-type wrapper so the
|
||||
// dropdown plate is not filled pink/primary; apply them on the toggle only.
|
||||
$class_tokens = preg_split('/\s+/', trim($class), -1, PREG_SPLIT_NO_EMPTY) ?: [];
|
||||
$cta_tokens = [];
|
||||
$wrap_tokens = ['newadd-btns'];
|
||||
foreach ($class_tokens as $token) {
|
||||
if ($token === 'newadd-btns') {
|
||||
continue;
|
||||
}
|
||||
if ($token === 'btn-primary' || $token === 'but' || $token === 'navbar-cta') {
|
||||
$cta_tokens[] = $token;
|
||||
continue;
|
||||
}
|
||||
$wrap_tokens[] = $token;
|
||||
}
|
||||
if (!in_array('btn-primary', $cta_tokens, true)) {
|
||||
$cta_tokens[] = 'btn-primary';
|
||||
}
|
||||
$cta_class = trim(implode(' ', array_unique($cta_tokens)));
|
||||
|
||||
if (count($actions) === 1) {
|
||||
$a = $actions[0];
|
||||
// Prefer configured label; icon already embedded after normalize.
|
||||
return '<a rel="nofollow" class="' . esc_attr(trim($class . ' but navbar-cta')) . '" href="' . esc_url($a['url']) . '">'
|
||||
return '<a rel="nofollow" class="' . esc_attr(trim(implode(' ', $wrap_tokens) . ' ' . $cta_class . ' but navbar-cta')) . '" href="' . esc_url($a['url']) . '">'
|
||||
. $label_html
|
||||
. '</a>';
|
||||
}
|
||||
|
||||
$html = '<span class="' . esc_attr($class . ' hover-show') . '">';
|
||||
$html .= '<a href="javascript:;" class="but newadd-btns__toggle navbar-cta" rel="nofollow">'
|
||||
$html = '<span class="' . esc_attr(trim(implode(' ', $wrap_tokens) . ' hover-show')) . '">';
|
||||
$html .= '<a href="javascript:;" class="' . esc_attr(trim('but newadd-btns__toggle navbar-cta ' . $cta_class)) . '" rel="nofollow">'
|
||||
. $label_html
|
||||
. ' <i class="fas fa-caret-down" aria-hidden="true"></i></a>';
|
||||
$html .= '<div class="hover-show-con dropdown-menu drop-newadd">';
|
||||
|
||||
@@ -39,32 +39,17 @@ if (!function_exists('aksrt_header_user_checkin_btn')) :
|
||||
$signed = false;
|
||||
}
|
||||
|
||||
$details = '';
|
||||
if (function_exists('aksrt_get_remote_modal_link')) {
|
||||
$details = aksrt_get_remote_modal_link([
|
||||
'tag' => 'a',
|
||||
'class' => 'aksrt-header-checkin-details muted-2-color em09 mt6 block text-center',
|
||||
'text' => __('签到详情', 'aksrt'),
|
||||
'query_arg' => ['action' => 'aksrt_checkin_details_modal'],
|
||||
'data_class' => 'modal-mini full-sm',
|
||||
'height' => 420,
|
||||
'mobile_bottom' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
if ($signed) {
|
||||
return '<button type="button" class="but block c-yellow aksrt-header-checkin is-done" disabled>'
|
||||
. '<i class="fas fa-calendar-check" aria-hidden="true"></i> '
|
||||
. esc_html__('今日已签到', 'aksrt')
|
||||
. '</button>'
|
||||
. $details;
|
||||
. '</button>';
|
||||
}
|
||||
|
||||
return '<button type="button" class="but block c-yellow aksrt-header-checkin" data-aksrt-checkin="1">'
|
||||
. '<i class="fas fa-calendar-check" aria-hidden="true"></i> '
|
||||
. esc_html__('签到领取今日奖励', 'aksrt')
|
||||
. '</button>'
|
||||
. $details;
|
||||
. '</button>';
|
||||
}
|
||||
endif;
|
||||
|
||||
@@ -106,7 +91,8 @@ if (!function_exists('aksrt_header_user_badges_row')) :
|
||||
if ($user_id <= 0 || !function_exists('aksrt_render_user_identity_chips')) {
|
||||
return '';
|
||||
}
|
||||
$chips = aksrt_render_user_identity_chips($user_id, 'card');
|
||||
// VIP already shown next to display name in the header profile row.
|
||||
$chips = aksrt_render_user_identity_chips($user_id, 'card', ['include_vip' => false]);
|
||||
if ($chips === '') {
|
||||
return '';
|
||||
}
|
||||
@@ -140,13 +126,14 @@ if (!function_exists('aksrt_header_payvip_bar')) :
|
||||
$info = aksrt_get_vip_info($user_id);
|
||||
$exp_label = (string) ($info['expires_label'] ?? '');
|
||||
}
|
||||
$html = '<div class="mt10 em09 aksrt-header-payvip">';
|
||||
$html .= '<span class="radius4 payvip-icon btn-block text-center vipbg-v2 level-' . (int) $level . '">';
|
||||
$html = '<div class="mt10 em09 aksrt-header-payvip is-vip">';
|
||||
$html .= '<span class="radius4 payvip-icon btn-block text-center vipbg-v2 level-' . (int) $level . ' aksrt-header-payvip__active">';
|
||||
$html .= '<span class="aksrt-header-payvip__level">';
|
||||
$html .= '<i class="fas fa-gem" aria-hidden="true"></i>';
|
||||
$html .= '<span>' . esc_html($name) . '</span>';
|
||||
$html .= '</span>';
|
||||
if ($exp_label !== '') {
|
||||
$html .= '<span class="ml10 badg jb-yellow vip-expdate-tag"><i class="fas fa-clock" aria-hidden="true"></i>'
|
||||
. esc_html($exp_label) . '</span>';
|
||||
$html .= '<span class="aksrt-header-payvip__exp">' . esc_html($exp_label) . '</span>';
|
||||
}
|
||||
$html .= '</span></div>';
|
||||
return $html;
|
||||
|
||||
@@ -31,13 +31,21 @@ if (!function_exists('aksrt_render_user_identity_chips')) {
|
||||
*
|
||||
* @param int $user_id
|
||||
* @param string $context author|comment|card
|
||||
* @param array $args {
|
||||
* Optional. Additional options.
|
||||
*
|
||||
* @type bool $include_vip Whether to prepend VIP badge. Default true.
|
||||
* }
|
||||
*/
|
||||
function aksrt_render_user_identity_chips(int $user_id, string $context = 'author'): string {
|
||||
function aksrt_render_user_identity_chips(int $user_id, string $context = 'author', array $args = []): string {
|
||||
if ($user_id <= 0) {
|
||||
return '';
|
||||
}
|
||||
$args = wp_parse_args($args, [
|
||||
'include_vip' => true,
|
||||
]);
|
||||
$html = '';
|
||||
if (function_exists('aksrt_render_vip_badge')) {
|
||||
if (!empty($args['include_vip']) && function_exists('aksrt_render_vip_badge')) {
|
||||
$vip = aksrt_render_vip_badge($user_id, 'sm');
|
||||
if (is_string($vip) && $vip !== '') {
|
||||
$html .= $vip;
|
||||
|
||||
Reference in new issue
Block a user