1
- import { $Enums } from '@prisma/client' ;
2
1
import { Button , Heading , Text , Link } from '@react-email/components' ;
3
2
import * as React from 'react' ;
4
3
import Closing from '@/emails/_components/Closing' ;
@@ -9,43 +8,34 @@ import QuotaChanges from '@/emails/_components/Edit/QuotaChanges';
9
8
import { comparePrivateCloudProjects } from '@/emails/_components/Edit/utils/compare-projects' ;
10
9
import Layout from '@/emails/_components/layout/Layout' ;
11
10
import ProductDetails from '@/emails/_components/ProductDetails' ;
12
- import { isQuotaUpgrade } from '@/helpers/quota-change' ;
13
11
import { PrivateCloudRequestDetail } from '@/types/private-cloud' ;
14
12
15
13
interface EmailProp {
16
14
request : PrivateCloudRequestDetail ;
17
15
}
18
16
19
- const RequestApprovalTemplate = ( { request } : EmailProp ) => {
17
+ const EditRequestApprovalTemplate = ( { request } : EmailProp ) => {
20
18
if ( ! request || ! request . project || ! request . decisionData ) return < > </ > ;
21
19
const current = request . project ;
22
20
const requested = request . decisionData ;
23
21
const changed = comparePrivateCloudProjects ( current , requested ) ;
24
- const isQuotaUpgraded = isQuotaUpgrade ( requested , current ) ;
25
22
const requestComment = request . requestComment ?? undefined ;
26
-
27
23
const hasQuotaChanged =
28
24
changed . productionQuota || changed . testQuota || changed . developmentQuota || changed . toolsQuota ;
29
25
30
26
return (
31
27
< Layout >
32
28
< div className = "pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300" >
33
- < Heading className = "text-lg text-black" > Success! Your request was approved!</ Heading >
29
+ < Heading className = "text-lg text-black" > Success! Your edit request was approved!</ Heading >
34
30
< Text > Hi Product Team, </ Text >
35
31
< Text className = "" >
36
- We are pleased to inform you that your
37
- { ( request . type === $Enums . RequestType . CREATE || request . type === $Enums . RequestType . DELETE ) &&
38
- `request for your product ${ ! hasQuotaChanged ? request . decisionData . name : ' ' } ` }
39
- { hasQuotaChanged && 'request for a resource quota' } has been approved on the Private Cloud OpenShift platform.
40
- You can now log in to{ ' ' }
32
+ We are pleased to inform you that your request for a resource quota has been approved on the Private Cloud
33
+ OpenShift platform. Please allow 3-5 minutes for the request to be processed. If it takes longer, don't
34
+ hesitate to reach out to us. You can now log in to{ ' ' }
41
35
< Link className = "mt-0 h-4" href = { `https://console.apps.${ request . decisionData . cluster } .devops.gov.bc.ca/` } >
42
36
OpenShift cluster console{ ' ' }
43
37
</ Link > { ' ' }
44
- { hasQuotaChanged ? 'and you will see your new resource quota values.' : 'to manage your product.' }
45
- </ Text >
46
- < Text >
47
- Please allow 3-5 minutes for the request to be processed. If it takes longer, don't hesitate to reach out
48
- to us.
38
+ and you will see your new resource quota values.
49
39
</ Text >
50
40
< Text className = "" >
51
41
If you have any more questions or need assistance, please reach out to the Platform Services team in the
@@ -69,13 +59,13 @@ const RequestApprovalTemplate = ({ request }: EmailProp) => {
69
59
tl2 = { request . decisionData . secondaryTechnicalLead }
70
60
/>
71
61
</ div >
72
- { ! isQuotaUpgraded && requestComment && (
62
+ { requestComment && (
73
63
< div className = "pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300" >
74
64
< Heading className = "text-lg text-black" > Comments</ Heading >
75
65
< Comment requestComment = { requestComment } />
76
66
</ div >
77
67
) }
78
- { ! isQuotaUpgraded && ( changed . name || changed . description || changed . ministry || changed . cluster ) && (
68
+ { ( changed . name || changed . description || changed . ministry || changed . cluster ) && (
79
69
< div className = "pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300" >
80
70
< DescriptionChanges
81
71
nameCurrent = { current . name }
@@ -87,19 +77,18 @@ const RequestApprovalTemplate = ({ request }: EmailProp) => {
87
77
/>
88
78
</ div >
89
79
) }
90
- { ! isQuotaUpgraded &&
91
- ( changed . projectOwnerId || changed . primaryTechnicalLeadId || changed . secondaryTechnicalLeadId ) && (
92
- < div className = "pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300" >
93
- < ContactChanges
94
- poCurrent = { current . projectOwner }
95
- tl1Current = { current . primaryTechnicalLead }
96
- tl2Current = { current ?. secondaryTechnicalLead }
97
- poRequested = { requested . projectOwner }
98
- tl1Requested = { requested . primaryTechnicalLead }
99
- tl2Requested = { requested ?. secondaryTechnicalLead }
100
- />
101
- </ div >
102
- ) }
80
+ { ( changed . projectOwnerId || changed . primaryTechnicalLeadId || changed . secondaryTechnicalLeadId ) && (
81
+ < div className = "pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300" >
82
+ < ContactChanges
83
+ poCurrent = { current . projectOwner }
84
+ tl1Current = { current . primaryTechnicalLead }
85
+ tl2Current = { current ?. secondaryTechnicalLead }
86
+ poRequested = { requested . projectOwner }
87
+ tl1Requested = { requested . primaryTechnicalLead }
88
+ tl2Requested = { requested ?. secondaryTechnicalLead }
89
+ />
90
+ </ div >
91
+ ) }
103
92
{ hasQuotaChanged && (
104
93
< div className = "pb-6 mt-4 mb-4 border-solid border-0 border-b-1 border-slate-300" >
105
94
< h3 className = "mb-0 text-black" > Resource quota changes</ h3 >
@@ -158,4 +147,4 @@ const RequestApprovalTemplate = ({ request }: EmailProp) => {
158
147
) ;
159
148
} ;
160
149
161
- export default RequestApprovalTemplate ;
150
+ export default EditRequestApprovalTemplate ;
0 commit comments