Skip to content

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

Prepare for MUI v6

Gildas370b55e6d0dd
diff --git a/src/companies/CompanyShow.tsx b/src/companies/CompanyShow.tsx
index 84416127..3a8110b3 100644
--- a/src/companies/CompanyShow.tsx
+++ b/src/companies/CompanyShow.tsx
@@ -7,6 +7,7 @@ import {
List,
ListItem,
ListItemAvatar,
+ ListItemButton,
ListItemSecondaryAction,
ListItemText,
Stack,
@@ -142,43 +143,46 @@ const ContactsIterator = () => {
<List dense sx={{ pt: 0 }}>
{contacts.map(contact => (
<RecordContextProvider key={contact.id} value={contact}>
- <ListItem
- button
- component={RouterLink}
- to={`/contacts/${contact.id}/show`}
- state={{ from: location.pathname }}
- >
- <ListItemAvatar>
- <Avatar />
- </ListItemAvatar>
- <ListItemText
- primary={`${contact.first_name} ${contact.last_name}`}
- secondary={
- <>
- {contact.title}
- {contact.nb_tasks
- ? ` - ${contact.nb_tasks} task${
- contact.nb_tasks > 1 ? 's' : ''
- }`
- : ''}
- &nbsp; &nbsp;
- <TagsList />
- </>
- }
- />
- {contact.last_seen && (
- <ListItemSecondaryAction>
- <Typography
- variant="body2"
- color="textSecondary"
- component="span"
- >
- last activity{' '}
- {formatDistance(contact.last_seen, now)} ago{' '}
- <Status status={contact.status} />
- </Typography>
- </ListItemSecondaryAction>
- )}
+ <ListItem disablePadding>
+ <ListItemButton
+ component={RouterLink}
+ to={`/contacts/${contact.id}/show`}
+ state={{ from: location.pathname }}
+ >
+ <ListItemAvatar>
+ <Avatar />
+ </ListItemAvatar>
+ <ListItemText
+ primary={`${contact.first_name} ${contact.last_name}`}
+ secondary={
+ <>
+ {contact.title}
+ {contact.nb_tasks
+ ? ` - ${contact.nb_tasks} task${
+ contact.nb_tasks > 1
+ ? 's'
+ : ''
+ }`
+ : ''}
+ &nbsp; &nbsp;
+ <TagsList />
+ </>
+ }
+ />
+ {contact.last_seen && (
+ <ListItemSecondaryAction>
+ <Typography
+ variant="body2"
+ color="textSecondary"
+ component="span"
+ >
+ last activity{' '}
+ {formatDistance(contact.last_seen, now)}{' '}
+ ago <Status status={contact.status} />
+ </Typography>
+ </ListItemSecondaryAction>
+ )}
+ </ListItemButton>
</ListItem>
</RecordContextProvider>
))}
@@ -212,38 +216,40 @@ const DealsIterator = () => {
<Box>
<List dense>
{deals.map(deal => (
- <ListItem
- button
- key={deal.id}
- component={RouterLink}
- to={`/deals/${deal.id}/show`}
- >
- <ListItemText
- primary={deal.name}
- secondary={
- <>
- {findDealLabel(dealStages, deal.stage)},{' '}
- {deal.amount.toLocaleString('en-US', {
- notation: 'compact',
- style: 'currency',
- currency: 'USD',
- currencyDisplay: 'narrowSymbol',
- minimumSignificantDigits: 3,
- })}
- {deal.category ? `, ${deal.category}` : ''}
- </>
- }
- />
- <ListItemSecondaryAction>
- <Typography
- variant="body2"
- color="textSecondary"
- component="span"
- >
- last activity{' '}
- {formatDistance(deal.updated_at, now)} ago{' '}
- </Typography>
- </ListItemSecondaryAction>
+ <ListItem disablePadding key={deal.id}>
+ <ListItemButton
+ component={RouterLink}
+ to={`/deals/${deal.id}/show`}
+ >
+ <ListItemText
+ primary={deal.name}
+ secondary={
+ <>
+ {findDealLabel(dealStages, deal.stage)},{' '}
+ {deal.amount.toLocaleString('en-US', {
+ notation: 'compact',
+ style: 'currency',
+ currency: 'USD',
+ currencyDisplay: 'narrowSymbol',
+ minimumSignificantDigits: 3,
+ })}
+ {deal.category
+ ? `, ${deal.category}`
+ : ''}
+ </>
+ }
+ />
+ <ListItemSecondaryAction>
+ <Typography
+ variant="body2"
+ color="textSecondary"
+ component="span"
+ >
+ last activity{' '}
+ {formatDistance(deal.updated_at, now)} ago{' '}
+ </Typography>
+ </ListItemSecondaryAction>
+ </ListItemButton>
</ListItem>
))}
</List>
diff --git a/src/contacts/ContactListContent.tsx b/src/contacts/ContactListContent.tsx
index 33cc780c..127f772c 100644
--- a/src/contacts/ContactListContent.tsx
+++ b/src/contacts/ContactListContent.tsx
@@ -5,6 +5,7 @@ import {
List,
ListItem,
ListItemAvatar,
+ ListItemButton,
ListItemIcon,
ListItemSecondaryAction,
ListItemText,
@@ -50,76 +51,79 @@ export const ContactListContent = () => {
<List dense>
{contacts.map(contact => (
<RecordContextProvider key={contact.id} value={contact}>
- <ListItem
- button
- component={Link}
- to={`/contacts/${contact.id}/show`}
- >
- <ListItemIcon sx={{ minWidth: '2.5em' }}>
- <Checkbox
- edge="start"
- checked={selectedIds.includes(contact.id)}
- tabIndex={-1}
- disableRipple
- onClick={e => {
- e.stopPropagation();
- onToggleItem(contact.id);
- }}
- />
- </ListItemIcon>
- <ListItemAvatar>
- <Avatar />
- </ListItemAvatar>
- <ListItemText
- primary={`${contact.first_name} ${contact.last_name ?? ''}`}
- secondary={
- <>
- {contact.title}
- {contact.title &&
- contact.company_id != null &&
- ' at '}
- {contact.company_id != null && (
- <ReferenceField
- source="company_id"
- reference="companies"
- link={false}
- >
- <TextField source="name" />
- </ReferenceField>
+ <ListItem disablePadding>
+ <ListItemButton
+ component={Link}
+ to={`/contacts/${contact.id}/show`}
+ >
+ <ListItemIcon sx={{ minWidth: '2.5em' }}>
+ <Checkbox
+ edge="start"
+ checked={selectedIds.includes(
+ contact.id
)}
- {contact.nb_tasks
- ? ` - ${contact.nb_tasks} task${
- contact.nb_tasks > 1
- ? 's'
- : ''
- }`
- : ''}
- &nbsp;&nbsp;
- <TagsList />
- </>
- }
- />
- {contact.last_seen && (
- <ListItemSecondaryAction
- sx={{
- top: '10px',
- transform: 'none',
- }}
- >
- <Typography
- variant="body2"
- color="textSecondary"
- title={contact.last_seen}
+ tabIndex={-1}
+ disableRipple
+ onClick={e => {
+ e.stopPropagation();
+ onToggleItem(contact.id);
+ }}
+ />
+ </ListItemIcon>
+ <ListItemAvatar>
+ <Avatar />
+ </ListItemAvatar>
+ <ListItemText
+ primary={`${contact.first_name} ${contact.last_name ?? ''}`}
+ secondary={
+ <>
+ {contact.title}
+ {contact.title &&
+ contact.company_id != null &&
+ ' at '}
+ {contact.company_id != null && (
+ <ReferenceField
+ source="company_id"
+ reference="companies"
+ link={false}
+ >
+ <TextField source="name" />
+ </ReferenceField>
+ )}
+ {contact.nb_tasks
+ ? ` - ${contact.nb_tasks} task${
+ contact.nb_tasks > 1
+ ? 's'
+ : ''
+ }`
+ : ''}
+ &nbsp;&nbsp;
+ <TagsList />
+ </>
+ }
+ />
+ {contact.last_seen && (
+ <ListItemSecondaryAction
+ sx={{
+ top: '10px',
+ transform: 'none',
+ }}
>
- {!isSmall && 'last activity '}
- {formatRelative(
- contact.last_seen,
- now
- )}{' '}
- <Status status={contact.status} />
- </Typography>
- </ListItemSecondaryAction>
- )}
+ <Typography
+ variant="body2"
+ color="textSecondary"
+ title={contact.last_seen}
+ >
+ {!isSmall && 'last activity '}
+ {formatRelative(
+ contact.last_seen,
+ now
+ )}{' '}
+ <Status status={contact.status} />
+ </Typography>
+ </ListItemSecondaryAction>
+ )}
+ </ListItemButton>
</ListItem>
</RecordContextProvider>
))}