// Avatar.jsx — initials avatar with optional presence dot
function Avatar({ name = "?", size = 36, tint = "#BFDDF5", presence, style }) {
const initials = name.split(/\s+/).map(p => p[0]).slice(0, 2).join("").toUpperCase();
return (
{initials}
{presence && (
)}
);
}
// Tints cycle for member avatars (warm palette, soft)
const AVATAR_TINTS = ["#F4D6A8", "#BFDDF5", "#C8E6D3", "#F4C7C0", "#E0D0F0", "#D8E0A8"];
function tintFor(name) {
let h = 0;
for (const ch of name || "?") h = (h * 31 + ch.charCodeAt(0)) >>> 0;
return AVATAR_TINTS[h % AVATAR_TINTS.length];
}
Object.assign(window, { Avatar, tintFor });