| 1 | import { Section, Text } from '@react-email/components' |
| 2 | import { env } |
| 3 | import { ActionButton, EmailLayout |
| 4 | |
| 5 | const baseUrl = env |
| 6 | |
| 7 | interface MemberRoleChangedEmailProps { |
| 8 | changedByName: string |
| 9 | memberName: string |
| 10 | newRole: string |
| 11 | oldRole: string |
| 12 | organizationName: string |
| 13 | orgSlug: string |
| 14 | } |
| 15 | |
| 16 | const roleLabelMap: Record |
| 17 | owner: 'Owner', |
| 18 | admin: 'Admin', |
| 19 | member: 'Team Member', |
| 20 | client: 'Stakeholder', |
| 21 | } |
| 22 | |
| 23 | export default function MemberRoleChangedEmail |
| 24 | memberName = 'Jane Smith' |
| 25 | organizationName = 'Acme Studio' |
| 26 | oldRole = 'member' |
| 27 | newRole = 'admin' |
| 28 | changedByName = 'John Doe' |
| 29 | orgSlug = 'acme' |
| 30 | }: MemberRoleChangedEmailProps) |
| 31 | const oldLabel = |
| 32 | const newLabel = |
| 33 | |
| 34 | return ( |
| 35 | <EmailLayout |
| 36 | heading='Your role has been updated' |
| 37 | preview={`Your role in ${organizationName |
| 38 | > |
| 39 | <Text style={ |
| 40 | Hi {memberName}, <span |
| 41 | updated your role in <span style={text |
| 42 | . |
| 43 | </Text> |
| 44 | <Section style={ |
| 45 | <table |
| 46 | cellPadding={0} |
| 47 | cellSpacing={0} |
| 48 | style={{ width: |
| 49 | > |
| 50 | <tbody> |
| 51 | <tr> |
| 52 | <td style={roleBox |
| 53 | <Text style={ |
| 54 | <Text style={ |
| 55 | </td> |
| 56 | <td style={arrow |
| 57 | <td style={roleBox |
| 58 | <Text style={ |
| 59 | <Text style={ |
| 60 | {newLabel} |
| 61 | </Text> |
| 62 | </td> |
| 63 | </tr> |
| 64 | </tbody> |
| 65 | </table> |
| 66 | </Section> |
| 67 | <ActionButton href={ |
| 68 | Go to {organizationName} |
| 69 | </ActionButton> |
| 70 | </EmailLayout> |
| 71 | ) |
| 72 | } |
| 73 | |
| 74 | const roleChangeSection = { |
| 75 | margin: '8px 0 8px', |
| 76 | } |
| 77 | |
| 78 | const roleBox = { |
| 79 | backgroundColor: '#fafafa', |
| 80 | borderRadius: '10px', |
| 81 | padding: '16px', |
| 82 | textAlign: 'center' as |
| 83 | width: '44%', |
| 84 | border: '1px solid #f4f4f5', |
| 85 | } |
| 86 | |
| 87 | const roleLabel = { |
| 88 | fontSize: '11px', |
| 89 | color: '#a1a1aa', |
| 90 | fontWeight: '600' as |
| 91 | textTransform: 'uppercase' as |
| 92 | letterSpacing: '0.5px', |
| 93 | margin: '0 0 4px', |
| 94 | } |
| 95 | |
| 96 | const roleName = { |
| 97 | fontSize: '16px', |
| 98 | fontWeight: '700' as |
| 99 | color: '#18181b', |
| 100 | margin: '0', |
| 101 | } |
| 102 | |
| 103 | const arrow = { |
| 104 | textAlign: 'center' as |
| 105 | fontSize: '18px', |
| 106 | color: '#a1a1aa', |
| 107 | width: '12%', |
| 108 | verticalAlign: 'middle' as |
| 109 | } |