Skip to content

Commit

Permalink
Updating preview email for closed engagement (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
VineetBala-AOT authored Dec 21, 2023
1 parent 8ea8cb5 commit 1b02c40
Showing 1 changed file with 27 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Survey } from 'models/survey';
import { formatDate } from 'components/common/dateHelper';
import { useAppSelector } from 'hooks';
import { TenantState } from 'reduxSlices/tenantSlice';
import { EngagementStatus } from 'constants/engagementStatus';

export default function EmailPreview({
survey,
Expand All @@ -18,6 +19,8 @@ export default function EmailPreview({
}) {
const scheduledDate = formatDate(survey.engagement?.scheduled_date || '', 'MMM DD YYYY');
const tenant: TenantState = useAppSelector((state) => state.tenant);
const isClosed = survey.engagement?.engagement_status.id === EngagementStatus.Closed;
const engagementName = survey.engagement?.name || '';
return (
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
<Box style={container}>
Expand All @@ -34,27 +37,38 @@ export default function EmailPreview({
</Stack>
<Grid item xs={12}>
<MetBody sx={{ mb: 1 }}>
Thank you for taking the time to provide your feedback on {survey.engagement?.name || ''}.
Thank you for taking the time to provide your feedback on {engagementName}.
</MetBody>
</Grid>
{children}
<Grid item xs={12}>
<MetBody sx={{ mb: 2 }}>
You can edit and re-submit your feedback. The comment period is open until {scheduledDate}. You
must re-submit your feedback before the comment period closes.
{!isClosed ? (
<>
You can edit and re-submit your feedback. The comment period is open until {''}
{scheduledDate}. You must re-submit your feedback before the comment period closes.
</>
) : (
<>
We are sorry, but the public commenting period for {engagementName} is now closed and
your feedback cannot be edited.
</>
)}
</MetBody>
</Grid>
<Grid item xs={12}>
<MetBody
sx={{
borderLeft: '4px solid grey',
paddingLeft: '8px',
color: '#555',
mb: 2,
}}
>
<Link>Edit your feedback</Link>
</MetBody>
{!isClosed ? (
<MetBody
sx={{
borderLeft: '4px solid grey',
paddingLeft: '8px',
color: '#555',
mb: 2,
}}
>
<Link>Edit your feedback</Link>
</MetBody>
) : null}
</Grid>
<Grid item xs={12}>
<MetBody sx={{ mb: 1 }}>Thank you,</MetBody>
Expand Down

0 comments on commit 1b02c40

Please sign in to comment.