-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
services/API-service/src/api/notification/email/mjml/notification-actions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
export const getMjmlNotificationAction = ({ | ||
linkDashboard, | ||
linkEapSop, | ||
socialMediaLink, | ||
socialMediaType, | ||
}: { | ||
linkDashboard: string; | ||
linkEapSop: string; | ||
socialMediaLink: string; | ||
socialMediaType: string; | ||
}): object => { | ||
const ibfPortalRow = getNotificationActionsSection( | ||
'Go to the IBF-portal', | ||
linkDashboard, | ||
'Find more information about the potentially exposed areas, view the map and manage anticipatory actions.', | ||
); | ||
|
||
const socialMediaRow = getNotificationActionsSection( | ||
`Join ${socialMediaType} group`, | ||
socialMediaLink, | ||
'Communicate with relevant others about the trigger.', | ||
); | ||
|
||
const aboutTriggerRow = getNotificationActionsSection( | ||
`About Trigger`, | ||
linkEapSop, | ||
'Read about the trigger methodology and the anticipatory actions.', | ||
); | ||
|
||
return { | ||
tagName: 'mj-section', | ||
children: [ | ||
{ | ||
tagName: 'mj-column', | ||
children: [ibfPortalRow, socialMediaRow, aboutTriggerRow], | ||
}, | ||
], | ||
}; | ||
}; | ||
|
||
const getNotificationActionsSection = ( | ||
buttonText: string, | ||
buttonLink: string, | ||
descriptionn: string, | ||
): object => { | ||
return { | ||
tagName: 'mj-section', | ||
children: [ | ||
{ | ||
tagName: 'mj-column', | ||
children: [ | ||
{ | ||
tagName: 'mj-button', | ||
attributes: { href: buttonLink }, | ||
content: buttonText, | ||
}, | ||
], | ||
}, | ||
{ | ||
tagName: 'mj-column', | ||
children: [ | ||
{ | ||
tagName: 'mj-text', | ||
content: descriptionn, | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
}; |