40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
// Metro module 15139 (f15140).
|
|
import { useRef, useEffect } from "react";
|
|
import { DismissibleContentGroupName } from "../dismissible_content/DismissibleContentConstants";
|
|
import { useEnabledGuildThemeForGuildId } from "./GuildThemeResolver";
|
|
import { useSelectedDismissibleContent } from "../dismissible_content/hooks/useSelectedDismissibleContent";
|
|
import { DismissibleContent } from "../../_bundle/Module1358";
|
|
export default function useGuildThemeNuxTrigger(a0, a1) {
|
|
const guildId = a0;
|
|
const { isNuxOpen, openNux } = a1;
|
|
const [r31, r32] = useSelectedDismissibleContent(useEnabledGuildThemeForGuildId(a0, "GuildThemeNuxTrigger") != null ? [DismissibleContent.GUILD_THEME_NUX] : [], DismissibleContentGroupName.GUILD_THEME_NUX);
|
|
let c21701_3 = r32;
|
|
const r37 = r31 === DismissibleContent.GUILD_THEME_NUX;
|
|
let c21701_4 = r37;
|
|
const ref = useRef(false);
|
|
useEffect(() => {
|
|
ref.current = false;
|
|
}, [a0]);
|
|
useEffect(() => {
|
|
if (c21701_4 && !isNuxOpen && !ref.current) {
|
|
let c27951_0 = setTimeout(() => {
|
|
ref.current = true;
|
|
let c30847_0 = false;
|
|
Promise.resolve(openNux({
|
|
guildId,
|
|
markAsDismissed: (a0) => {
|
|
if (!c30847_0) {
|
|
c30847_0 = true;
|
|
c21701_3(a0, true);
|
|
}
|
|
}
|
|
})).catch(() => {
|
|
ref.current = false;
|
|
});
|
|
}, 2000);
|
|
return () => clearTimeout(c27951_0);
|
|
}
|
|
}, [r37, isNuxOpen, a0, r32, openNux]);
|
|
};
|
|
export const GUILD_THEME_NUX_DELAY_MS = 2000;
|