forked from profectus/Profectus
Rename repeatable.purchaseLimit to limit and initialValue to initialAmount
This commit is contained in:
parent
ccb8e76eaf
commit
712fcf7eb0
1 changed files with 11 additions and 11 deletions
|
@ -39,8 +39,8 @@ export type RepeatableDisplay =
|
||||||
export interface RepeatableOptions {
|
export interface RepeatableOptions {
|
||||||
visibility?: Computable<Visibility>;
|
visibility?: Computable<Visibility>;
|
||||||
requirements: Requirements;
|
requirements: Requirements;
|
||||||
purchaseLimit?: Computable<DecimalSource>;
|
limit?: Computable<DecimalSource>;
|
||||||
initialValue?: DecimalSource;
|
initialAmount?: DecimalSource;
|
||||||
classes?: Computable<Record<string, boolean>>;
|
classes?: Computable<Record<string, boolean>>;
|
||||||
style?: Computable<StyleValue>;
|
style?: Computable<StyleValue>;
|
||||||
mark?: Computable<boolean | string>;
|
mark?: Computable<boolean | string>;
|
||||||
|
@ -67,7 +67,7 @@ export type Repeatable<T extends RepeatableOptions> = Replace<
|
||||||
{
|
{
|
||||||
visibility: GetComputableTypeWithDefault<T["visibility"], Visibility.Visible>;
|
visibility: GetComputableTypeWithDefault<T["visibility"], Visibility.Visible>;
|
||||||
requirements: GetComputableType<T["requirements"]>;
|
requirements: GetComputableType<T["requirements"]>;
|
||||||
purchaseLimit: GetComputableTypeWithDefault<T["purchaseLimit"], Decimal>;
|
limit: GetComputableTypeWithDefault<T["limit"], Decimal>;
|
||||||
classes: GetComputableType<T["classes"]>;
|
classes: GetComputableType<T["classes"]>;
|
||||||
style: GetComputableType<T["style"]>;
|
style: GetComputableType<T["style"]>;
|
||||||
mark: GetComputableType<T["mark"]>;
|
mark: GetComputableType<T["mark"]>;
|
||||||
|
@ -81,7 +81,7 @@ export type GenericRepeatable = Replace<
|
||||||
Repeatable<RepeatableOptions>,
|
Repeatable<RepeatableOptions>,
|
||||||
{
|
{
|
||||||
visibility: ProcessedComputable<Visibility>;
|
visibility: ProcessedComputable<Visibility>;
|
||||||
purchaseLimit: ProcessedComputable<DecimalSource>;
|
limit: ProcessedComputable<DecimalSource>;
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
@ -97,12 +97,12 @@ export function createRepeatable<T extends RepeatableOptions>(
|
||||||
repeatable[Component] = ClickableComponent;
|
repeatable[Component] = ClickableComponent;
|
||||||
|
|
||||||
repeatable.amount = amount;
|
repeatable.amount = amount;
|
||||||
repeatable.amount[DefaultValue] = repeatable.initialValue ?? 0;
|
repeatable.amount[DefaultValue] = repeatable.initialAmount ?? 0;
|
||||||
|
|
||||||
const limitRequirement = {
|
const limitRequirement = {
|
||||||
requirementMet: computed(() =>
|
requirementMet: computed(() =>
|
||||||
Decimal.sub(
|
Decimal.sub(
|
||||||
unref((repeatable as GenericRepeatable).purchaseLimit),
|
unref((repeatable as GenericRepeatable).limit),
|
||||||
(repeatable as GenericRepeatable).amount.value
|
(repeatable as GenericRepeatable).amount.value
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
@ -124,7 +124,7 @@ export function createRepeatable<T extends RepeatableOptions>(
|
||||||
repeatable.maxed = computed(() =>
|
repeatable.maxed = computed(() =>
|
||||||
Decimal.gte(
|
Decimal.gte(
|
||||||
(repeatable as GenericRepeatable).amount.value,
|
(repeatable as GenericRepeatable).amount.value,
|
||||||
unref((repeatable as GenericRepeatable).purchaseLimit)
|
unref((repeatable as GenericRepeatable).limit)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
processComputable(repeatable as T, "classes");
|
processComputable(repeatable as T, "classes");
|
||||||
|
@ -182,12 +182,12 @@ export function createRepeatable<T extends RepeatableOptions>(
|
||||||
{currDisplay.showAmount === false ? null : (
|
{currDisplay.showAmount === false ? null : (
|
||||||
<div>
|
<div>
|
||||||
<br />
|
<br />
|
||||||
{unref(genericRepeatable.purchaseLimit) === Decimal.dInf ? (
|
{unref(genericRepeatable.limit) === Decimal.dInf ? (
|
||||||
<>Amount: {formatWhole(genericRepeatable.amount.value)}</>
|
<>Amount: {formatWhole(genericRepeatable.amount.value)}</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
Amount: {formatWhole(genericRepeatable.amount.value)} /{" "}
|
Amount: {formatWhole(genericRepeatable.amount.value)} /{" "}
|
||||||
{formatWhole(unref(genericRepeatable.purchaseLimit))}
|
{formatWhole(unref(genericRepeatable.limit))}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -217,8 +217,8 @@ export function createRepeatable<T extends RepeatableOptions>(
|
||||||
|
|
||||||
processComputable(repeatable as T, "visibility");
|
processComputable(repeatable as T, "visibility");
|
||||||
setDefault(repeatable, "visibility", Visibility.Visible);
|
setDefault(repeatable, "visibility", Visibility.Visible);
|
||||||
processComputable(repeatable as T, "purchaseLimit");
|
processComputable(repeatable as T, "limit");
|
||||||
setDefault(repeatable, "purchaseLimit", Decimal.dInf);
|
setDefault(repeatable, "limit", Decimal.dInf);
|
||||||
processComputable(repeatable as T, "style");
|
processComputable(repeatable as T, "style");
|
||||||
processComputable(repeatable as T, "mark");
|
processComputable(repeatable as T, "mark");
|
||||||
processComputable(repeatable as T, "small");
|
processComputable(repeatable as T, "small");
|
||||||
|
|
Loading…
Reference in a new issue