Bluesky app fork with some witchin' additions 💫

Verification UI tweaks (#8276)

* Prevent issuing verifications for users without display names

* Wait for success before closing, show errors

* Update icons

* WIP adjust size

* Adjust check size in feeds

* Add back unused icon

* Format

authored by Eric Bailey and committed by GitHub 6f44abee e1e93606

Changed files
+66 -34
assets
src
+1 -1
assets/icons/verifiedCheck.svg
··· 1 - <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle cx="12" cy="12" r="12" fill="#208BFE"/><path fill="#fff" fill-rule="evenodd" d="M18.311 7.421a1.437 1.437 0 0 1 0 2.033l-6.571 6.571a1.437 1.437 0 0 1-2.033 0L6.42 12.74a1.438 1.438 0 0 1 2.033-2.033l2.27 2.269 5.554-5.555a1.437 1.437 0 0 1 2.033 0Z" clip-rule="evenodd"/></svg> 1 + <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle cx="12" cy="12" r="11.5" fill="#1183FE"/><path fill="#fff" fill-rule="evenodd" d="M17.659 8.175a1.36 1.36 0 0 1 0 1.925l-6.224 6.223a1.36 1.36 0 0 1-1.925 0L6.4 13.212a1.361 1.361 0 0 1 1.925-1.925l2.149 2.148 5.26-5.26a1.36 1.36 0 0 1 1.925 0Z" clip-rule="evenodd"/></svg>
+1 -1
assets/icons/verifierCheck.svg
··· 1 - <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#208BFE" d="M8.792 1.54a4.11 4.11 0 0 1 6.416 0 4.13 4.13 0 0 0 3.146 1.54c2.616.04 4.544 2.5 4 5.1a4.28 4.28 0 0 0 .777 3.462c1.6 2.104.912 5.17-1.427 6.36a4.21 4.21 0 0 0-2.177 2.774c-.62 2.584-3.408 3.948-5.781 2.83a4.1 4.1 0 0 0-3.492 0c-2.373 1.118-5.16-.246-5.78-2.83a4.21 4.21 0 0 0-2.178-2.775c-2.34-1.19-3.028-4.256-1.427-6.36a4.28 4.28 0 0 0 .777-3.46c-.544-2.602 1.384-5.06 4-5.1a4.13 4.13 0 0 0 3.146-1.54Z"/><path fill="#fff" fill-rule="evenodd" d="M17.659 8.399a1.36 1.36 0 0 1 0 1.925l-6.224 6.223a1.36 1.36 0 0 1-1.925 0L6.4 13.435a1.361 1.361 0 1 1 1.925-1.925l2.149 2.15 5.26-5.261a1.36 1.36 0 0 1 1.925 0Z" clip-rule="evenodd"/></svg> 1 + <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="#1185FE" d="M8.792 1.615a4.154 4.154 0 0 1 6.416 0 4.15 4.15 0 0 0 3.146 1.515 4.154 4.154 0 0 1 4 5.017 4.15 4.15 0 0 0 .777 3.404 4.154 4.154 0 0 1-1.427 6.255 4.15 4.15 0 0 0-2.177 2.73 4.154 4.154 0 0 1-5.781 2.784 4.15 4.15 0 0 0-3.492 0 4.154 4.154 0 0 1-5.78-2.784 4.15 4.15 0 0 0-2.178-2.73A4.154 4.154 0 0 1 .87 11.551a4.15 4.15 0 0 0 .776-3.404 4.154 4.154 0 0 1 4-5.017 4.15 4.15 0 0 0 3.146-1.515Z"/><path fill="#fff" fill-rule="evenodd" d="M17.861 8.26a1.44 1.44 0 0 1 0 2.033l-6.571 6.571a1.437 1.437 0 0 1-2.033 0L5.97 13.58a1.438 1.438 0 0 1 2.033-2.033l2.27 2.269 5.554-5.555a1.437 1.437 0 0 1 2.033 0Z" clip-rule="evenodd"/></svg>
+1 -3
src/components/Prompt.tsx
··· 52 52 <Dialog.ScrollableInner 53 53 accessibilityLabelledBy={titleId} 54 54 accessibilityDescribedBy={descriptionId} 55 - style={[ 56 - gtMobile ? {width: 'auto', maxWidth: 400, minWidth: 200} : a.w_full, 57 - ]}> 55 + style={[gtMobile ? {width: 400} : a.w_full]}> 58 56 {children} 59 57 </Dialog.ScrollableInner> 60 58 </Context.Provider>
+2 -2
src/components/icons/VerifiedCheck.tsx
··· 18 18 width={size} 19 19 height={size} 20 20 style={[style]}> 21 - <Circle cx="12" cy="12" r="12" fill={fill} /> 21 + <Circle cx="12" cy="12" r="11.5" fill={fill} /> 22 22 <Path 23 23 fill="#fff" 24 24 fillRule="evenodd" 25 25 clipRule="evenodd" 26 - d="M18.311 7.421a1.437 1.437 0 0 1 0 2.033l-6.571 6.571a1.437 1.437 0 0 1-2.033 0L6.42 12.74a1.438 1.438 0 0 1 2.033-2.033l2.27 2.269 5.554-5.555a1.437 1.437 0 0 1 2.033 0Z" 26 + d="M17.659 8.175a1.361 1.361 0 0 1 0 1.925l-6.224 6.223a1.361 1.361 0 0 1-1.925 0L6.4 13.212a1.361 1.361 0 0 1 1.925-1.925l2.149 2.148 5.26-5.26a1.361 1.361 0 0 1 1.925 0Z" 27 27 /> 28 28 </Svg> 29 29 )
+2 -2
src/components/icons/VerifierCheck.tsx
··· 22 22 fill={fill} 23 23 fillRule="evenodd" 24 24 clipRule="evenodd" 25 - d="M8.792 1.54a4.11 4.11 0 0 1 6.416 0 4.128 4.128 0 0 0 3.146 1.54c2.616.04 4.544 2.5 4 5.1a4.277 4.277 0 0 0 .777 3.462c1.6 2.104.912 5.17-1.427 6.36a4.21 4.21 0 0 0-2.177 2.774c-.62 2.584-3.408 3.948-5.781 2.83a4.092 4.092 0 0 0-3.492 0c-2.373 1.118-5.16-.246-5.78-2.83a4.21 4.21 0 0 0-2.178-2.775c-2.34-1.19-3.028-4.256-1.427-6.36a4.277 4.277 0 0 0 .776-3.46c-.543-2.602 1.385-5.06 4.001-5.1a4.128 4.128 0 0 0 3.146-1.54Z" 25 + d="M8.792 1.615a4.154 4.154 0 0 1 6.416 0 4.154 4.154 0 0 0 3.146 1.515 4.154 4.154 0 0 1 4 5.017 4.154 4.154 0 0 0 .777 3.404 4.154 4.154 0 0 1-1.427 6.255 4.153 4.153 0 0 0-2.177 2.73 4.154 4.154 0 0 1-5.781 2.784 4.154 4.154 0 0 0-3.492 0 4.154 4.154 0 0 1-5.78-2.784 4.154 4.154 0 0 0-2.178-2.73A4.154 4.154 0 0 1 .87 11.551a4.154 4.154 0 0 0 .776-3.404A4.154 4.154 0 0 1 5.646 3.13a4.154 4.154 0 0 0 3.146-1.515Z" 26 26 /> 27 27 <Path 28 28 fill="#fff" 29 29 fillRule="evenodd" 30 30 clipRule="evenodd" 31 - d="M17.659 8.399a1.361 1.361 0 0 1 0 1.925l-6.224 6.223a1.361 1.361 0 0 1-1.925 0L6.4 13.435a1.361 1.361 0 1 1 1.925-1.925l2.149 2.15 5.26-5.261a1.361 1.361 0 0 1 1.925 0Z" 31 + d="M17.861 8.26a1.438 1.438 0 0 1 0 2.033l-6.571 6.571a1.437 1.437 0 0 1-2.033 0L5.97 13.58a1.438 1.438 0 0 1 2.033-2.033l2.27 2.269 5.554-5.555a1.437 1.437 0 0 1 2.033 0Z" 32 32 /> 33 33 </Svg> 34 34 )
+57 -23
src/components/verification/VerificationCreatePrompt.tsx
··· 1 - import {useCallback} from 'react' 1 + import {useCallback, useState} from 'react' 2 2 import {View} from 'react-native' 3 - import {msg} from '@lingui/macro' 3 + import {msg, Trans} from '@lingui/macro' 4 4 import {useLingui} from '@lingui/react' 5 5 6 6 import {logger} from '#/logger' 7 7 import {useModerationOpts} from '#/state/preferences/moderation-opts' 8 8 import {useVerificationCreateMutation} from '#/state/queries/verification/useVerificationCreateMutation' 9 9 import * as Toast from '#/view/com/util/Toast' 10 - import {atoms as a} from '#/alf' 10 + import {atoms as a, useBreakpoints} from '#/alf' 11 + import {Admonition} from '#/components/Admonition' 12 + import {Button, ButtonIcon, ButtonText} from '#/components/Button' 11 13 import {type DialogControlProps} from '#/components/Dialog' 14 + import * as Dialog from '#/components/Dialog' 12 15 import {VerifiedCheck} from '#/components/icons/VerifiedCheck' 16 + import {Loader} from '#/components/Loader' 13 17 import * as ProfileCard from '#/components/ProfileCard' 14 18 import * as Prompt from '#/components/Prompt' 15 19 import type * as bsky from '#/types/bsky' ··· 22 26 profile: bsky.profile.AnyProfileView 23 27 }) { 24 28 const {_} = useLingui() 29 + const {gtMobile} = useBreakpoints() 25 30 const moderationOpts = useModerationOpts() 26 - const {mutateAsync: create} = useVerificationCreateMutation() 31 + const {mutateAsync: create, isPending} = useVerificationCreateMutation() 32 + const [error, setError] = useState(``) 27 33 const onConfirm = useCallback(async () => { 28 34 try { 29 35 await create({profile}) 30 36 Toast.show(_(msg`Successfully verified`)) 37 + control.close() 31 38 } catch (e) { 32 - Toast.show(_(msg`Failed to create a verification`), 'xmark') 39 + setError(_(msg`Verification failed, please try again.`)) 33 40 logger.error('Failed to create a verification', { 34 41 safeMessage: e, 35 42 }) 36 43 } 37 - }, [_, profile, create]) 44 + }, [_, profile, create, control]) 38 45 39 46 return ( 40 47 <Prompt.Outer control={control}> ··· 47 54 <Prompt.DescriptionText> 48 55 {_(msg`This action can be undone at any time.`)} 49 56 </Prompt.DescriptionText> 50 - <View style={[a.pb_xl]}> 51 - {moderationOpts ? ( 52 - <ProfileCard.Header> 53 - <ProfileCard.Avatar 54 - profile={profile} 55 - moderationOpts={moderationOpts} 56 - /> 57 - <ProfileCard.NameAndHandle 58 - profile={profile} 59 - moderationOpts={moderationOpts} 60 - /> 61 - </ProfileCard.Header> 62 - ) : null} 57 + 58 + {moderationOpts ? ( 59 + <ProfileCard.Header> 60 + <ProfileCard.Avatar 61 + profile={profile} 62 + moderationOpts={moderationOpts} 63 + /> 64 + <ProfileCard.NameAndHandle 65 + profile={profile} 66 + moderationOpts={moderationOpts} 67 + /> 68 + </ProfileCard.Header> 69 + ) : null} 70 + 71 + {error && ( 72 + <View style={[a.pt_lg]}> 73 + <Admonition type="error">{error}</Admonition> 74 + </View> 75 + )} 76 + 77 + <View style={[a.pt_xl]}> 78 + {profile.displayName ? ( 79 + <Prompt.Actions> 80 + <Button 81 + variant="solid" 82 + color="primary" 83 + size={gtMobile ? 'small' : 'large'} 84 + label={_(msg`Verify account`)} 85 + onPress={onConfirm}> 86 + <ButtonText>{_(msg`Verify account`)}</ButtonText> 87 + {isPending && <ButtonIcon icon={Loader} />} 88 + </Button> 89 + <Prompt.Cancel /> 90 + </Prompt.Actions> 91 + ) : ( 92 + <Admonition type="warning"> 93 + <Trans> 94 + This user does not have a display name, and therefore cannot be 95 + verified. 96 + </Trans> 97 + </Admonition> 98 + )} 63 99 </View> 64 - <Prompt.Actions> 65 - <Prompt.Action cta={_(msg`Verify account`)} onPress={onConfirm} /> 66 - <Prompt.Cancel /> 67 - </Prompt.Actions> 100 + 101 + <Dialog.Close /> 68 102 </Prompt.Outer> 69 103 ) 70 104 }
+2 -2
src/view/com/util/PostMeta.tsx
··· 107 107 a.pl_2xs, 108 108 a.self_center, 109 109 { 110 - marginTop: platform({web: -1, ios: -1, android: -2}), 110 + marginTop: platform({web: 0, ios: 0, android: -1}), 111 111 }, 112 112 ]}> 113 113 <VerificationCheck 114 - width={14} 114 + width={platform({android: 13, default: 12})} 115 115 verifier={verification.role === 'verifier'} 116 116 /> 117 117 </View>