ultisuite-client/components/gmail/account-avatar.tsx
R3D347HR4Y c87670e90f
Some checks failed
E2E / Playwright e2e (push) Has been cancelled
feat(api): offline-first mail sync w/ TanStack Query
Move mail, compose, contacts, and accounts off mocks onto REST + WS.
Add client, auth store, IDB-backed query cache, offline queue, and
sync bar; hybrid Zustand for UI-only state. Settings still local until
backend has preferences API.
2026-05-23 00:04:28 +02:00

42 lines
930 B
TypeScript

"use client"
import type { ApiMailAccount } from "@/lib/api/types"
import { avatarColor, senderInitial } from "@/lib/sender-display"
import { cn } from "@/lib/utils"
interface AccountAvatarProps {
account: Pick<ApiMailAccount, "name" | "email">
size?: "sm" | "md" | "lg"
className?: string
}
const sizeClasses = {
sm: "size-8 text-sm",
md: "size-10 text-base",
lg: "size-20 text-3xl",
} as const
export function AccountAvatar({
account,
size = "md",
className,
}: AccountAvatarProps) {
const displayName = account.name || account.email
const initial = senderInitial(displayName)
const color = avatarColor(displayName)
return (
<div
className={cn(
"flex shrink-0 items-center justify-center rounded-full font-medium text-white",
sizeClasses[size],
className,
)}
style={{ backgroundColor: color }}
aria-hidden
>
{initial}
</div>
)
}