A full-featured CRM built with React, shadcn/ui, and Supabase.
Add company name in deal card
fzaninottoa5f15251729b
diff --git a/src/components/atomic-crm/deals/DealCard.tsx b/src/components/atomic-crm/deals/DealCard.tsxindex c19b3ea1..9a5f8be6 100644--- a/src/components/atomic-crm/deals/DealCard.tsx+++ b/src/components/atomic-crm/deals/DealCard.tsx@@ -1,6 +1,8 @@import { Draggable } from "@hello-pangea/dnd";-import { useRedirect } from "ra-core";+import { useRedirect, RecordContextProvider } from "ra-core";import { ReferenceField } from "@/components/admin/reference-field";+import { NumberField } from "@/components/admin/number-field";+import { SelectField } from "@/components/admin/select-field";import { Card, CardContent } from "@/components/ui/card";import { CompanyAvatar } from "../companies/CompanyAvatar";@@ -30,9 +32,6 @@ export const DealCardContent = ({}) => {const { dealCategories } = useConfigurationContext();const redirect = useRedirect();- const categoryLabel = dealCategories.find(- (c) => c.value === deal.category,- )?.label;const handleClick = () => {redirect(`/deals/${deal.id}/show`, undefined, undefined, undefined, {_scrollToTop: false,@@ -47,37 +46,55 @@ export const DealCardContent = ({ref={provided?.innerRef}onClick={handleClick}>- <Card- className={`py-3 transition-all duration-200 ${- snapshot?.isDragging- ? "opacity-90 transform rotate-1 shadow-lg"- : "shadow-sm hover:shadow-md"- }`}- >- <CardContent className="px-3 flex flex-col">- <div className="flex-1 flex">- <p className="flex-1 text-sm font-medium mb-2">{deal.name}</p>- <ReferenceField- source="company_id"- record={deal}- reference="companies"- link={false}- >- <CompanyAvatar width={20} height={20} />- </ReferenceField>- </div>- <p className="text-xs text-muted-foreground">- {deal.amount.toLocaleString("en-US", {- notation: "compact",- style: "currency",- currency: "USD",- currencyDisplay: "narrowSymbol",- minimumSignificantDigits: 3,- })}- {categoryLabel ? `, ${categoryLabel}` : ""}- </p>- </CardContent>- </Card>+ <RecordContextProvider value={deal}>+ <Card+ className={`py-3 transition-all duration-200 ${+ snapshot?.isDragging+ ? "opacity-90 transform rotate-1 shadow-lg"+ : "shadow-sm hover:shadow-md"+ }`}+ >+ <CardContent className="px-3 flex flex-col">+ <div className="flex-1 flex">+ <p className="flex-1 text-sm font-medium mb-2">+ <ReferenceField+ source="company_id"+ reference="companies"+ link={false}+ />+ {" - "}+ {deal.name}+ </p>+ <ReferenceField+ source="company_id"+ reference="companies"+ link={false}+ >+ <CompanyAvatar width={20} height={20} />+ </ReferenceField>+ </div>+ <p className="text-xs text-muted-foreground">+ <NumberField+ source="amount"+ options={{+ notation: "compact",+ style: "currency",+ currency: "USD",+ currencyDisplay: "narrowSymbol",+ minimumSignificantDigits: 3,+ }}+ />+ {deal.category && ", "}+ <SelectField+ source="category"+ choices={dealCategories}+ optionText="label"+ optionValue="value"+ />+ </p>+ </CardContent>+ </Card>+ </RecordContextProvider></div>);};