import { Avatar, AvatarFallback } from "@repo/shadcn-ui/components"; import { cn } from "@repo/shadcn-ui/lib/utils"; import type * as React from "react"; type InitialsProps = { name?: string | null; maxParts?: number; fallback?: string; }; export const getInitials = ({ name, maxParts = 2, fallback = "?" }: InitialsProps): string => { if (!name?.trim()) return fallback; return ( name .trim() .split(/\s+/) .filter(Boolean) .slice(0, maxParts) .map((p) => p[0]?.toUpperCase() ?? "") .join("") || fallback ); }; export const Initials = (props: InitialsProps) => { return <>{getInitials(props)}; }; const VARIANT_CLASSES: Record = { primary: "bg-primary/10 text-primary", muted: "bg-muted text-muted-foreground", }; type InitialsAvatarProps = React.ComponentProps & { name?: string | null; variant?: "primary" | "muted"; maxParts?: number; fallback?: string; fallbackClassName?: string; }; export const InitialsAvatar = ({ name, variant = "muted", maxParts = 2, fallback = "?", className, fallbackClassName, ...props }: InitialsAvatarProps) => { return ( ); };