Files
discord-decomp/modules/age_gate/native/components/NsfwGateGuild.tsx
T
2026-11-01 12:12:55 +02:00

65 lines
2.7 KiB
TypeScript

// Metro module 9359 (f9360).
import { useEffect } from "react";
import { Image as Image2, View } from "react-native";
import GuildMemberStore from "../../../../stores/GuildMemberStore";
import UserStore from "../../../../stores/UserStore";
import { NsfwGateSource } from "./Constants";
import { AnalyticEvents, HelpdeskArticles } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { intl, t } from "../../../../intl/index.native";
import HelpdeskUtils from "../../../../utils/HelpdeskUtils";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import { getViewNsfwGuildsOrDefault } from "../../../user_settings/content_and_social/AgeRestrictedContentSettingsUtils";
import BackgroundImage from "../../../auth/native/components/atoms/BackgroundImage";
import Module9361 from "../../../../_bundle/Module9361";
import { Text } from "../../../../design/components/Text/native/Text";
import { Button } from "../../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
padding: 16,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
header: {
textAlign: "center",
marginBottom: 8
},
description: {
textAlign: "center",
marginBottom: 16
},
image: {
marginBottom: 16
}
});
export default function NsfwGateGuild(props) {
const { onClose, guildId } = props;
const styles = useStyles();
const r14 = intl.string(t.vAymlG);
const r13 = intl.string(t.Crj6eC);
const r44 = intl.format(t.Z12LNW, {
helpURL: HelpdeskUtils.getArticleURL(HelpdeskArticles.NSFW_GUILD_GUIDELINES)
});
const currentUser = UserStore.getCurrentUser();
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.GUILD_NSFW_GATE_VIEWED, {
guild_id: guildId,
user_id: currentUser?.id,
is_member: GuildMemberStore.isMember(guildId, currentUser?.id),
is_user_opted_in_to_age_restricted_servers: currentUser?.nsfwAllowed && getViewNsfwGuildsOrDefault(),
source: NsfwGateSource.MODAL
});
}, [guildId, currentUser]);
return <View style={styles.container}>
<BackgroundImage />
<Image2 source={Module9361} style={styles.image} />
<Text style={styles.header} variant="heading-xl/extrabold" color="mobile-text-heading-primary">{r14}</Text>
<Text style={styles.description} variant="text-md/normal" color="text-default">{r13}</Text>
<Text style={styles.description} variant="text-md/normal" color="text-default">{r44}</Text>
<Button onPress={onClose} size="md" text={intl.string(t.gRqiWV)} />
</View>;
};