7
7
Add a cash voucher to your shopping cart.
8
8
*/
9
9
import { CostInputPeriod } from "@cocalc/util/licenses/purchase/types" ;
10
- import { round2up } from "@cocalc/util/misc" ;
10
+ import { round2up , round4 } from "@cocalc/util/misc" ;
11
11
import { money } from "@cocalc/util/licenses/purchase/utils" ;
12
- import { Alert , Button } from "antd" ;
12
+ import { Alert , Button , Tooltip } from "antd" ;
13
13
import { addToCart } from "./add-to-cart" ;
14
14
import { DisplayCost } from "./site-license-cost" ;
15
15
import { periodicCost } from "@cocalc/util/licenses/purchase/compute-cost" ;
@@ -35,7 +35,7 @@ export function AddBox(props: Props) {
35
35
dedicatedItem = false ,
36
36
noAccount,
37
37
} = props ;
38
- console . log ( { cost } ) ;
38
+ // console.log({ cost });
39
39
if ( cost ?. input . type == "cash-voucher" ) {
40
40
return null ;
41
41
}
@@ -52,12 +52,14 @@ export function AddBox(props: Props) {
52
52
if ( cost ?. input . type != "quota" ) {
53
53
return ;
54
54
}
55
- if ( dedicatedItem || cost . input . quantity == null ) return ;
55
+ if ( dedicatedItem || cost . input . quantity == null ) {
56
+ return ;
57
+ }
58
+ const costPer = periodicCost ( cost ) / cost . input . quantity ;
56
59
return (
57
- < div >
58
- { money ( round2up ( periodicCost ( cost ) / cost . input . quantity ) ) } per
59
- project
60
- </ div >
60
+ < Tooltip title = { `$${ round4 ( costPer ) } per project` } >
61
+ < div > { money ( round2up ( costPer ) ) } per project</ div >
62
+ </ Tooltip >
61
63
) ;
62
64
}
63
65
@@ -147,8 +149,8 @@ export function AddToCartButton(props: CartButtonProps) {
147
149
{ disabled
148
150
? "Finish configuring the license..."
149
151
: router . query . id != null
150
- ? "Save Changes"
151
- : "Add to Cart" }
152
+ ? "Save Changes"
153
+ : "Add to Cart" }
152
154
</ Button >
153
155
) ;
154
156
}
0 commit comments