import type { ReactNode } from 'react' import { Avatar, AvatarFallback } from '@/components/ui/Avatar' import { campaignUserInitials } from '@/utilities/campaignUserProfile' export type MunicipalityRelationEntry = { id: number label: string searchText?: string initialsLabel?: string optionSuffix?: string href?: string } export const MunicipalityRelationAvatarStack = ({ entries, emptyState, maxVisible = 3, overlapRow = false, }: { entries: MunicipalityRelationEntry[] emptyState: ReactNode maxVisible?: number /** * B196 — dense card mode: every entry gets its own avatar (no cap), in ONE * row that never wraps. Each avatar sits centered in a flex-1 cell, so few * entries render apart (cell wider than the avatar) and many overlap * progressively — the overlap is proportional to the count, no avatar is * capped or hidden behind a "…", and the row always fills the group width. */ overlapRow?: boolean }) => { if (entries.length === 0) return emptyState const visible = overlapRow ? entries : entries.slice(0, maxVisible) if (overlapRow) { return ( // `overflow-hidden` clips the pile at the group's box on extreme counts // (the sr-only names below still list everyone) — no slivers into the // neighbouring group.