An ATproto social media client -- with an independent Appview.
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 97 lines 3.1 kB view raw
1import {View} from 'react-native' 2import {msg, Trans} from '@lingui/macro' 3import {useLingui} from '@lingui/react' 4 5import {useAgeAssurance} from '#/state/ageAssurance/useAgeAssurance' 6import {logger} from '#/state/ageAssurance/util' 7import {atoms as a} from '#/alf' 8import {Admonition} from '#/components/Admonition' 9import {AgeAssuranceBadge} from '#/components/ageAssurance/AgeAssuranceBadge' 10import {useAgeAssuranceCopy} from '#/components/ageAssurance/useAgeAssuranceCopy' 11import {ButtonIcon, ButtonText} from '#/components/Button' 12import {ChevronRight_Stroke2_Corner0_Rounded as ChevronRight} from '#/components/icons/Chevron' 13import * as Layout from '#/components/Layout' 14import {Link} from '#/components/Link' 15import {Text} from '#/components/Typography' 16 17export function AgeRestrictedScreen({ 18 children, 19 screenTitle, 20 infoText, 21 rightHeaderSlot, 22}: { 23 children: React.ReactNode 24 screenTitle?: string 25 infoText?: string 26 rightHeaderSlot?: React.ReactNode 27}) { 28 const {_} = useLingui() 29 const copy = useAgeAssuranceCopy() 30 const {isReady, isAgeRestricted} = useAgeAssurance() 31 32 if (!isReady) { 33 return ( 34 <Layout.Screen> 35 <Layout.Header.Outer> 36 <Layout.Header.Content> 37 <Layout.Header.TitleText> </Layout.Header.TitleText> 38 </Layout.Header.Content> 39 <Layout.Header.Slot /> 40 </Layout.Header.Outer> 41 <Layout.Content /> 42 </Layout.Screen> 43 ) 44 } 45 if (!isAgeRestricted) return children 46 47 return ( 48 <Layout.Screen> 49 <Layout.Header.Outer> 50 <Layout.Header.BackButton /> 51 <Layout.Header.Content align="left"> 52 <Layout.Header.TitleText> 53 {screenTitle ?? <Trans>Unavailable</Trans>} 54 </Layout.Header.TitleText> 55 </Layout.Header.Content> 56 {rightHeaderSlot ?? <Layout.Header.Slot />} 57 </Layout.Header.Outer> 58 <Layout.Content> 59 <View style={[a.p_lg]}> 60 <View style={[a.align_start, a.pb_lg]}> 61 <AgeAssuranceBadge /> 62 </View> 63 64 <View style={[a.gap_sm, a.pb_lg]}> 65 <Text style={[a.text_xl, a.leading_snug, a.font_heavy]}> 66 <Trans> 67 You must complete age assurance in order to access this screen. 68 </Trans> 69 </Text> 70 71 <Text style={[a.text_md, a.leading_snug]}>{copy.notice}</Text> 72 </View> 73 74 <View 75 style={[a.flex_row, a.justify_between, a.align_center, a.pb_xl]}> 76 <Link 77 label={_(msg`Go to account settings`)} 78 to="/settings/account" 79 size="small" 80 variant="solid" 81 color="primary" 82 onPress={() => { 83 logger.metric('ageAssurance:navigateToSettings', {}) 84 }}> 85 <ButtonText> 86 <Trans>Go to account settings</Trans> 87 </ButtonText> 88 <ButtonIcon icon={ChevronRight} position="right" /> 89 </Link> 90 </View> 91 92 {infoText && <Admonition type="tip">{infoText}</Admonition>} 93 </View> 94 </Layout.Content> 95 </Layout.Screen> 96 ) 97}