Some checks failed
E2E / Playwright e2e (push) Has been cancelled
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.
42 lines
930 B
TypeScript
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>
|
|
)
|
|
}
|