Polish remaining UX items: avatar fallback, chat truncation, delete confirmations
- PlayerAvatar component with onError fallback to initial badge; used in PlayerManager and ChatBridge. - ChatBridge: truncate long usernames to 16 chars with tooltip, add avatar column, bump tinted text colors to -300 for better dark-mode contrast. - BackupManager: confirm step for Delete (was one-click). - ModManager: confirm step for snapshot Delete, clearer "Confirm Restore" / "Confirm Delete" labels, unify outer spacing with the rest of admin. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
dd69c17c3b
commit
b6b10159ad
5 changed files with 140 additions and 50 deletions
40
components/PlayerAvatar.tsx
Normal file
40
components/PlayerAvatar.tsx
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
export function PlayerAvatar({
|
||||
name,
|
||||
size = 24,
|
||||
className = "",
|
||||
}: {
|
||||
name: string;
|
||||
size?: number;
|
||||
className?: string;
|
||||
}) {
|
||||
const [failed, setFailed] = useState(false);
|
||||
const dim = `${size}px`;
|
||||
const initial = name.slice(0, 1).toUpperCase();
|
||||
|
||||
if (failed || !name) {
|
||||
return (
|
||||
<div
|
||||
className={`rounded bg-muted text-muted-foreground shrink-0 flex items-center justify-center font-bold ${className}`}
|
||||
style={{ width: dim, height: dim, fontSize: size * 0.5 }}
|
||||
aria-label={name}
|
||||
>
|
||||
{initial}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<img
|
||||
src={`https://mc-heads.net/avatar/${encodeURIComponent(name)}/${size}`}
|
||||
alt=""
|
||||
width={size}
|
||||
height={size}
|
||||
onError={() => setFailed(true)}
|
||||
className={`rounded shrink-0 bg-muted ${className}`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue