import { Badge, Card, Divider, Group, Stack, Text } from "@mantine/core"; import type { ReactNode } from "react"; export interface PersonField { label: string; value?: string | null; } export interface PersonCardProps { /** OWNER / POA / CONTACT PERSON — the person's role, not their name. */ title: string; icon?: ReactNode; /** * Identity state. `undefined` = this person has no identity check at all * (contact person), so no badge is rendered rather than a misleading "not * verified" one. */ verified?: boolean; /** Extra pills after the verification badge (e.g. "Verifies for this company"). */ badges?: ReactNode; /** Rendered between the header and the fields — alerts, match warnings. */ notice?: ReactNode; fields: PersonField[]; /** Shown when the API returned nothing for every field. */ emptyMessage: string; /** Attachments or anything else that belongs to this person. */ children?: ReactNode; } /** * One person in the customer's people column: owner, power of attorney, contact * person. Empty fields are dropped rather than rendered as "—", so a field the * API stops sending simply disappears instead of leaving a dead row behind. */ export function PersonCard({ title, icon, verified, badges, notice, fields, emptyMessage, children, }: PersonCardProps) { const filled = fields.filter( (f) => f.value != null && String(f.value).trim(), ); return ( {icon} {title} {verified !== undefined && (verified ? ( Fayda verified ) : ( Not verified ))} {badges} {notice} {filled.length > 0 ? ( {filled.map((f) => ( {f.label} {f.value} ))} ) : ( {emptyMessage} )} {children && ( <> {children} )} ); } export default PersonCard;