Add showAmount boolean to buyable displays

This commit is contained in:
thepaperpilot 2022-07-06 10:09:37 -05:00
parent 78ac7957dd
commit 409b3bbac4

View file

@ -26,6 +26,7 @@ export type BuyableDisplay =
title?: CoercableComponent; title?: CoercableComponent;
description: CoercableComponent; description: CoercableComponent;
effectDisplay?: CoercableComponent; effectDisplay?: CoercableComponent;
showAmount?: boolean;
}; };
export interface BuyableOptions { export interface BuyableOptions {
@ -170,15 +171,6 @@ export function createBuyable<T extends BuyableOptions>(
const Title = coerceComponent(currDisplay.title || "", "h3"); const Title = coerceComponent(currDisplay.title || "", "h3");
const Description = coerceComponent(currDisplay.description); const Description = coerceComponent(currDisplay.description);
const EffectDisplay = coerceComponent(currDisplay.effectDisplay || ""); 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 ( return (
<span> <span>
@ -188,10 +180,19 @@ export function createBuyable<T extends BuyableOptions>(
</div> </div>
) : null} ) : null}
<Description /> <Description />
{currDisplay.showAmount === false ? null : (
<div> <div>
<br /> <br />
{amountDisplay} {unref(genericBuyable.purchaseLimit) === Decimal.dInf ? (
<>Amount: {formatWhole(genericBuyable.amount.value)}</>
) : (
<>
Amount: {formatWhole(genericBuyable.amount.value)} /{" "}
{formatWhole(unref(genericBuyable.purchaseLimit))}
</>
)}
</div> </div>
)}
{currDisplay.effectDisplay ? ( {currDisplay.effectDisplay ? (
<div> <div>
<br /> <br />