refactor(widget): simplify search and author cards

This commit is contained in:
kate522 committed 2026-08-15 17:44:57 +08:00
1 parent efb952171d
commit f5d3599756
3 files changed
+21 -40

No files matched your search

+20 -6
View File
@@ -11,18 +11,32 @@
text-align: center; text-align: center;
} }
.aksrt-author-card__cover { .aksrt-author-card__cover {
height: 84px; height: 139px;
min-height: 139px;
max-height: 139px;
background: linear-gradient(135deg, #93c5fd, #c4b5fd) center/cover no-repeat; background: linear-gradient(135deg, #93c5fd, #c4b5fd) center/cover no-repeat;
} }
.aksrt-author-card__body { padding: 0 14px 16px; } .aksrt-author-card__body {
display: flex;
flex-direction: column;
align-items: center;
padding: 0 14px 16px;
}
.aksrt-author-card__body .user-content {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
}
.aksrt-author-card__avatar { .aksrt-author-card__avatar {
display: inline-block; display: flex;
margin-top: -36px; flex: 0 0 auto;
margin: -38px auto 0;
border-radius: 50%; border-radius: 50%;
overflow: hidden; overflow: hidden;
border: 3px solid var(--surface-1, #fff); border: 3px solid var(--surface-1, #fff);
width: 72px; width: 76px;
height: 72px; height: 76px;
} }
.aksrt-author-card__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; } .aksrt-author-card__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.aksrt-author-card__name { .aksrt-author-card__name {
-13
View File
@@ -808,19 +808,6 @@
color: inherit !important; color: inherit !important;
} }
.aksrt-author-card__badge {
display: inline-flex;
align-items: center;
gap: 4px;
margin-top: 8px;
padding: 2px 10px;
border-radius: 999px;
font-size: 12px;
background: #fef3c7;
color: #b45309;
}
.aksrt-author-card__badge img { border-radius: 50%; }
/* 徽章入口与弹窗样式统一由 assets/css/frontend/medal.css 提供。 */ /* 徽章入口与弹窗样式统一由 assets/css/frontend/medal.css 提供。 */
/* Forum tab topics (batch6) */ /* Forum tab topics (batch6) */
+1 -21
View File
@@ -53,10 +53,7 @@ class WidgetAuthorCard extends \WP_Widget {
if (!is_string($bio) || $bio === '') { if (!is_string($bio) || $bio === '') {
$bio = (string) $user->description; $bio = (string) $user->description;
} }
$cover = (string) get_user_meta($author_id, 'aksrt_cover', true); $cover = (string) get_user_meta($author_id, 'aksrt_background_image', true);
if ($cover === '') {
$cover = (string) get_user_meta($author_id, 'custom_avatar_cover', true);
}
$post_count = count_user_posts($author_id, 'post', true); $post_count = count_user_posts($author_id, 'post', true);
$followers = 0; $followers = 0;
@@ -84,23 +81,6 @@ class WidgetAuthorCard extends \WP_Widget {
if ($bio !== '') { if ($bio !== '') {
echo '<div class="aksrt-author-card__bio user-desc muted-2-color em09">' . esc_html(wp_trim_words($bio, 28)) . '</div>'; echo '<div class="aksrt-author-card__bio user-desc muted-2-color em09">' . esc_html(wp_trim_words($bio, 28)) . '</div>';
} }
if (class_exists('\AKSRT\User\Badges') && \AKSRT\User\Badges::public_display()) {
$wear = \AKSRT\User\Badges::get_wear($author_id);
if ($wear !== '') {
$map = \AKSRT\User\Badges::get_dictionary_map();
if (isset($map[$wear])) {
$badge = $map[$wear];
echo '<div class="aksrt-author-card__badge author-tag tone-' . esc_attr((string) ($badge['tone'] ?? 'neutral')) . '">';
if (!empty($badge['icon_url'])) {
echo '<img src="' . esc_url((string) $badge['icon_url']) . '" alt="" width="16" height="16" loading="lazy" /> ';
} else {
echo '<i class="fas fa-medal" aria-hidden="true"></i> ';
}
echo esc_html((string) $badge['label']);
echo '</div>';
}
}
}
if ($show_stats) { if ($show_stats) {
echo '<div class="aksrt-author-card__stats">'; echo '<div class="aksrt-author-card__stats">';
echo '<span><b>' . esc_html((string) $post_count) . '</b>' . esc_html__('文章', 'aksrt') . '</span>'; echo '<span><b>' . esc_html((string) $post_count) . '</b>' . esc_html__('文章', 'aksrt') . '</span>';