import { DollarSign } from "lucide-react"; import { Link } from "react-router"; import { useCreatePath, useListContext, useRecordContext } from "ra-core"; import { ReferenceManyField } from "@/components/ds/admin/reference-many-field"; import { Card } from "@/components/ds/ui/card"; import { Avatar as ContactAvatar } from "../contacts/Avatar"; import type { Company } from "../types"; import { CompanyAvatar } from "./CompanyAvatar"; export const CompanyCard = (props: { record?: Company }) => { const createPath = useCreatePath(); const record = useRecordContext(props); if (!record) return null; return (
{record.name}

{record.sector}

{record.nb_contacts ? ( ) : null}
{record.nb_deals ? (
{record.nb_deals} {record.nb_deals ? record.nb_deals > 1 ? "deals" : "deal" : "deal"}
) : null}
); }; const AvatarGroupIterator = () => { const { data, total, error, isPending } = useListContext(); if (isPending || error) return null; const MAX_AVATARS = 3; return (
{data.slice(0, MAX_AVATARS).map((record: any) => ( ))} {total > MAX_AVATARS && ( +{total - MAX_AVATARS} )}
); };