mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
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 style={[a.text_2xl, a.font_bold, a.pr_4xl, a.leading_tight]}>
93 {label}
94 </Text>
95 <Text style={[a.text_md, a.leading_snug]}>
96 <Trans>
97 Accounts with a scalloped blue check mark{' '}
98 <RNText>
99 <VerifierCheck width={14} />
100 </RNText>{' '}
101 can verify others. These trusted verifiers are selected by
102 Bluesky.
103 </Trans>
104 </Text>
105 </View>
106
107 <View
108 style={[
109 a.w_full,
110 a.gap_sm,
111 a.justify_end,
112 gtMobile ? [a.flex_row, a.justify_end] : [a.flex_col],
113 ]}>
114 <Link
115 overridePresentation
116 to={urls.website.blog.initialVerificationAnnouncement}
117 label={_(msg`Learn more about verification on Bluesky`)}
118 size="small"
119 variant="solid"
120 color="primary"
121 style={[a.justify_center]}
122 onPress={() => {
123 logger.metric(
124 'verification:learn-more',
125 {
126 location: 'verifierDialog',
127 },
128 {statsig: true},
129 )
130 }}>
131 <ButtonText>
132 <Trans>Learn more</Trans>
133 </ButtonText>
134 </Link>
135 <Button
136 label={_(msg`Close dialog`)}
137 size="small"
138 variant="solid"
139 color="secondary"
140 onPress={() => {
141 control.close()
142 }}>
143 <ButtonText>
144 <Trans>Close</Trans>
145 </ButtonText>
146 </Button>
147 </View>
148 </View>
149 </Dialog.ScrollableInner>
150 )
151}