From 2bf510e0f267b95541956b61c8713fc1bb800350 Mon Sep 17 00:00:00 2001 From: fzaninotto Date: Mon, 29 Jul 2024 11:59:31 +0200 Subject: [PATCH] Fix activity log look and feel --- .../activity/ActivityLogCompanyCreated.tsx | 15 ++++++++--- .../activity/ActivityLogContactCreated.tsx | 14 +++++++--- .../ActivityLogContactNoteCreated.tsx | 15 ++++++++--- .../src/activity/ActivityLogDealCreated.tsx | 13 +++++++--- .../activity/ActivityLogDealNoteCreated.tsx | 16 +++++++++--- .../crm/src/activity/ActivityLogIterator.tsx | 13 +++++++--- examples/crm/src/activity/ActivityLogNote.tsx | 26 +++++++++++-------- examples/crm/src/contacts/Avatar.tsx | 11 ++++++-- 8 files changed, 88 insertions(+), 35 deletions(-) diff --git a/examples/crm/src/activity/ActivityLogCompanyCreated.tsx b/examples/crm/src/activity/ActivityLogCompanyCreated.tsx index 19026fefe9..0e44c5b3bb 100644 --- a/examples/crm/src/activity/ActivityLogCompanyCreated.tsx +++ b/examples/crm/src/activity/ActivityLogCompanyCreated.tsx @@ -1,7 +1,7 @@ import ListItem from '@mui/material/ListItem'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import { RecordContextProvider } from 'react-admin'; +import { Link, RecordContextProvider } from 'react-admin'; import { CompanyAvatar } from '../companies/CompanyAvatar'; import type { ActivityCompanyCreated } from '../types'; import { ActivityLogDate } from './ActivityLogDate'; @@ -24,16 +24,23 @@ export function ActivityLogCompanyCreated({ width: '100%', }} > - + - {company.name} has been added to{' '} - companies by {sale.first_name} {sale.last_name} + {sale.first_name} {sale.last_name} added company{' '} + + {company.name} + diff --git a/examples/crm/src/activity/ActivityLogContactCreated.tsx b/examples/crm/src/activity/ActivityLogContactCreated.tsx index d471be18ee..adcf596140 100644 --- a/examples/crm/src/activity/ActivityLogContactCreated.tsx +++ b/examples/crm/src/activity/ActivityLogContactCreated.tsx @@ -24,14 +24,16 @@ export function ActivityLogContactCreated({ width: '100%', }} > - + + {sale.first_name} {sale.last_name} added{' '} {contact.first_name} {contact.last_name} {' '} - has been added to {company.name} by{' '} - {sale.first_name} {sale.last_name} + to{' '} + + {company.name} + diff --git a/examples/crm/src/activity/ActivityLogContactNoteCreated.tsx b/examples/crm/src/activity/ActivityLogContactNoteCreated.tsx index 29e6e9f2df..710abaea59 100644 --- a/examples/crm/src/activity/ActivityLogContactNoteCreated.tsx +++ b/examples/crm/src/activity/ActivityLogContactNoteCreated.tsx @@ -17,23 +17,30 @@ export function ActivityLogContactNoteCreated({ - + - A note has been added to{' '} + {sale.first_name} {sale.last_name} added note about{' '} {contact.first_name} {contact.last_name} {' '} - from {company.name} by{' '} - {sale.first_name} {sale.last_name} + from{' '} + + {company.name} + diff --git a/examples/crm/src/activity/ActivityLogDealCreated.tsx b/examples/crm/src/activity/ActivityLogDealCreated.tsx index 296d911144..2ba3a8936d 100644 --- a/examples/crm/src/activity/ActivityLogDealCreated.tsx +++ b/examples/crm/src/activity/ActivityLogDealCreated.tsx @@ -24,19 +24,26 @@ export function ActivityLogDealCreated({ width: '100%', }} > - + + {sale.first_name} {sale.last_name} added deal{' '} {deal.name} {' '} - has been added to {company.name} by{' '} - {sale.first_name} {sale.last_name} + to company{' '} + + {company.name} + diff --git a/examples/crm/src/activity/ActivityLogDealNoteCreated.tsx b/examples/crm/src/activity/ActivityLogDealNoteCreated.tsx index aa17f41413..d81aea982a 100644 --- a/examples/crm/src/activity/ActivityLogDealNoteCreated.tsx +++ b/examples/crm/src/activity/ActivityLogDealNoteCreated.tsx @@ -17,20 +17,28 @@ export function ActivityLogDealNoteCreated({ - + - A note has been added to{' '} + {sale.first_name} {sale.last_name} added note about + deal{' '} {deal.name} {' '} - from {company.name} by{' '} - {sale.first_name} {sale.last_name} + at{' '} + + {company.name} + diff --git a/examples/crm/src/activity/ActivityLogIterator.tsx b/examples/crm/src/activity/ActivityLogIterator.tsx index 5809509e4a..3728ec638e 100644 --- a/examples/crm/src/activity/ActivityLogIterator.tsx +++ b/examples/crm/src/activity/ActivityLogIterator.tsx @@ -1,4 +1,4 @@ -import { Button, List } from '@mui/material'; +import { Button, Divider, List } from '@mui/material'; import { useState } from 'react'; import { COMPANY_CREATED, @@ -30,15 +30,20 @@ export function ActivityLogIterator({ return ( {filteredActivities.map(activity => ( - + <> + + + ))} {activitiesDisplayed < activities.length && ( diff --git a/examples/crm/src/activity/ActivityLogNote.tsx b/examples/crm/src/activity/ActivityLogNote.tsx index 4190478e27..e76772aa0d 100644 --- a/examples/crm/src/activity/ActivityLogNote.tsx +++ b/examples/crm/src/activity/ActivityLogNote.tsx @@ -40,18 +40,22 @@ export function ActivityLogNote({ - {slicedText && !seeMore ? `${slicedText}...` : text} + {slicedText && !seeMore ? ( + <> + {slicedText} + ...{' '} + + see more + + + ) : ( + text + )} - - {slicedText && ( - - {seeMore ? 'See less' : 'See more'} - - )} ); diff --git a/examples/crm/src/contacts/Avatar.tsx b/examples/crm/src/contacts/Avatar.tsx index 7b3a609c18..2abd9b6f76 100644 --- a/examples/crm/src/contacts/Avatar.tsx +++ b/examples/crm/src/contacts/Avatar.tsx @@ -3,12 +3,19 @@ import { useRecordContext } from 'react-admin'; import { Contact } from '../types'; -export const Avatar = (props: { record?: Contact }) => { +export const Avatar = (props: { + record?: Contact; + width?: number; + height?: number; +}) => { const record = useRecordContext(props); if (!record) return null; return ( - + {record.first_name.charAt(0)} {record.last_name.charAt(0)}