import { useAuthStore } from '@/state/authStore' /** Two-letter monogram from the display name, else the email. */ export function monogram(name: string | undefined, email: string | undefined) { const source = (name ?? '').trim() || (email ?? '').trim() if (!source) return '?' const parts = source.split(/\s+/).filter(Boolean) const letters = parts.length >= 2 ? parts[0][0] + parts[1][0] : source.slice(0, 2) return letters.toUpperCase() } /** Avatar monogram + display name + email, as shown at the bottom of the sidebar. */ export default function UserBadge() { const profile = useAuthStore((s) => s.profile) const user = useAuthStore((s) => s.user) const name = profile?.display_name ?? user?.email ?? '' return (
{name} {user?.email && profile?.display_name && ( {user.email} )}
) }