Skip to content

Commit b2961f7

Browse files
committed
since we haven't rewritten everything to use decimal (see #7885) at least show more precision (it's more honest)
1 parent 5135742 commit b2961f7

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/packages/next/components/store/add-box.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
Add a cash voucher to your shopping cart.
88
*/
99
import { CostInputPeriod } from "@cocalc/util/licenses/purchase/types";
10-
import { round2up } from "@cocalc/util/misc";
10+
import { round2up, round4 } from "@cocalc/util/misc";
1111
import { money } from "@cocalc/util/licenses/purchase/utils";
12-
import { Alert, Button } from "antd";
12+
import { Alert, Button, Tooltip } from "antd";
1313
import { addToCart } from "./add-to-cart";
1414
import { DisplayCost } from "./site-license-cost";
1515
import { periodicCost } from "@cocalc/util/licenses/purchase/compute-cost";
@@ -35,7 +35,7 @@ export function AddBox(props: Props) {
3535
dedicatedItem = false,
3636
noAccount,
3737
} = props;
38-
console.log({ cost });
38+
// console.log({ cost });
3939
if (cost?.input.type == "cash-voucher") {
4040
return null;
4141
}
@@ -52,12 +52,14 @@ export function AddBox(props: Props) {
5252
if (cost?.input.type != "quota") {
5353
return;
5454
}
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;
5659
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>
6163
);
6264
}
6365

@@ -147,8 +149,8 @@ export function AddToCartButton(props: CartButtonProps) {
147149
{disabled
148150
? "Finish configuring the license..."
149151
: router.query.id != null
150-
? "Save Changes"
151-
: "Add to Cart"}
152+
? "Save Changes"
153+
: "Add to Cart"}
152154
</Button>
153155
);
154156
}

src/packages/next/components/store/site-license-cost.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type {
1616
Subscription,
1717
} from "@cocalc/util/licenses/purchase/types";
1818
import { money } from "@cocalc/util/licenses/purchase/utils";
19-
import { plural, round2, round2up } from "@cocalc/util/misc";
19+
import { plural, round2, round4, round2up } from "@cocalc/util/misc";
2020
import { appendAfterNowToDate, getDays } from "@cocalc/util/stripe/timecalcs";
2121
import {
2222
dedicatedDiskDisplay,
@@ -81,7 +81,8 @@ export function DisplayCost({
8181
<span>
8282
{describeItem({ info: cost.input })}
8383
<hr />
84-
<Icon name="money-check" /> Cost: {desc}
84+
<Icon name="money-check" /> Cost:{" "}
85+
<Tooltip title={`$${round4(periodicCost(cost))}`}>{desc}</Tooltip>
8586
</span>
8687
);
8788
}

0 commit comments

Comments
 (0)