43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
// Metro module 11652 (f11653).
|
|
import { useMemo } from "react";
|
|
import AppliedGuildBoostStore from "../../../../stores/AppliedGuildBoostStore";
|
|
import useGuildPowerupsBoostCount from "./useGuildPowerupsBoostCount";
|
|
import { useStateFromStores } from "../../../../_bundle/Module589";
|
|
import { intl } from "../../../../intl/index.native";
|
|
import GuildPowerups_messages from "../GuildPowerups.messages";
|
|
export default function useGuildPowerupsWarningConfig(a0, a1) {
|
|
let boostCount;
|
|
let c19054_0 = a0;
|
|
const spent = useGuildPowerupsBoostCount(a0).spent;
|
|
const stateFromStores = useStateFromStores([AppliedGuildBoostStore], () => AppliedGuildBoostStore.getAppliedGuildBoostsForGuild(c19054_0), [a0]);
|
|
boostCount = spent - useMemo(() => {
|
|
const r3 = stateFromStores == null;
|
|
let r8 = void 0;
|
|
if (!r3) {
|
|
const filter = stateFromStores.filter;
|
|
r8 = filter == null ? void 0 : filter.call(stateFromStores, (a0) => {
|
|
const ended = a0.ended;
|
|
return ended ? !ended : a0.endsAt == null;
|
|
})?.length;
|
|
}
|
|
if (r8 == null) {
|
|
r8 = 0;
|
|
}
|
|
return r8;
|
|
}, [stateFromStores]);
|
|
return useMemo(() => boostCount <= 0 ? {
|
|
shouldShow: false,
|
|
title: "",
|
|
description: "",
|
|
requiredBoostCount: 0
|
|
} : {
|
|
shouldShow: true,
|
|
title: intl.string(GuildPowerups_messages.n5hQhc),
|
|
description: intl.formatToPlainString(GuildPowerups_messages.iAaAiG, {
|
|
boostCount,
|
|
perksString: a1.join(", ")
|
|
}),
|
|
requiredBoostCount: boostCount
|
|
}, [boostCount, a1]);
|
|
};
|