76 lines
3.4 KiB
TypeScript
76 lines
3.4 KiB
TypeScript
// Metro module 11633 (f11634).
|
|
import { useMemo } from "react";
|
|
import GuildMemberCountStore from "../../../../stores/GuildMemberCountStore";
|
|
import GuildRoleStore from "../../../../stores/GuildRoleStore";
|
|
import GuildStore from "../../../../stores/GuildStore";
|
|
import { useStateFromStores } from "../../../../_bundle/Module589";
|
|
import useGuildRoleMemberCounts from "../../../guild_role_subscriptions/useGuildRoleMemberCounts";
|
|
import { GUILD_POWERUP_ROLE_COLOR_SKU_ID, VANITY_URL_POWERUP_SKU_ID, GUILD_TAGS_BADGE_PACK_PETS_POWERUP_SKU_ID, GUILD_TAGS_BADGE_PACK_FLEX_POWERUP_SKU_ID, GUILD_TAGS_BADGE_PACK_PLANT_POWERUP_SKU_ID, GUILD_TAGS_BADGE_PACK_CREEPY_CRAWLIES_POWERUP_SKU_ID, GUILD_POWERUP_LEVEL_3_SKU_ID } from "../../../../_bundle/Module4080";
|
|
import { intl } from "../../../../intl/index.native";
|
|
import GuildPowerups_messages from "../GuildPowerups.messages";
|
|
export default function useDeactivateWarningText(a0, a1) {
|
|
let c19044_3, stateFromStores2, stateFromStores3;
|
|
const stateFromStores = useStateFromStores([GuildMemberCountStore], () => GuildMemberCountStore.getMemberCount(a0));
|
|
const guildRoleMemberCounts = useGuildRoleMemberCounts(a0);
|
|
c19044_3 = guildRoleMemberCounts;
|
|
stateFromStores2 = useStateFromStores([GuildStore], () => GuildStore.getGuild(a0)?.vanityURLCode != null);
|
|
stateFromStores3 = useStateFromStores([GuildRoleStore], () => a1.skuId === GUILD_POWERUP_ROLE_COLOR_SKU_ID ? c19044_3 == null ? 0 : GuildRoleStore.getSortedRoles(a0).reduce((acc, item) => {
|
|
const secondaryColor = item.colorStrings?.secondaryColor;
|
|
let r7 = acc;
|
|
if (secondaryColor != null) {
|
|
let r11 = c19044_3[item.id];
|
|
if (r11 == null) {
|
|
r11 = 0;
|
|
}
|
|
r7 = acc + r11;
|
|
}
|
|
return r7;
|
|
}, 0) : 0, [a0, a1.skuId, guildRoleMemberCounts]);
|
|
return useMemo(() => {
|
|
let r5, text;
|
|
L18: {
|
|
r5 = a1;
|
|
const skuId = r5.skuId;
|
|
if (GUILD_POWERUP_ROLE_COLOR_SKU_ID === skuId) {
|
|
text = stateFromStores3 > 0 ? intl.formatToPlainString(GuildPowerups_messages["4jSvr1"], {
|
|
perk: r5.title,
|
|
memberCount: stateFromStores3
|
|
}) : intl.formatToPlainString(GuildPowerups_messages.cavtEo, {
|
|
perk: r5.title
|
|
});
|
|
} else if (VANITY_URL_POWERUP_SKU_ID === skuId) {
|
|
text = stateFromStores2 ? intl.string(GuildPowerups_messages.hN75yb) : intl.string(GuildPowerups_messages.Du91Rb);
|
|
} else {
|
|
if (GUILD_TAGS_BADGE_PACK_PETS_POWERUP_SKU_ID !== skuId && GUILD_TAGS_BADGE_PACK_FLEX_POWERUP_SKU_ID !== skuId && GUILD_TAGS_BADGE_PACK_PLANT_POWERUP_SKU_ID !== skuId && GUILD_TAGS_BADGE_PACK_CREEPY_CRAWLIES_POWERUP_SKU_ID !== skuId) {
|
|
const r9 = GuildPowerups_messages["4jSvr1"];
|
|
let memberCount = stateFromStores;
|
|
if (stateFromStores == null) {
|
|
memberCount = 0;
|
|
}
|
|
text = intl.formatToPlainString(r9, {
|
|
perk: r5.title,
|
|
memberCount
|
|
});
|
|
break L18;
|
|
}
|
|
text = intl.string(GuildPowerups_messages.Vf2ZcR);
|
|
}
|
|
}
|
|
const r93 = [{
|
|
text,
|
|
critical: r5.skuId === VANITY_URL_POWERUP_SKU_ID
|
|
}];
|
|
let r94 = stateFromStores2;
|
|
if (stateFromStores2) {
|
|
r94 = r5.skuId === GUILD_POWERUP_LEVEL_3_SKU_ID;
|
|
}
|
|
if (r94) {
|
|
r93.push({
|
|
text: intl.string(GuildPowerups_messages.M4XL5n),
|
|
critical: true
|
|
});
|
|
}
|
|
return r93;
|
|
}, [a1, stateFromStores3, stateFromStores, stateFromStores2]);
|
|
};
|