Skip to content

Commit 41718e8

Browse files
committed
Refactor ContactDrawer layout and improve extraInfo display
- Replace Paper with div for contact header section - Move edit button outside contact header for better layout - Simplify tags display by removing Paper wrapper - Refactor extraInfo rendering to use WhatsMarked and Typography - Remove redundant Paper wrappers for extraInfo and tags - Adjust button styling and placement for improved UI consistency
1 parent 7ebb529 commit 41718e8

File tree

1 file changed

+29
-37
lines changed
  • frontend/src/components/ContactDrawer

1 file changed

+29
-37
lines changed

frontend/src/components/ContactDrawer/index.js

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ const ContactDrawer = ({ open, handleDrawerClose, contact, ticket, loading }) =>
142142
<ContactDrawerSkeleton classes={classes} />
143143
) : (
144144
<div className={classes.content}>
145-
<Paper square variant="outlined" className={classes.contactHeader}>
145+
<div className={classes.contactHeader}>
146146
<CardHeader
147147
onClick={() => {}}
148-
style={{ cursor: "pointer", width: '100%' }}
148+
style={{ cursor: "pointer", width: '100%', padding: 0 }}
149149
titleTypographyProps={{ noWrap: true }}
150150
subheaderTypographyProps={{ noWrap: true }}
151151
avatar={<Avatar src={contact.profilePicUrl} alt="contact_image" style={{ width: 60, height: 60, backgroundColor: generateColor(contact?.number), color: "white", fontWeight: "bold" }}>{ getInitials(contact?.name) }</Avatar>}
@@ -167,49 +167,41 @@ const ContactDrawer = ({ open, handleDrawerClose, contact, ticket, loading }) =>
167167
</>
168168
}
169169
/>
170-
<Button
171-
variant="outlined"
172-
color="primary"
173-
onClick={() => setModalOpen(!openForm)}
174-
style={{fontSize: 12}}
175-
>
176-
{i18n.t("contactDrawer.buttons.edit")}
177-
</Button>
178-
</Paper>
170+
</div>
179171
{showTags && (
180-
<Paper square variant="outlined" className={classes.contactDetails}>
181-
<TagsContainer contact={contact} />
182-
</Paper>
172+
<TagsContainer contact={contact} />
183173
)}
174+
{contact?.extraInfo?.length > 0 &&
175+
<div
176+
className={classes.contactExtraInfo}
177+
>
178+
<Typography variant="subtitle1">
179+
{i18n.t("contactModal.form.extraInfo")}
180+
</Typography>
181+
{contact?.extraInfo?.map(info => (
182+
<WhatsMarked>{`*${info?.name}:* ${info?.value}`}</WhatsMarked>
183+
))}
184+
</div>
185+
}
186+
<Button
187+
variant="outlined"
188+
color="primary"
189+
onClick={() => setModalOpen(!openForm)}
190+
style={{fontSize: 12, marginTop: 8}}
191+
>
192+
{i18n.t("contactDrawer.buttons.edit")}
193+
</Button>
184194
<Paper square variant="outlined" className={classes.contactDetails}>
185195
<Typography variant="subtitle1" style={{marginBottom: 10}}>
186196
{i18n.t("ticketOptionsMenu.appointmentsModal.title")}
187197
</Typography>
188198
<TicketNotes ticket={ticket} />
189199
</Paper>
190-
<Paper square variant="outlined" className={classes.contactDetails}>
191-
<ContactModal
192-
open={modalOpen}
193-
onClose={() => setModalOpen(false)}
194-
contactId={contact.id}
195-
></ContactModal>
196-
<Typography variant="subtitle1">
197-
{i18n.t("contactDrawer.extraInfo")}
198-
</Typography>
199-
{contact?.extraInfo?.map(info => (
200-
<Paper
201-
key={info.id}
202-
square
203-
variant="outlined"
204-
className={classes.contactExtraInfo}
205-
>
206-
<InputLabel>{info.name}</InputLabel>
207-
<Typography component="div" noWrap style={{ paddingTop: 2 }}>
208-
<WhatsMarked>{info.value}</WhatsMarked>
209-
</Typography>
210-
</Paper>
211-
))}
212-
</Paper>
200+
<ContactModal
201+
open={modalOpen}
202+
onClose={() => setModalOpen(false)}
203+
contactId={contact.id}
204+
></ContactModal>
213205
</div>
214206
)}
215207
</Drawer>

0 commit comments

Comments
 (0)