Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Fix activity log rendering

fzaninotto315f36c30a15
diff --git a/src/components/atomic-crm/activity/ActivityLogCompanyCreated.tsx b/src/components/atomic-crm/activity/ActivityLogCompanyCreated.tsx
index d990d0f3..0d005f37 100644
--- a/src/components/atomic-crm/activity/ActivityLogCompanyCreated.tsx
+++ b/src/components/atomic-crm/activity/ActivityLogCompanyCreated.tsx
@@ -21,7 +21,7 @@ export function ActivityLogCompanyCreated({
<div className="flex flex-row space-x-1 items-center w-full">
<CompanyAvatar width={20} height={20} record={company} />
- <span className="text-muted-foreground text-sm inline-flex flex-grow">
+ <span className="text-muted-foreground text-sm flex-grow">
<ReferenceField source="sales_id" reference="sales" record={activity}>
<SaleName />
</ReferenceField>
diff --git a/src/components/atomic-crm/activity/ActivityLogContactCreated.tsx b/src/components/atomic-crm/activity/ActivityLogContactCreated.tsx
index 90e4e41e..b13ea757 100644
--- a/src/components/atomic-crm/activity/ActivityLogContactCreated.tsx
+++ b/src/components/atomic-crm/activity/ActivityLogContactCreated.tsx
@@ -20,7 +20,7 @@ export function ActivityLogContactCreated({
<div className="p-0">
<div className="flex flex-row gap-2 items-center w-full">
<Avatar width={20} height={20} record={contact} />
- <span className="text-muted-foreground text-sm inline-flex flex-grow">
+ <span className="text-muted-foreground text-sm flex-grow">
<ReferenceField source="sales_id" reference="sales" record={activity}>
<SaleName />
</ReferenceField>
@@ -28,8 +28,23 @@ export function ActivityLogContactCreated({
<Link to={`/contacts/${contact.id}/show`}>
{contact.first_name}&nbsp;{contact.last_name}
</Link>
- &nbsp;
- {context !== "company" && <>to company {activity.company_id}</>}
+ {context !== "company" && (
+ <>
+ {activity.company_id != null && (
+ <>
+ &nbsp;to&nbsp;
+ <ReferenceField
+ source="company_id"
+ reference="companies"
+ record={activity}
+ link="show"
+ />
+ </>
+ )}
+ &nbsp;
+ <RelativeDate date={activity.date} />
+ </>
+ )}
</span>
{context === "company" && (
<span className="text-muted-foreground text-sm">
diff --git a/src/components/atomic-crm/activity/ActivityLogContactNoteCreated.tsx b/src/components/atomic-crm/activity/ActivityLogContactNoteCreated.tsx
index 7ec80998..284454cd 100644
--- a/src/components/atomic-crm/activity/ActivityLogContactNoteCreated.tsx
+++ b/src/components/atomic-crm/activity/ActivityLogContactNoteCreated.tsx
@@ -35,34 +35,36 @@ export function ActivityLogContactNoteCreated({
<ContactAvatar />
</ReferenceField>
- <div className="flex flex-row flex-grow">
- <div className="text-sm text-muted-foreground flex-grow">
- <span className="text-muted-foreground text-sm inline-flex">
- <ReferenceField
- source="sales_id"
- reference="sales"
- record={activity}
- >
- <SaleName />
- </ReferenceField>
- <ReferenceField
- source="contact_id"
- reference="contacts"
- record={activity.contactNote}
- >
- &nbsp;added a note about <TextField source="first_name" />
- &nbsp;
- <TextField source="last_name" />
- </ReferenceField>
- </span>
- </div>
-
- {context === "company" && (
- <span className="text-muted-foreground text-sm">
+ <span className="text-muted-foreground text-sm flex-grow">
+ <ReferenceField
+ source="sales_id"
+ reference="sales"
+ record={activity}
+ >
+ <SaleName />
+ </ReferenceField>
+ <ReferenceField
+ source="contact_id"
+ reference="contacts"
+ record={activity.contactNote}
+ >
+ &nbsp;added a note about&nbsp;
+ <TextField source="first_name" />
+ &nbsp;
+ <TextField source="last_name" />
+ </ReferenceField>
+ {context !== "company" && (
+ <>
+ &nbsp;
<RelativeDate date={activity.date} />
- </span>
+ </>
)}
- </div>
+ </span>
+ {context === "company" && (
+ <span className="text-muted-foreground text-sm">
+ <RelativeDate date={activity.date} />
+ </span>
+ )}
</div>
}
text={contactNote.text}
diff --git a/src/components/atomic-crm/activity/ActivityLogDealCreated.tsx b/src/components/atomic-crm/activity/ActivityLogDealCreated.tsx
index 8d3d0715..c8f44335 100644
--- a/src/components/atomic-crm/activity/ActivityLogDealCreated.tsx
+++ b/src/components/atomic-crm/activity/ActivityLogDealCreated.tsx
@@ -20,7 +20,7 @@ export function ActivityLogDealCreated({
<div className="p-0">
<div className="flex flex-row space-x-1 items-center w-full">
<div className="w-5 h-5 bg-gray-300 rounded-full" />
- <span className="text-muted-foreground text-sm inline-flex flex-grow">
+ <span className="text-muted-foreground text-sm flex-grow">
<ReferenceField source="sales_id" reference="sales" record={activity}>
<SaleName />
</ReferenceField>
diff --git a/src/components/atomic-crm/activity/ActivityLogDealNoteCreated.tsx b/src/components/atomic-crm/activity/ActivityLogDealNoteCreated.tsx
index fdd06946..d2cd2b61 100644
--- a/src/components/atomic-crm/activity/ActivityLogDealNoteCreated.tsx
+++ b/src/components/atomic-crm/activity/ActivityLogDealNoteCreated.tsx
@@ -36,7 +36,7 @@ export function ActivityLogDealNoteCreated({
</ReferenceField>
</ReferenceField>
- <span className="text-muted-foreground text-sm inline-flex flex-grow">
+ <span className="text-muted-foreground text-sm flex-grow">
<ReferenceField
source="sales_id"
reference="sales"