Skip to content

Commit

Permalink
fixSendNewsletter stop hiding content
Browse files Browse the repository at this point in the history
  • Loading branch information
caleballdrin committed Sep 13, 2024
1 parent d8322b7 commit da3123a
Showing 1 changed file with 85 additions and 93 deletions.
178 changes: 85 additions & 93 deletions src/components/Tool/FixSendNewsletter/Contact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,109 +197,101 @@ const Contact = ({
className={classes.minimalPadding}
sx={{ backgroundColor: theme.palette.cruGrayLight.main }}
>
{contact.primaryPerson && (
<Grid container alignItems="center">
<Grid item xs={6} sm={5} md={4}>
<Box
display="flex"
alignItems="center"
style={{ height: '100%' }}
>
{contact.primaryPerson.firstName && matches && (
<Avatar
src={contact?.avatar}
style={{
width: theme.spacing(4),
height: theme.spacing(4),
}}
/>
)}
<Box display="flex" flexDirection="column" ml={2}>
<Typography variant="subtitle1">
{`${contact.primaryPerson.firstName} ${contact.primaryPerson.lastName}`}
</Typography>
<Link
underline="hover"
href={`mailto:${contact.primaryPerson.primaryEmailAddress?.email}`}
>
<Typography variant="body2">
{contact.primaryPerson.primaryEmailAddress?.email || ''}
</Typography>
</Link>
{contact.primaryPerson.optoutEnewsletter && (
<Typography variant="body2">
{t('opted out of newsletter')}
<Grid container alignItems="center">
<Grid item xs={6} sm={5} md={4}>
<Box display="flex" alignItems="center" style={{ height: '100%' }}>
{contact.primaryPerson?.firstName && matches && (
<Avatar
src={contact?.avatar}
style={{
width: theme.spacing(4),
height: theme.spacing(4),
}}
/>
)}
<Box display="flex" flexDirection="column" ml={2}>
{contact.primaryPerson?.firstName &&
contact.primaryPerson?.lastName && (
<Typography variant="subtitle1">
{`${contact.primaryPerson?.firstName} ${contact.primaryPerson?.lastName}`}
</Typography>
)}
</Box>
</Box>
</Grid>
<Grid item xs={6} sm={4} md={4}>
<Box
display="flex"
alignItems="start"
flexDirection="column"
p={2}
>
<Typography variant="body2">
{contact?.primaryAddress?.street || ''}
</Typography>
<Typography variant="body2">
{`${contact.primaryAddress?.city || ''} ${
contact.primaryAddress?.state
? contact.primaryAddress.state
: ''
} ${contact.primaryAddress?.postalCode || ''}`}
</Typography>
<Typography variant="body2">
{contact.primaryAddress?.country || ''}
</Typography>
{contact.primaryAddress?.source && (
<Link
underline="hover"
href={`mailto:${contact.primaryPerson?.primaryEmailAddress?.email}`}
>
<Typography variant="body2">
{contact.primaryPerson?.primaryEmailAddress?.email || ''}
</Typography>
</Link>
{contact.primaryPerson?.optoutEnewsletter && (
<Typography variant="body2">
<Trans
defaults="<bold>Source:</bold> {{where}} ({{date}})"
shouldUnescape
values={{
where: contact?.primaryAddress?.source,
date: dateFormatShort(
DateTime.fromISO(contact?.primaryAddress?.createdAt),
locale,
),
}}
components={{ bold: <strong /> }}
/>
{t('opted out of newsletter')}
</Typography>
)}
</Box>
</Grid>
<Grid item xs={12} sm={3} md={4} sx={{ textAlign: 'right' }}>
</Box>
</Grid>
<Grid item xs={6} sm={4} md={4}>
<Box display="flex" alignItems="start" flexDirection="column" p={2}>
<Typography variant="body2">
<Trans
defaults="<bold>Send newsletter?</bold>"
components={{ bold: <strong /> }}
/>
{contact?.primaryAddress?.street || ''}
</Typography>
<Typography variant="body2">
{`${contact.primaryAddress?.city || ''} ${
contact.primaryAddress?.state
? contact.primaryAddress.state
: ''
} ${contact.primaryAddress?.postalCode || ''}`}
</Typography>
<Typography variant="body2">
{contact.primaryAddress?.country || ''}
</Typography>
{contact.primaryAddress?.source && (
<Typography variant="body2">
<Trans
defaults="<bold>Source:</bold> {{where}} ({{date}})"
shouldUnescape
values={{
where: contact?.primaryAddress?.source,
date: dateFormatShort(
DateTime.fromISO(contact?.primaryAddress?.createdAt),
locale,
),
}}
components={{ bold: <strong /> }}
/>
</Typography>
)}
</Box>
</Grid>
<Grid item xs={12} sm={3} md={4} sx={{ textAlign: 'right' }}>
<Typography variant="body2">
<Trans
defaults="<bold>Send newsletter?</bold>"
components={{ bold: <strong /> }}
/>
</Typography>

<Select
className={classes.select}
value={newsletter}
onChange={handleChange}
size="small"
>
{Object.values(SendNewsletterEnum).map((value) => (
<MenuItem key={value} value={value}>
{getLocalizedSendNewsletter(t, value)}
</MenuItem>
))}
</Select>
<Box
display="flex"
flexDirection="column"
style={{ paddingLeft: theme.spacing(1), textAlign: 'right' }}
></Box>
</Grid>
<Select
className={classes.select}
value={newsletter}
onChange={handleChange}
size="small"
>
{Object.values(SendNewsletterEnum).map((value) => (
<MenuItem key={value} value={value}>
{getLocalizedSendNewsletter(t, value)}
</MenuItem>
))}
</Select>
<Box
display="flex"
flexDirection="column"
style={{ paddingLeft: theme.spacing(1), textAlign: 'right' }}
></Box>
</Grid>
)}
</Grid>
</CardContent>
</Card>
);
Expand Down

0 comments on commit da3123a

Please sign in to comment.