33 lines
1.4 KiB
TypeScript
33 lines
1.4 KiB
TypeScript
// Metro module 11743 (f11744).
|
|
import { useEffect } from "react";
|
|
import GuildPromptsStore from "../guild/GuildPromptsStore";
|
|
import GuildMemberStore from "../../stores/GuildMemberStore";
|
|
import GuildStore from "../../stores/GuildStore";
|
|
import UserStore from "../../stores/UserStore";
|
|
import { GuildFeatures } from "../../Constants";
|
|
import { GuildPrompts } from "../guild/Constants";
|
|
import { useStateFromStores } from "../../_bundle/Module589";
|
|
import GuildPromptsActionCreators from "../guild/GuildPromptsActionCreators";
|
|
export default function useIsHubRealNamePromptShowing(a0) {
|
|
const stateFromStores = useStateFromStores([GuildStore, GuildPromptsStore, UserStore, GuildMemberStore], () => {
|
|
const guild = GuildStore.getGuild(a0);
|
|
if ((guild == null ? void 0 : guild.features.has(GuildFeatures.HUB)) !== true) {
|
|
return null;
|
|
}
|
|
if (GuildPromptsStore.hasViewedPrompt(GuildPrompts.REAL_NAME_PROMPT, guild.id) === true) {
|
|
return null;
|
|
}
|
|
const currentUser = UserStore.getCurrentUser();
|
|
if (currentUser == null) {
|
|
return null;
|
|
}
|
|
return GuildMemberStore.getMember(guild.id, currentUser?.id)?.nick == null;
|
|
});
|
|
useEffect(() => {
|
|
if (a0 != null && stateFromStores != null && !stateFromStores) {
|
|
GuildPromptsActionCreators.viewPrompt(GuildPrompts.REAL_NAME_PROMPT, a0);
|
|
}
|
|
}, [stateFromStores, a0]);
|
|
return stateFromStores === true;
|
|
};
|