|
4 | 4 | Checkbox, |
5 | 5 | List, |
6 | 6 | ListItem, |
| 7 | + ListItemButton, |
7 | 8 | ListItemAvatar, |
8 | 9 | ListItemIcon, |
9 | 10 | ListItemSecondaryAction, |
@@ -50,76 +51,79 @@ export const ContactListContent = () => { |
50 | 51 | <List dense> |
51 | 52 | {contacts.map(contact => ( |
52 | 53 | <RecordContextProvider key={contact.id} value={contact}> |
53 | | - <ListItem |
54 | | - button |
55 | | - component={Link} |
56 | | - to={`/contacts/${contact.id}/show`} |
57 | | - > |
58 | | - <ListItemIcon sx={{ minWidth: '2.5em' }}> |
59 | | - <Checkbox |
60 | | - edge="start" |
61 | | - checked={selectedIds.includes(contact.id)} |
62 | | - tabIndex={-1} |
63 | | - disableRipple |
64 | | - onClick={e => { |
65 | | - e.stopPropagation(); |
66 | | - onToggleItem(contact.id); |
67 | | - }} |
68 | | - /> |
69 | | - </ListItemIcon> |
70 | | - <ListItemAvatar> |
71 | | - <Avatar /> |
72 | | - </ListItemAvatar> |
73 | | - <ListItemText |
74 | | - primary={`${contact.first_name} ${contact.last_name ?? ''}`} |
75 | | - secondary={ |
76 | | - <> |
77 | | - {contact.title} |
78 | | - {contact.title && |
79 | | - contact.company_id != null && |
80 | | - ' at '} |
81 | | - {contact.company_id != null && ( |
82 | | - <ReferenceField |
83 | | - source="company_id" |
84 | | - reference="companies" |
85 | | - link={false} |
86 | | - > |
87 | | - <TextField source="name" /> |
88 | | - </ReferenceField> |
| 54 | + <ListItem disablePadding> |
| 55 | + <ListItemButton |
| 56 | + component={Link} |
| 57 | + to={`/contacts/${contact.id}/show`} |
| 58 | + > |
| 59 | + <ListItemIcon sx={{ minWidth: '2.5em' }}> |
| 60 | + <Checkbox |
| 61 | + edge="start" |
| 62 | + checked={selectedIds.includes( |
| 63 | + contact.id |
89 | 64 | )} |
90 | | - {contact.nb_tasks |
91 | | - ? ` - ${contact.nb_tasks} task${ |
92 | | - contact.nb_tasks > 1 |
93 | | - ? 's' |
94 | | - : '' |
95 | | - }` |
96 | | - : ''} |
97 | | - |
98 | | - <TagsList /> |
99 | | - </> |
100 | | - } |
101 | | - /> |
102 | | - {contact.last_seen && ( |
103 | | - <ListItemSecondaryAction |
104 | | - sx={{ |
105 | | - top: '10px', |
106 | | - transform: 'none', |
107 | | - }} |
108 | | - > |
109 | | - <Typography |
110 | | - variant="body2" |
111 | | - color="textSecondary" |
112 | | - title={contact.last_seen} |
| 65 | + tabIndex={-1} |
| 66 | + disableRipple |
| 67 | + onClick={e => { |
| 68 | + e.stopPropagation(); |
| 69 | + onToggleItem(contact.id); |
| 70 | + }} |
| 71 | + /> |
| 72 | + </ListItemIcon> |
| 73 | + <ListItemAvatar> |
| 74 | + <Avatar /> |
| 75 | + </ListItemAvatar> |
| 76 | + <ListItemText |
| 77 | + primary={`${contact.first_name} ${contact.last_name ?? ''}`} |
| 78 | + secondary={ |
| 79 | + <> |
| 80 | + {contact.title} |
| 81 | + {contact.title && |
| 82 | + contact.company_id != null && |
| 83 | + ' at '} |
| 84 | + {contact.company_id != null && ( |
| 85 | + <ReferenceField |
| 86 | + source="company_id" |
| 87 | + reference="companies" |
| 88 | + link={false} |
| 89 | + > |
| 90 | + <TextField source="name" /> |
| 91 | + </ReferenceField> |
| 92 | + )} |
| 93 | + {contact.nb_tasks |
| 94 | + ? ` - ${contact.nb_tasks} task${ |
| 95 | + contact.nb_tasks > 1 |
| 96 | + ? 's' |
| 97 | + : '' |
| 98 | + }` |
| 99 | + : ''} |
| 100 | + |
| 101 | + <TagsList /> |
| 102 | + </> |
| 103 | + } |
| 104 | + /> |
| 105 | + {contact.last_seen && ( |
| 106 | + <ListItemSecondaryAction |
| 107 | + sx={{ |
| 108 | + top: '10px', |
| 109 | + transform: 'none', |
| 110 | + }} |
113 | 111 | > |
114 | | - {!isSmall && 'last activity '} |
115 | | - {formatRelative( |
116 | | - contact.last_seen, |
117 | | - now |
118 | | - )}{' '} |
119 | | - <Status status={contact.status} /> |
120 | | - </Typography> |
121 | | - </ListItemSecondaryAction> |
122 | | - )} |
| 112 | + <Typography |
| 113 | + variant="body2" |
| 114 | + color="textSecondary" |
| 115 | + title={contact.last_seen} |
| 116 | + > |
| 117 | + {!isSmall && 'last activity '} |
| 118 | + {formatRelative( |
| 119 | + contact.last_seen, |
| 120 | + now |
| 121 | + )}{' '} |
| 122 | + <Status status={contact.status} /> |
| 123 | + </Typography> |
| 124 | + </ListItemSecondaryAction> |
| 125 | + )} |
| 126 | + </ListItemButton> |
123 | 127 | </ListItem> |
124 | 128 | </RecordContextProvider> |
125 | 129 | ))} |
|
0 commit comments