62 lines
2.6 KiB
TypeScript
62 lines
2.6 KiB
TypeScript
// Metro module 11604 (f11605).
|
|
import { useMemo } from "react";
|
|
import GuildStore from "../../../../stores/GuildStore";
|
|
import GuildPowerupsStore from "../GuildPowerupsStore";
|
|
import { useStateFromStores } from "../../../../_bundle/Module589";
|
|
import useHasAllocateBoostPermission from "./useHasAllocateBoostPermission";
|
|
import { GUILD_POWERUP_MAX_FILE_SIZE_250_MB_SKU_ID } from "../../../../_bundle/Module4080";
|
|
import { useShouldShowFileUploadRollback } from "../utils/fileUpload";
|
|
import getGuildPowerupFormattedDateString from "../utils/getGuildPowerupFormattedDateString";
|
|
import { DismissibleContent } from "../../../../_bundle/Module1358";
|
|
import { intl } from "../../../../intl/index.native";
|
|
import GuildPowerups_messages from "../GuildPowerups.messages";
|
|
export default function useGuildPowerupRollbackModalConfig(a0, a1) {
|
|
let c19026_1, storeRemovalDate, c19026_3;
|
|
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(a0));
|
|
let shouldShow = useHasAllocateBoostPermission(a0);
|
|
if (shouldShow == null) {
|
|
shouldShow = false;
|
|
}
|
|
const stateFromStores2 = useStateFromStores([GuildPowerupsStore], () => GuildPowerupsStore.getStateForGuild(a0));
|
|
const r2 = stateFromStores2 == null;
|
|
let r26 = void 0;
|
|
if (!r2) {
|
|
const allPowerups = stateFromStores2.allPowerups;
|
|
r26 = allPowerups == null ? void 0 : allPowerups[GUILD_POWERUP_MAX_FILE_SIZE_250_MB_SKU_ID];
|
|
}
|
|
c19026_1 = r26;
|
|
storeRemovalDate = r26?.storeRemovalDate;
|
|
const shouldShowFileUploadRollback = useShouldShowFileUploadRollback(a0, a1);
|
|
if (shouldShow) {
|
|
shouldShow = shouldShowFileUploadRollback;
|
|
}
|
|
if (shouldShow) {
|
|
shouldShow = stateFromStores != null;
|
|
}
|
|
c19026_3 = shouldShow;
|
|
return {
|
|
shouldShow,
|
|
modalConfig: useMemo(() => {
|
|
if (c19026_3) {
|
|
if (c19026_1 != null && storeRemovalDate != null) {
|
|
const guildPowerupFormattedDateString = getGuildPowerupFormattedDateString(storeRemovalDate);
|
|
return {
|
|
dismissibleContent: DismissibleContent.FILE_UPLOAD_POWERUP_ROLLBACK_MODAL,
|
|
header: `${c19026_1.title} ${intl.formatToPlainString(GuildPowerups_messages["6e2ry1"], {
|
|
dateString: guildPowerupFormattedDateString
|
|
})}`,
|
|
bodies: [intl.formatToPlainString(GuildPowerups_messages.jd8fki, {
|
|
startDate: guildPowerupFormattedDateString,
|
|
endDate: guildPowerupFormattedDateString,
|
|
perkName: c19026_1.title,
|
|
boostCount: c19026_1.cost
|
|
})],
|
|
hasCancelButton: false
|
|
};
|
|
}
|
|
}
|
|
return null;
|
|
}, [shouldShow, r26, storeRemovalDate])
|
|
};
|
|
};
|