@@ -356,6 +356,7 @@ export default function () {
356
356
} ;
357
357
358
358
const planCards = [ ] ;
359
+ const canUpgradeToChargebee = userBillingMode && userBillingMode . mode === "chargebee" ;
359
360
360
361
// Plan card: Free a.k.a. Open Source (or Professional Open Source)
361
362
const openSourceFeatures = (
@@ -374,7 +375,7 @@ export default function () {
374
375
if ( currentPlan . chargebeeId === freePlan . chargebeeId ) {
375
376
planCards . push (
376
377
< PlanCard
377
- isDisabled = { ! ! assignedTs || pendingChargebeeCallback }
378
+ isDisabled = { ! canUpgradeToChargebee || ! ! assignedTs || pendingChargebeeCallback }
378
379
plan = { freePlan }
379
380
isCurrent = { ! ! accountStatement }
380
381
>
@@ -409,7 +410,7 @@ export default function () {
409
410
}
410
411
planCards . push (
411
412
< PlanCard
412
- isDisabled = { ! ! assignedTs || pendingChargebeeCallback }
413
+ isDisabled = { ! canUpgradeToChargebee || ! ! assignedTs || pendingChargebeeCallback }
413
414
plan = { targetPlan }
414
415
isCurrent = { false }
415
416
onDowngrade = { onDowngrade }
@@ -435,7 +436,7 @@ export default function () {
435
436
) : undefined ;
436
437
planCards . push (
437
438
< PlanCard
438
- isDisabled = { ! ! assignedTs || pendingChargebeeCallback }
439
+ isDisabled = { ! canUpgradeToChargebee || ! ! assignedTs || pendingChargebeeCallback }
439
440
plan = { applyCoupons ( personalPlan , appliedCoupons ) }
440
441
isCurrent = { true }
441
442
bottomLabel = { bottomLabel }
@@ -474,7 +475,7 @@ export default function () {
474
475
}
475
476
planCards . push (
476
477
< PlanCard
477
- isDisabled = { ! ! assignedTs || pendingChargebeeCallback }
478
+ isDisabled = { ! canUpgradeToChargebee || ! ! assignedTs || pendingChargebeeCallback }
478
479
plan = { targetPlan }
479
480
isCurrent = { false }
480
481
onUpgrade = { onUpgrade }
@@ -505,7 +506,7 @@ export default function () {
505
506
) : undefined ;
506
507
planCards . push (
507
508
< PlanCard
508
- isDisabled = { ! ! assignedTs || pendingChargebeeCallback }
509
+ isDisabled = { ! canUpgradeToChargebee || ! ! assignedTs || pendingChargebeeCallback }
509
510
plan = { applyCoupons ( professionalPlan , appliedCoupons ) }
510
511
isCurrent = { true }
511
512
bottomLabel = { bottomLabel }
@@ -545,7 +546,7 @@ export default function () {
545
546
}
546
547
planCards . push (
547
548
< PlanCard
548
- isDisabled = { ! ! assignedTs || pendingChargebeeCallback }
549
+ isDisabled = { ! canUpgradeToChargebee || ! ! assignedTs || pendingChargebeeCallback }
549
550
plan = { targetPlan }
550
551
isCurrent = { ! ! assignedProfessionalTs }
551
552
onUpgrade = { onUpgrade }
@@ -583,7 +584,7 @@ export default function () {
583
584
) : undefined ;
584
585
planCards . push (
585
586
< PlanCard
586
- isDisabled = { ! ! assignedTs || pendingChargebeeCallback }
587
+ isDisabled = { ! canUpgradeToChargebee || ! ! assignedTs || pendingChargebeeCallback }
587
588
plan = { applyCoupons ( studentUnleashedPlan , appliedCoupons ) }
588
589
isCurrent = { true }
589
590
bottomLabel = { bottomLabel }
@@ -599,7 +600,7 @@ export default function () {
599
600
) : undefined ;
600
601
planCards . push (
601
602
< PlanCard
602
- isDisabled = { ! ! assignedTs || pendingChargebeeCallback }
603
+ isDisabled = { ! canUpgradeToChargebee || ! ! assignedTs || pendingChargebeeCallback }
603
604
plan = { applyCoupons ( unleashedPlan , appliedCoupons ) }
604
605
isCurrent = { true }
605
606
bottomLabel = { bottomLabel }
@@ -618,7 +619,7 @@ export default function () {
618
619
}
619
620
planCards . push (
620
621
< PlanCard
621
- isDisabled = { ! ! assignedTs || pendingChargebeeCallback }
622
+ isDisabled = { ! canUpgradeToChargebee || ! ! assignedTs || pendingChargebeeCallback }
622
623
plan = { targetPlan }
623
624
isCurrent = { ! ! isUnleashedTsAssigned }
624
625
onUpgrade = { onUpgrade }
@@ -629,101 +630,87 @@ export default function () {
629
630
) ;
630
631
}
631
632
632
- const showPlans = userBillingMode && userBillingMode . mode === "chargebee" ;
633
633
return (
634
634
< div >
635
635
< PageWithSettingsSubMenu title = "Plans" subtitle = "Manage account usage and billing." >
636
- { showPlans && (
637
- < div className = "w-full text-center" >
638
- < p className = "text-xl text-gray-500" >
639
- You are currently using the{ " " }
640
- < span className = "font-bold" >
641
- { Plans . getById ( assignedTs ?. planId ) ?. name || currentPlan . name }
642
- </ span > { " " }
643
- plan.
636
+ < div className = "w-full text-center" >
637
+ < p className = "text-xl text-gray-500" >
638
+ You are currently using the{ " " }
639
+ < span className = "font-bold" > { Plans . getById ( assignedTs ?. planId ) ?. name || currentPlan . name } </ span > { " " }
640
+ plan.
641
+ </ p >
642
+ { canUpgradeToChargebee && ! assignedTs && (
643
+ < p className = "text-base w-96 m-auto" >
644
+ Upgrade your plan to get more hours and more parallel workspaces.
644
645
</ p >
645
- { ! assignedTs && (
646
- < p className = "text-base w-96 m-auto" >
647
- Upgrade your plan to get more hours and more parallel workspaces.
648
- </ p >
649
- ) }
650
- < Tooltip
651
- content = { `Current billing cycle: ${ guessCurrentBillingCycle ( currentPlan , accountStatement )
652
- . map ( ( d ) => d . toLocaleDateString ( ) )
653
- . join ( " - " ) } `}
646
+ ) }
647
+ < Tooltip
648
+ content = { `Current billing cycle: ${ guessCurrentBillingCycle ( currentPlan , accountStatement )
649
+ . map ( ( d ) => d . toLocaleDateString ( ) )
650
+ . join ( " - " ) } `}
651
+ >
652
+ < p className = "mt-2 font-semibold text-gray-500" >
653
+ Remaining hours:{ " " }
654
+ { typeof accountStatement ?. remainingHours === "number"
655
+ ? Math . floor ( accountStatement . remainingHours * 10 ) / 10
656
+ : accountStatement ?. remainingHours }
657
+ </ p >
658
+ </ Tooltip >
659
+ { typeof accountStatement ?. remainingHours === "number" &&
660
+ typeof currentPlan . hoursPerMonth === "number" ? (
661
+ < progress
662
+ value = { currentPlan . hoursPerMonth - accountStatement . remainingHours }
663
+ max = { currentPlan . hoursPerMonth }
664
+ />
665
+ ) : (
666
+ < progress value = "0" max = "100" />
667
+ ) }
668
+ < p className = "text-sm" >
669
+ < a
670
+ className = { `gp-link ${ isChargebeeCustomer ? "" : "invisible" } ` }
671
+ href = "javascript:void(0)"
672
+ onClick = { ( ) => {
673
+ ChargebeeClient . getOrCreate ( ) . then ( ( chargebeeClient ) => chargebeeClient . openPortal ( ) ) ;
674
+ } }
654
675
>
655
- < p className = "mt-2 font-semibold text-gray-500" >
656
- Remaining hours:{ " " }
657
- { typeof accountStatement ?. remainingHours === "number"
658
- ? Math . floor ( accountStatement . remainingHours * 10 ) / 10
659
- : accountStatement ?. remainingHours }
660
- </ p >
661
- </ Tooltip >
662
- { typeof accountStatement ?. remainingHours === "number" &&
663
- typeof currentPlan . hoursPerMonth === "number" ? (
664
- < progress
665
- value = { currentPlan . hoursPerMonth - accountStatement . remainingHours }
666
- max = { currentPlan . hoursPerMonth }
667
- />
668
- ) : (
669
- < progress value = "0" max = "100" />
676
+ Billing
677
+ </ a >
678
+ { ! ! accountStatement && Plans . isFreePlan ( currentPlan . chargebeeId ) && (
679
+ < span className = "pl-6" >
680
+ { currency === "EUR" ? (
681
+ < >
682
+ € /{ " " }
683
+ < a
684
+ className = "text-blue-light hover:underline"
685
+ href = "javascript:void(0)"
686
+ onClick = { ( ) => setCurrency ( "USD" ) }
687
+ >
688
+ $
689
+ </ a >
690
+ </ >
691
+ ) : (
692
+ < >
693
+ < a
694
+ className = "text-blue-light hover:underline"
695
+ href = "javascript:void(0)"
696
+ onClick = { ( ) => setCurrency ( "EUR" ) }
697
+ >
698
+ €
699
+ </ a > { " " }
700
+ / $
701
+ </ >
702
+ ) }
703
+ </ span >
670
704
) }
671
- < p className = "text-sm" >
672
- < a
673
- className = { `gp-link ${ isChargebeeCustomer ? "" : "invisible" } ` }
674
- href = "javascript:void(0)"
675
- onClick = { ( ) => {
676
- ChargebeeClient . getOrCreate ( ) . then ( ( chargebeeClient ) =>
677
- chargebeeClient . openPortal ( ) ,
678
- ) ;
679
- } }
680
- >
681
- Billing
682
- </ a >
683
- { ! ! accountStatement && Plans . isFreePlan ( currentPlan . chargebeeId ) && (
684
- < span className = "pl-6" >
685
- { currency === "EUR" ? (
686
- < >
687
- € /{ " " }
688
- < a
689
- className = "text-blue-light hover:underline"
690
- href = "javascript:void(0)"
691
- onClick = { ( ) => setCurrency ( "USD" ) }
692
- >
693
- $
694
- </ a >
695
- </ >
696
- ) : (
697
- < >
698
- < a
699
- className = "text-blue-light hover:underline"
700
- href = "javascript:void(0)"
701
- onClick = { ( ) => setCurrency ( "EUR" ) }
702
- >
703
- €
704
- </ a > { " " }
705
- / $
706
- </ >
707
- ) }
708
- </ span >
709
- ) }
710
- </ p >
711
- </ div >
712
- ) }
705
+ </ p >
706
+ </ div >
713
707
< div className = "mt-4 flex justify-center space-x-3 2xl:space-x-7" > { planCards } </ div >
714
708
{ assignedTs && userBillingMode ?. mode === "chargebee" && ! ! userBillingMode . teamNames && (
715
709
< Alert type = "info" className = "mt-10 mx-auto" >
716
710
< p > Assigned Team Seats</ p >
717
711
< ul > { userBillingMode . teamNames . join ( ", " ) } </ ul >
718
712
</ Alert >
719
713
) }
720
- < InfoBox className = "w-2/3 mt-14 mx-auto" >
721
- If you are interested in purchasing a plan for a team, purchase a Team plan with one centralized
722
- billing.{ " " }
723
- < a className = "underline" href = "https://www.gitpod.io/docs/teams/" >
724
- Learn more
725
- </ a >
726
- </ InfoBox >
727
714
{ ! ! confirmUpgradeToPlan && (
728
715
// TODO: Use title and buttons props
729
716
< Modal visible = { true } onClose = { ( ) => setConfirmUpgradeToPlan ( undefined ) } >
0 commit comments