@@ -5,42 +5,42 @@ import classNames from 'classnames';
5
5
import Slider from './Slider' ;
6
6
7
7
const plans = [
8
- {
9
- name : 'Core package' ,
10
- description : 'Your own hosted dedicated Windmill cluster without restrictions or maintenance.' ,
11
- price : 600
12
- }
8
+ {
9
+ name : 'Core package' ,
10
+ description : 'Your own hosted dedicated Windmill cluster without restrictions or maintenance.' ,
11
+ price : 600
12
+ }
13
13
] ;
14
14
15
15
function calculatePrice ( monthlyPrice , period , tierId ) {
16
- if ( period === 'annually' ) {
17
- if ( tierId === 'tier-team' ) {
18
- return monthlyPrice * 12 ; // For 'tier-team', multiply by 12
19
- }
20
- return monthlyPrice * 10 ; // Default annual calculation
21
- }
22
- return monthlyPrice ; // Monthly pricing remains unchanged
16
+ if ( period === 'annually' ) {
17
+ if ( tierId === 'tier-team' ) {
18
+ return monthlyPrice * 12 ; // For 'tier-team', multiply by 12
19
+ }
20
+ return monthlyPrice * 10 ; // Default annual calculation
21
+ }
22
+ return monthlyPrice ; // Monthly pricing remains unchanged
23
23
}
24
24
25
25
const priceFormatter = new Intl . NumberFormat ( 'en-US' , {
26
- style : 'currency' ,
27
- currency : 'USD' ,
28
- minimumFractionDigits : 0 ,
29
- maximumFractionDigits : 0
26
+ style : 'currency' ,
27
+ currency : 'USD' ,
28
+ minimumFractionDigits : 0 ,
29
+ maximumFractionDigits : 0
30
30
} ) ;
31
31
32
32
export default function PriceCalculator ( { period, tier } ) {
33
- const [ selected , setSelected ] = useState ( plans [ 0 ] ) ;
34
- const [ seats , setSeats ] = useState ( tier . price . seat ? tier . price . seat . default : 2 ) ;
35
- const [ vCPUs , setvCPUs ] = useState ( tier . price . vCPU ? tier . price . vCPU . default : 2 ) ;
33
+ const [ selected , setSelected ] = useState ( plans [ 0 ] ) ;
34
+ const [ seats , setSeats ] = useState ( tier . price . seat ? tier . price . seat . default : 2 ) ;
35
+ const [ vCPUs , setvCPUs ] = useState ( tier . price . vCPU ? tier . price . vCPU . default : 2 ) ;
36
36
37
- function computeTotalPrice ( ) {
37
+ function computeTotalPrice ( ) {
38
38
let total = 0 ;
39
-
39
+
40
40
if ( tier . id === 'tier-team' ) {
41
41
// For 'tier-team', calculate the base price, adjusting for the period
42
42
total = calculatePrice ( tier . minPrice , period . value , tier . id ) ;
43
-
43
+
44
44
// Calculate seat price, assuming the first seat's cost is included in the base price for 'tier-team' only
45
45
if ( tier . price . seat ) {
46
46
// Adjust the total calculation by adding seat costs only for additional seats beyond the first
@@ -52,56 +52,56 @@ export default function PriceCalculator({ period, tier }) {
52
52
if ( tier . id === 'tier-enterprise' ) {
53
53
total = calculatePrice ( selected . price , period . value , tier . id ) ;
54
54
}
55
-
55
+
56
56
// Add full seat price for all seats without adjusting for the first seat
57
57
if ( tier . price . seat ) {
58
58
total += calculatePrice ( tier . price . seat . monthly , period . value , tier . id ) * seats ;
59
59
}
60
60
}
61
-
61
+
62
62
// Add price for vCPUs if applicable, this part remains unchanged
63
63
if ( tier . price . vCPU ) {
64
64
total += calculatePrice ( tier . price . vCPU . monthly , period . value , tier . id ) * vCPUs ;
65
65
}
66
66
return total ;
67
- }
67
+ }
68
68
69
- return (
69
+ return (
70
70
< div className = "mt-16 grow flex flex-col justify-start" >
71
71
< div className = "flex justify-between items-center" >
72
72
< h4 > Price</ h4 >
73
-
73
+
74
74
< div >
75
75
< span className = "text-2xl text-gray-900 font-semibold dark:text-white" >
76
76
{ priceFormatter . format ( computeTotalPrice ( ) ) }
77
77
</ span >
78
78
< span className = "text-md text-gray-500" >
79
79
{ period . value === 'annually' ? '/yr' : '/mo' }
80
80
</ span >
81
- </ div >
82
- </ div >
81
+ </ div >
82
+ </ div >
83
83
84
- < p className = "mt-4 flex items-baseline gap-x-1" >
85
- < ul className = "flex flex-col gap-2 w-full" >
86
- { Object . keys ( tier . price ) . map ( ( key ) => (
87
- < li key = { key } className = "flex flex-col " >
88
- < div className = "flex justify-between w-full items-center" >
89
- < div >
90
- < span className = "text-sm text-gray-600 dark:text-gray-200" >
91
- { key === 'vCPU' ? vCPUs . toLocaleString ( ) : seats . toLocaleString ( ) }
92
- </ span >
93
- < span className = "text-sm font-semibold tracking-tight text-gray-600 dark:text-gray-200" >
94
- { ' ' }
95
- { key } s:
96
- </ span >
97
- </ div >
98
- < div >
99
- < span className = "text-sm text-gray-900 font-semibold dark:text-white" >
100
- ${ calculatePrice ( tier . price [ key ] . monthly , period . value , tier . id ) }
101
- </ span >
102
- < span className = "text-sm text-gray-400" >
103
- { period . value === 'annually' ? `/yr/${ key } ` : `/mo/${ key } ` }
104
- </ span >
84
+ < div className = "mt-4 flex items-baseline gap-x-1" >
85
+ < ul className = "flex flex-col gap-2 w-full" >
86
+ { Object . keys ( tier . price ) . map ( ( key ) => (
87
+ < li key = { key } className = "flex flex-col " >
88
+ < div className = "flex justify-between w-full items-center" >
89
+ < div >
90
+ < span className = "text-sm text-gray-600 dark:text-gray-200" >
91
+ { key === 'vCPU' ? vCPUs . toLocaleString ( ) : seats . toLocaleString ( ) }
92
+ </ span >
93
+ < span className = "text-sm font-semibold tracking-tight text-gray-600 dark:text-gray-200" >
94
+ { ' ' }
95
+ { key } s:
96
+ </ span >
97
+ </ div >
98
+ < div >
99
+ < span className = "text-sm text-gray-900 font-semibold dark:text-white" >
100
+ ${ calculatePrice ( tier . price [ key ] . monthly , period . value , tier . id ) }
101
+ </ span >
102
+ < span className = "text-sm text-gray-400" >
103
+ { period . value === 'annually' ? `/yr/${ key } ` : `/mo/${ key } ` }
104
+ </ span >
105
105
</ div >
106
106
</ div >
107
107
@@ -123,7 +123,7 @@ export default function PriceCalculator({ period, tier }) {
123
123
</ li >
124
124
) ) }
125
125
</ ul >
126
- </ p >
126
+ </ div >
127
127
{ tier . id === 'tier-enterprise' ? (
128
128
< div className = "mt-8" >
129
129
< RadioGroup value = { selected } onChange = { setSelected } >
@@ -190,9 +190,10 @@ export default function PriceCalculator({ period, tier }) {
190
190
< h5 className = "font-semibold" > Summary</ h5 >
191
191
< div className = "mt-2 flex items-baseline gap-x-1" >
192
192
< div className = "text-sm text-gray-600 mt-1" >
193
- < span > { `~${
194
- seats * 10 * ( period . value === 'annually' ? 12 : 1
195
- ) . toLocaleString ( ) } k executions of 100ms per `}
193
+ < span >
194
+ { `~${
195
+ seats * 10 * ( period . value === 'annually' ? 12 : 1 ) . toLocaleString ( )
196
+ } k executions of 100ms per `}
196
197
</ span >
197
198
< span > { period . value === 'annually' ? 'year' : 'month' } </ span >
198
199
</ div >
@@ -202,7 +203,9 @@ export default function PriceCalculator({ period, tier }) {
202
203
{ seats . toLocaleString ( ) } { seats > 1 ? 'developers' : 'developer' }
203
204
</ span >
204
205
< b className = "text-sm" > OR</ b >
205
- < span className = "whitespace-nowrap text-sm" > { ( seats * 2 ) . toLocaleString ( ) } operators</ span >
206
+ < span className = "whitespace-nowrap text-sm" >
207
+ { ( seats * 2 ) . toLocaleString ( ) } operators
208
+ </ span >
206
209
</ div >
207
210
</ div >
208
211
) : null }
@@ -213,7 +216,8 @@ export default function PriceCalculator({ period, tier }) {
213
216
< div className = "mt-2 flex items-baseline gap-x-1" >
214
217
< div className = "text-sm text-gray-600 mt-1" >
215
218
< span > { `~${
216
- vCPUs * 26 * ( period . value === 'annually' ? 12 : 1 ) . toLocaleString ( ) } M executions of 100ms per `} </ span >
219
+ vCPUs * 26 * ( period . value === 'annually' ? 12 : 1 ) . toLocaleString ( )
220
+ } M executions of 100ms per `} </ span >
217
221
< span > { period . value === 'annually' ? 'year' : 'month' } </ span >
218
222
</ div >
219
223
</ div >
@@ -222,7 +226,9 @@ export default function PriceCalculator({ period, tier }) {
222
226
{ seats . toLocaleString ( ) } { seats > 1 ? 'developers' : 'developer' }
223
227
</ span >
224
228
< b className = "text-sm" > OR</ b >
225
- < span className = "whitespace-nowrap text-sm" > { ( seats * 2 ) . toLocaleString ( ) } operators</ span >
229
+ < span className = "whitespace-nowrap text-sm" >
230
+ { ( seats * 2 ) . toLocaleString ( ) } operators
231
+ </ span >
226
232
</ div >
227
233
</ div >
228
234
) : null }
@@ -233,7 +239,8 @@ export default function PriceCalculator({ period, tier }) {
233
239
< div className = "mt-2 flex items-baseline gap-x-1" >
234
240
< div className = "text-sm text-gray-600 mt-1" >
235
241
< span > { `~${
236
- vCPUs * 26 * ( period . value === 'annually' ? 12 : 1 ) . toLocaleString ( ) } M executions of 100ms per `} </ span >
242
+ vCPUs * 26 * ( period . value === 'annually' ? 12 : 1 ) . toLocaleString ( )
243
+ } M executions of 100ms per `} </ span >
237
244
< span > { period . value === 'annually' ? 'year' : 'month' } </ span >
238
245
</ div >
239
246
</ div >
@@ -242,7 +249,9 @@ export default function PriceCalculator({ period, tier }) {
242
249
{ seats . toLocaleString ( ) } { seats > 1 ? 'developers' : 'developer' }
243
250
</ span >
244
251
< b className = "text-sm" > OR</ b >
245
- < span className = "whitespace-nowrap text-sm" > { ( seats * 2 ) . toLocaleString ( ) } operators</ span >
252
+ < span className = "whitespace-nowrap text-sm" >
253
+ { ( seats * 2 ) . toLocaleString ( ) } operators
254
+ </ span >
246
255
</ div >
247
256
</ div >
248
257
) : null }
@@ -253,7 +262,8 @@ export default function PriceCalculator({ period, tier }) {
253
262
< div className = "mt-2 flex items-baseline gap-x-1" >
254
263
< div className = "text-sm text-gray-600 mt-1" >
255
264
< span > { `~${
256
- vCPUs * 26 * ( period . value === 'annually' ? 12 : 1 ) . toLocaleString ( ) } M executions of 100ms per `} </ span >
265
+ vCPUs * 26 * ( period . value === 'annually' ? 12 : 1 ) . toLocaleString ( )
266
+ } M executions of 100ms per `} </ span >
257
267
< span > { period . value === 'annually' ? 'year' : 'month' } </ span >
258
268
</ div >
259
269
</ div >
@@ -262,7 +272,9 @@ export default function PriceCalculator({ period, tier }) {
262
272
{ seats . toLocaleString ( ) } { seats > 1 ? 'developers' : 'developer' }
263
273
</ span >
264
274
< b className = "text-sm" > OR</ b >
265
- < span className = "whitespace-nowrap text-sm" > { ( seats * 2 ) . toLocaleString ( ) } operators</ span >
275
+ < span className = "whitespace-nowrap text-sm" >
276
+ { ( seats * 2 ) . toLocaleString ( ) } operators
277
+ </ span >
266
278
</ div >
267
279
</ div >
268
280
) : null }
0 commit comments