"use client"; import { EditableAvatar } from "../EditableAvatar"; import { EntityAvatar } from "../EntityAvatar"; import { ModuleWithPermissions } from "../../permissions"; import { cn, getInitials } from "../../utils"; type EntityHeroAvatarProps = { module: ModuleWithPermissions; entityId: string; name: string; image?: string; patchImage?: (imageKey: string) => Promise; /** Required when `patchImage` is set — namespaces the S3 upload key. */ companyId?: string; variant?: "image" | "initials" | "icon"; className?: string; }; export function EntityHeroAvatar({ module, entityId, name, image, patchImage, companyId, variant, className = "h-24 w-24", }: EntityHeroAvatarProps) { const resolved = variant ?? (patchImage || image ? "image" : "icon"); if (patchImage) { return ( ); } if (resolved === "image" || resolved === "initials") { return ; } const Icon = module.icon; // Not every module declares an icon; fall back to initials so the hero never // renders an empty circle. if (!Icon) { return ; } return (
); }