右侧名单徽标改为仅图标,去掉文字标签节省空间

- buildUserStatusBadgeHtml: 状态徽标从 pill 胶囊(图标+文字)改为仅图标
- buildUserSignIdentityBadgeHtml: 签到身份徽标同样改为仅图标
- 两个徽标的 tooltip 信息保留,悬停仍可看到完整描述
This commit is contained in:
pllx
2026-04-27 05:45:36 +00:00
parent 40a0849151
commit 3e85cb67bc
2 changed files with 6 additions and 22 deletions
+1
View File
@@ -124,6 +124,7 @@ class ChatController extends Controller
broadcast(new UserJoined($id, $user->username, $userData))->toOthers();
// 新人首次进入:赠送 6666 金币、播放满场烟花、发送全场欢迎通告
$user->refresh();
if (! $user->has_received_new_gift) {
// 通过统一积分服务发放新人礼包 6666 金币并记录流水
$this->currencyService->change(
@@ -2212,16 +2212,9 @@
}
const safeIcon = escapeHtml(status.icon);
const safeLabel = escapeHtml(status.label);
const safeTooltip = escapeHtml(`${status.group} · ${status.label}`);
return `
<span class="user-badge-icon" style="display:inline-flex;align-items:center;gap:3px;margin-left:4px;padding:0 6px;height:18px;max-width:78px;overflow:hidden;white-space:nowrap;border-radius:999px;background:#eef2ff;border:1px solid #c7d2fe;color:#4338ca;font-size:11px;line-height:18px;vertical-align:middle;"
data-instant-tooltip="${safeTooltip}">
<span style="font-size:11px;line-height:1;flex-shrink:0;">${safeIcon}</span>
<span style="line-height:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">${safeLabel}</span>
</span>
`;
return `<span class="user-badge-icon" style="font-size:13px; margin-left:2px;" data-instant-tooltip="${safeTooltip}">${safeIcon}</span>`;
}
/**
@@ -2232,27 +2225,17 @@
*/
function buildUserSignIdentityBadgeHtml(user) {
const identityKey = String(user.sign_identity_key ?? user.sign_identity ?? '');
const identityLabel = String(user.sign_identity_label ?? user.sign_identity_name ?? '');
const identityIcon = String(user.sign_identity_icon ?? '');
if (!identityKey || !identityLabel || !identityIcon) {
if (!identityKey || !identityIcon) {
return '';
}
const color = String(user.sign_identity_color || '#0f766e');
const bgColor = String(user.sign_identity_bg_color || '#ccfbf1');
const borderColor = String(user.sign_identity_border_color || '#5eead4');
const identityLabel = String(user.sign_identity_label ?? user.sign_identity_name ?? '');
const safeIcon = escapeHtml(identityIcon);
const safeLabel = escapeHtml(identityLabel);
const safeTooltip = escapeHtml(`签到 · ${identityLabel}`);
const safeTooltip = escapeHtml(identityLabel ? `签到 · ${identityLabel}` : '签到身份');
return `
<span class="user-badge-icon" style="display:inline-flex;align-items:center;gap:3px;margin-left:4px;padding:0 6px;height:18px;max-width:78px;overflow:hidden;white-space:nowrap;border-radius:999px;background:${bgColor};border:1px solid ${borderColor};color:${color};font-size:11px;line-height:18px;vertical-align:middle;"
data-instant-tooltip="${safeTooltip}">
<span style="font-size:11px;line-height:1;flex-shrink:0;">${safeIcon}</span>
<span style="line-height:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">${safeLabel}</span>
</span>
`;
return `<span class="user-badge-icon" style="font-size:13px; margin-left:2px;" data-instant-tooltip="${safeTooltip}">${safeIcon}</span>`;
}
/**