From 1b02c40924d6fbac90c0154af45042cc17e8219b Mon Sep 17 00:00:00 2001 From: VineetBala-AOT <90332175+VineetBala-AOT@users.noreply.github.com> Date: Thu, 21 Dec 2023 10:21:15 -0800 Subject: [PATCH] Updating preview email for closed engagement (#41) --- .../review/emailPreview/EmailPreview.tsx | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/met-web/src/components/comments/admin/review/emailPreview/EmailPreview.tsx b/met-web/src/components/comments/admin/review/emailPreview/EmailPreview.tsx index 82cbaa7b1..37a7f8799 100644 --- a/met-web/src/components/comments/admin/review/emailPreview/EmailPreview.tsx +++ b/met-web/src/components/comments/admin/review/emailPreview/EmailPreview.tsx @@ -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, @@ -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 ( @@ -34,27 +37,38 @@ export default function EmailPreview({ - 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}. {children} - 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. + + )} - - Edit your feedback - + {!isClosed ? ( + + Edit your feedback + + ) : null} Thank you,