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

94 lines
3.5 KiB
TypeScript

// Metro module 14900 (f14901).
import { useLayoutEffect } from "react";
import { View } from "react-native";
import { HelpdeskArticles } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useWideAuthView from "../../../auth/native/useWideAuthView";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import { getHeaderBackButton } from "../../../../design/components/Navigator/native/NavigatorHeader.native";
import { useNavigatorBackPressHandler } from "../../../../design/components/Navigator/native/useNavigatorBackPressHandler.native";
import { intl, t } from "../../../../intl/index.native";
import BackgroundImage from "../../../auth/native/components/atoms/BackgroundImage";
import AuthNavbarPlaceholder from "../../../auth/native/components/atoms/AuthNavbarPlaceholder";
import { ShieldSpotIllustration } from "../../../../design/assets/native";
import AuthHeader from "../../../auth/native/components/atoms/AuthHeader";
import { Text } from "../../../../design/components/Text/native/Text";
import HelpdeskUtils from "../../../../utils/HelpdeskUtils";
import { Button } from "../../../../design/components/Button/native/Button.native";
const useStyles = createStyles((a0) => ({
container: {
alignItems: "center",
justifyContent: "center",
flex: 1,
padding: 16,
paddingTop: 0,
paddingBottom: a0 ? 80 : 0,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
header: {
marginTop: 16
},
body: {
marginTop: 8,
lineHeight: 20,
textAlign: "center"
},
buttonWrapper: {
width: "100%",
marginTop: 24
}
}));
export default function AgeGateUnderage(props) {
let r96;
const onClose = props.onClose;
let underageMessage = props.underageMessage;
let existingUser = props.existingUser;
if (existingUser === void 0) {
existingUser = false;
}
let c21441_1 = existingUser;
const { fromRegister = false, disableSwipe = false } = props;
let c21441_2 = disableSwipe;
const wideAuthView = useWideAuthView();
const styles = useStyles(wideAuthView);
const navigation = useNavigation();
useLayoutEffect(() => {
navigation.setOptions({
headerLeft: c21441_1 ? () => null : getHeaderBackButton(onClose),
gestureEnabled: !c21441_2
});
}, [onClose, existingUser, navigation, disableSwipe]);
useNavigatorBackPressHandler(() => {
onClose();
return true;
});
const r56 = [wideAuthView ? null : <BackgroundImage />, <AuthNavbarPlaceholder />, <ShieldSpotIllustration />, <AuthHeader style={styles.header}>
{existingUser ? intl.string(t["NR/zrG"]) : intl.string(t.nCB6Ga)}
</AuthHeader>, , ,];
if (fromRegister) {
r96 = intl.string(t.GDQgHL);
} else {
const b0QzXe = t.b0QzXe;
if (underageMessage == null) {
underageMessage = intl.string(t.WqEH4D);
}
r96 = intl.format(b0QzXe, {
underageMessage,
helpURL: HelpdeskUtils.getArticleURL(HelpdeskArticles.AGE_GATE)
});
}
r56[4] = <Text style={styles.body} variant="text-md/medium" color="interactive-text-default">{r96}</Text>;
r56[5] = existingUser ? <>
<Text style={styles.body} variant="text-md/medium" color="interactive-text-default">
{intl.format(t["3axQdB"], {
days: 30
})}
</Text>
<View style={styles.buttonWrapper}>
<Button onPress={onClose} text={intl.string(t.JhDw5o)} grow />
</View>
</> : null;
return <View style={styles.container}>{r56}</View>;
};