import { cn, getHexColorFromString, getInitials } from "~/lib/utils"; import type { UsersId } from "~/schemas/public/Users"; import { Facehash } from "./facehash/facehash"; const colorOptions = new Map(); export const getUserColor = (str: string) => { if (colorOptions.has(str)) { // biome-ignore lint/style/noNonNullAssertion: return colorOptions.get(str)!; } const usercolor = getHexColorFromString(str); colorOptions.set(str, usercolor); return usercolor; }; /* export const UserAvatarOld = ({ userId, username, className, }: { userId: UsersId; username?: string; className?: string; }) => { const userColor = getUserColor(userId); return ( {username && getInitials(username)} ); }; */ export const UserAvatar = ({ userId, username, className, }: { userId: UsersId; username?: string; className?: string; }) => { const value = `${username && getInitials(username)}${userId}`; return ( ); };