import { RiUser3Line } from "@remixicon/react"; import type { ReactNode } from "react"; import { Badge } from "@/shared/components/ui/badge"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/shared/components/ui/card"; import { PAYER_ROLE_ADMIN } from "@/shared/lib/payers/constants"; import { formatDateTime } from "@/shared/utils/date"; import { cn } from "@/shared/utils/ui"; import type { PayerInfo } from "./types"; type PayerInfoCardProps = { payer: PayerInfo; }; export function PagadorInfoCard({ payer }: PayerInfoCardProps) { const showSensitiveDetails = payer.canEdit; const getStatusBadgeVariant = (status: string): "success" | "outline" => { const normalizedStatus = status.toLowerCase(); if (normalizedStatus === "ativo") { return "success"; } return "outline"; }; return ( Detalhes da pessoa {showSensitiveDetails ? "Informações cadastrais e preferências de envio." : "Informações cadastrais visíveis para este compartilhamento."} {payer.status} } /> {resolveRoleLabel(payer.role)} } /> {showSensitiveDetails ? ( ) : null} {showSensitiveDetails ? ( ) : null} {showSensitiveDetails && !payer.email ? ( Cadastre um e-mail para permitir o envio automático. } className="sm:col-span-2" /> ) : null} {showSensitiveDetails ? ( {payer.note} ) : ( "Sem observações" ) } className="sm:col-span-2" /> ) : null} ); } const resolveRoleLabel = (role: string | null) => { if (role === PAYER_ROLE_ADMIN) return "Administrador"; return "Pessoa"; }; type InfoItemProps = { label: string; value: ReactNode; className?: string; }; function InfoItem({ label, value, className }: InfoItemProps) { return (
{label}
{value}
); }