48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
// Metro module 11611 (f11612).
|
|
import { useMemo } from "react";
|
|
import { PowerupActiveStatusType } from "../constants/GuildPowerupsConstants";
|
|
import { intl, t } from "../../../../intl/index.native";
|
|
import GuildPowerups_messages from "../GuildPowerups.messages";
|
|
export function useCalculatePowerupCardStatus(a0, a1, a2) {
|
|
return useMemo(() => {
|
|
let r21;
|
|
const ends_at = a1.sourceEntitlement?.ends_at;
|
|
L18: {
|
|
if (ends_at != null) {
|
|
r21 = {
|
|
type: "expiring",
|
|
expiringAt: a1.sourceEntitlement.ends_at
|
|
};
|
|
} else {
|
|
if (a2) {
|
|
if (a0.storeRemovalDate != null) {
|
|
r21 = {
|
|
type: "removing",
|
|
removingAt: a0.storeRemovalDate
|
|
};
|
|
break L18;
|
|
}
|
|
}
|
|
if (a1.type === PowerupActiveStatusType.LEVEL_ACTIVATED) {
|
|
let perkName = a1.sourcePowerup?.title;
|
|
if (perkName == null) {
|
|
perkName = intl.string(t.BfF6ED);
|
|
}
|
|
r21 = {
|
|
type: "active",
|
|
statusText: intl.formatToPlainString(GuildPowerups_messages.WRRYUT, {
|
|
perkName
|
|
})
|
|
};
|
|
} else {
|
|
r21 = a1.type !== PowerupActiveStatusType.INACTIVE ? {
|
|
type: "active",
|
|
statusText: intl.string(GuildPowerups_messages.FFLkmx)
|
|
} : void 0;
|
|
}
|
|
}
|
|
}
|
|
return r21;
|
|
}, [a1, a2, a0]);
|
|
}
|