From 409b3bbac46a4e627d2ba8cffdc239af7dd52f19 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Wed, 6 Jul 2022 10:09:37 -0500 Subject: [PATCH] Add showAmount boolean to buyable displays --- src/features/buyable.tsx | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/features/buyable.tsx b/src/features/buyable.tsx index 60c12c9..de60c83 100644 --- a/src/features/buyable.tsx +++ b/src/features/buyable.tsx @@ -26,6 +26,7 @@ export type BuyableDisplay = title?: CoercableComponent; description: CoercableComponent; effectDisplay?: CoercableComponent; + showAmount?: boolean; }; export interface BuyableOptions { @@ -170,15 +171,6 @@ export function createBuyable( const Title = coerceComponent(currDisplay.title || "", "h3"); const Description = coerceComponent(currDisplay.description); const EffectDisplay = coerceComponent(currDisplay.effectDisplay || ""); - const amountDisplay = - unref(genericBuyable.purchaseLimit) === Decimal.dInf ? ( - <>Amount: {formatWhole(genericBuyable.amount.value)} - ) : ( - <> - Amount: {formatWhole(genericBuyable.amount.value)} /{" "} - {formatWhole(unref(genericBuyable.purchaseLimit))} - - ); return ( @@ -188,10 +180,19 @@ export function createBuyable( ) : null} -
-
- {amountDisplay} -
+ {currDisplay.showAmount === false ? null : ( +
+
+ {unref(genericBuyable.purchaseLimit) === Decimal.dInf ? ( + <>Amount: {formatWhole(genericBuyable.amount.value)} + ) : ( + <> + Amount: {formatWhole(genericBuyable.amount.value)} /{" "} + {formatWhole(unref(genericBuyable.purchaseLimit))} + + )} +
+ )} {currDisplay.effectDisplay ? (