Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MPDX-8207 fixSendNewsletter stop hiding content #1064

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
172 changes: 83 additions & 89 deletions src/components/Tool/FixSendNewsletter/Contact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,109 +197,103 @@ 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>
<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>
)}
{contact.primaryPerson?.primaryEmailAddress?.email && (
<Link
underline="hover"
href={`mailto:${contact.primaryPerson.primaryEmailAddress?.email}`}
href={`mailto:${contact.primaryPerson.primaryEmailAddress.email}`}
>
<Typography variant="body2">
{contact.primaryPerson.primaryEmailAddress?.email || ''}
{contact.primaryPerson?.primaryEmailAddress.email}
</Typography>
</Link>
{contact.primaryPerson.optoutEnewsletter && (
<Typography variant="body2">
{t('opted out of newsletter')}
</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 && (
)}
{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
Loading