mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
at main 157 lines 4.6 kB view raw
1import {Text as RNText, View} from 'react-native' 2import {Image} from 'expo-image' 3import {msg, Trans} from '@lingui/macro' 4import {useLingui} from '@lingui/react' 5 6import {urls} from '#/lib/constants' 7import {getUserDisplayName} from '#/lib/getUserDisplayName' 8import {logger} from '#/logger' 9import {useSession} from '#/state/session' 10import {atoms as a, useBreakpoints, useTheme} from '#/alf' 11import {Button, ButtonText} from '#/components/Button' 12import * as Dialog from '#/components/Dialog' 13import {VerifierCheck} from '#/components/icons/VerifierCheck' 14import {Link} from '#/components/Link' 15import {Text} from '#/components/Typography' 16import {type FullVerificationState} from '#/components/verification' 17import type * as bsky from '#/types/bsky' 18 19export {useDialogControl} from '#/components/Dialog' 20 21export function VerifierDialog({ 22 control, 23 profile, 24 verificationState, 25}: { 26 control: Dialog.DialogControlProps 27 profile: bsky.profile.AnyProfileView 28 verificationState: FullVerificationState 29}) { 30 return ( 31 <Dialog.Outer control={control}> 32 <Dialog.Handle /> 33 <Inner 34 control={control} 35 profile={profile} 36 verificationState={verificationState} 37 /> 38 <Dialog.Close /> 39 </Dialog.Outer> 40 ) 41} 42 43function Inner({ 44 profile, 45 control, 46}: { 47 control: Dialog.DialogControlProps 48 profile: bsky.profile.AnyProfileView 49 verificationState: FullVerificationState 50}) { 51 const t = useTheme() 52 const {_} = useLingui() 53 const {gtMobile} = useBreakpoints() 54 const {currentAccount} = useSession() 55 56 const isSelf = profile.did === currentAccount?.did 57 const userName = getUserDisplayName(profile) 58 const label = isSelf 59 ? _(msg`You are a trusted verifier`) 60 : _(msg`${userName} is a trusted verifier`) 61 62 return ( 63 <Dialog.ScrollableInner 64 label={label} 65 style={[ 66 gtMobile ? {width: 'auto', maxWidth: 400, minWidth: 200} : a.w_full, 67 ]}> 68 <View style={[a.gap_lg]}> 69 <View 70 style={[ 71 a.w_full, 72 a.rounded_md, 73 a.overflow_hidden, 74 t.atoms.bg_contrast_25, 75 {minHeight: 100}, 76 ]}> 77 <Image 78 accessibilityIgnoresInvertColors 79 source={require('../../../assets/images/initial_verification_announcement_1.png')} 80 style={[ 81 { 82 aspectRatio: 353 / 160, 83 }, 84 ]} 85 alt={_( 86 msg`An illustration showing that Bluesky selects trusted verifiers, and trusted verifiers in turn verify individual user accounts.`, 87 )} 88 /> 89 </View> 90 91 <View style={[a.gap_sm]}> 92 <Text 93 style={[a.text_2xl, a.font_semi_bold, a.pr_4xl, a.leading_tight]}> 94 {label} 95 </Text> 96 <Text style={[a.text_md, a.leading_snug]}> 97 <Trans> 98 Accounts with a scalloped blue check mark{' '} 99 <RNText> 100 <VerifierCheck width={14} /> 101 </RNText>{' '} 102 can verify others. These trusted verifiers are selected by 103 Bluesky. 104 </Trans> 105 </Text> 106 </View> 107 108 <View 109 style={[ 110 a.w_full, 111 a.gap_sm, 112 a.justify_end, 113 gtMobile ? [a.flex_row, a.justify_end] : [a.flex_col], 114 ]}> 115 <Link 116 overridePresentation 117 to={urls.website.blog.initialVerificationAnnouncement} 118 label={_( 119 msg({ 120 message: `Learn more about verification on Bluesky`, 121 context: `english-only-resource`, 122 }), 123 )} 124 size="small" 125 variant="solid" 126 color="primary" 127 style={[a.justify_center]} 128 onPress={() => { 129 logger.metric( 130 'verification:learn-more', 131 { 132 location: 'verifierDialog', 133 }, 134 {statsig: true}, 135 ) 136 }}> 137 <ButtonText> 138 <Trans context="english-only-resource">Learn more</Trans> 139 </ButtonText> 140 </Link> 141 <Button 142 label={_(msg`Close dialog`)} 143 size="small" 144 variant="solid" 145 color="secondary" 146 onPress={() => { 147 control.close() 148 }}> 149 <ButtonText> 150 <Trans>Close</Trans> 151 </ButtonText> 152 </Button> 153 </View> 154 </View> 155 </Dialog.ScrollableInner> 156 ) 157}