diff options
-rw-r--r-- | assets/icons/verifiedCheck.svg | 2 | ||||
-rw-r--r-- | assets/icons/verifierCheck.svg | 2 | ||||
-rw-r--r-- | src/components/Prompt.tsx | 4 | ||||
-rw-r--r-- | src/components/icons/VerifiedCheck.tsx | 4 | ||||
-rw-r--r-- | src/components/icons/VerifierCheck.tsx | 4 | ||||
-rw-r--r-- | src/components/verification/VerificationCreatePrompt.tsx | 80 | ||||
-rw-r--r-- | src/view/com/util/PostMeta.tsx | 4 |
7 files changed, 66 insertions, 34 deletions
diff --git a/assets/icons/verifiedCheck.svg b/assets/icons/verifiedCheck.svg index f76955ac8..d66a9926f 100644 --- a/assets/icons/verifiedCheck.svg +++ b/assets/icons/verifiedCheck.svg @@ -1 +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> +<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> diff --git a/assets/icons/verifierCheck.svg b/assets/icons/verifierCheck.svg index 71158eb13..d49b37ee2 100644 --- a/assets/icons/verifierCheck.svg +++ b/assets/icons/verifierCheck.svg @@ -1 +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> +<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> diff --git a/src/components/Prompt.tsx b/src/components/Prompt.tsx index ed8c15f15..f21c98ff8 100644 --- a/src/components/Prompt.tsx +++ b/src/components/Prompt.tsx @@ -52,9 +52,7 @@ export function Outer({ <Dialog.ScrollableInner accessibilityLabelledBy={titleId} accessibilityDescribedBy={descriptionId} - style={[ - gtMobile ? {width: 'auto', maxWidth: 400, minWidth: 200} : a.w_full, - ]}> + style={[gtMobile ? {width: 400} : a.w_full]}> {children} </Dialog.ScrollableInner> </Context.Provider> diff --git a/src/components/icons/VerifiedCheck.tsx b/src/components/icons/VerifiedCheck.tsx index 9299eb6e3..9d0aa9158 100644 --- a/src/components/icons/VerifiedCheck.tsx +++ b/src/components/icons/VerifiedCheck.tsx @@ -18,12 +18,12 @@ export const VerifiedCheck = React.forwardRef<Svg, Props>(function LogoImpl( width={size} height={size} style={[style]}> - <Circle cx="12" cy="12" r="12" fill={fill} /> + <Circle cx="12" cy="12" r="11.5" fill={fill} /> <Path fill="#fff" fillRule="evenodd" clipRule="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" + 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" /> </Svg> ) diff --git a/src/components/icons/VerifierCheck.tsx b/src/components/icons/VerifierCheck.tsx index 7c3a0149d..143c24b97 100644 --- a/src/components/icons/VerifierCheck.tsx +++ b/src/components/icons/VerifierCheck.tsx @@ -22,13 +22,13 @@ export const VerifierCheck = React.forwardRef<Svg, Props>(function LogoImpl( fill={fill} fillRule="evenodd" clipRule="evenodd" - 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" + 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" /> <Path fill="#fff" fillRule="evenodd" clipRule="evenodd" - 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" + 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" /> </Svg> ) diff --git a/src/components/verification/VerificationCreatePrompt.tsx b/src/components/verification/VerificationCreatePrompt.tsx index 39ac6dbf6..eb57d7c36 100644 --- a/src/components/verification/VerificationCreatePrompt.tsx +++ b/src/components/verification/VerificationCreatePrompt.tsx @@ -1,15 +1,19 @@ -import {useCallback} from 'react' +import {useCallback, useState} from 'react' import {View} from 'react-native' -import {msg} from '@lingui/macro' +import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {logger} from '#/logger' import {useModerationOpts} from '#/state/preferences/moderation-opts' import {useVerificationCreateMutation} from '#/state/queries/verification/useVerificationCreateMutation' import * as Toast from '#/view/com/util/Toast' -import {atoms as a} from '#/alf' +import {atoms as a, useBreakpoints} from '#/alf' +import {Admonition} from '#/components/Admonition' +import {Button, ButtonIcon, ButtonText} from '#/components/Button' import {type DialogControlProps} from '#/components/Dialog' +import * as Dialog from '#/components/Dialog' import {VerifiedCheck} from '#/components/icons/VerifiedCheck' +import {Loader} from '#/components/Loader' import * as ProfileCard from '#/components/ProfileCard' import * as Prompt from '#/components/Prompt' import type * as bsky from '#/types/bsky' @@ -22,19 +26,22 @@ export function VerificationCreatePrompt({ profile: bsky.profile.AnyProfileView }) { const {_} = useLingui() + const {gtMobile} = useBreakpoints() const moderationOpts = useModerationOpts() - const {mutateAsync: create} = useVerificationCreateMutation() + const {mutateAsync: create, isPending} = useVerificationCreateMutation() + const [error, setError] = useState(``) const onConfirm = useCallback(async () => { try { await create({profile}) Toast.show(_(msg`Successfully verified`)) + control.close() } catch (e) { - Toast.show(_(msg`Failed to create a verification`), 'xmark') + setError(_(msg`Verification failed, please try again.`)) logger.error('Failed to create a verification', { safeMessage: e, }) } - }, [_, profile, create]) + }, [_, profile, create, control]) return ( <Prompt.Outer control={control}> @@ -47,24 +54,51 @@ export function VerificationCreatePrompt({ <Prompt.DescriptionText> {_(msg`This action can be undone at any time.`)} </Prompt.DescriptionText> - <View style={[a.pb_xl]}> - {moderationOpts ? ( - <ProfileCard.Header> - <ProfileCard.Avatar - profile={profile} - moderationOpts={moderationOpts} - /> - <ProfileCard.NameAndHandle - profile={profile} - moderationOpts={moderationOpts} - /> - </ProfileCard.Header> - ) : null} + + {moderationOpts ? ( + <ProfileCard.Header> + <ProfileCard.Avatar + profile={profile} + moderationOpts={moderationOpts} + /> + <ProfileCard.NameAndHandle + profile={profile} + moderationOpts={moderationOpts} + /> + </ProfileCard.Header> + ) : null} + + {error && ( + <View style={[a.pt_lg]}> + <Admonition type="error">{error}</Admonition> + </View> + )} + + <View style={[a.pt_xl]}> + {profile.displayName ? ( + <Prompt.Actions> + <Button + variant="solid" + color="primary" + size={gtMobile ? 'small' : 'large'} + label={_(msg`Verify account`)} + onPress={onConfirm}> + <ButtonText>{_(msg`Verify account`)}</ButtonText> + {isPending && <ButtonIcon icon={Loader} />} + </Button> + <Prompt.Cancel /> + </Prompt.Actions> + ) : ( + <Admonition type="warning"> + <Trans> + This user does not have a display name, and therefore cannot be + verified. + </Trans> + </Admonition> + )} </View> - <Prompt.Actions> - <Prompt.Action cta={_(msg`Verify account`)} onPress={onConfirm} /> - <Prompt.Cancel /> - </Prompt.Actions> + + <Dialog.Close /> </Prompt.Outer> ) } diff --git a/src/view/com/util/PostMeta.tsx b/src/view/com/util/PostMeta.tsx index d5af32236..fd8e3a38b 100644 --- a/src/view/com/util/PostMeta.tsx +++ b/src/view/com/util/PostMeta.tsx @@ -107,11 +107,11 @@ let PostMeta = (opts: PostMetaOpts): React.ReactNode => { a.pl_2xs, a.self_center, { - marginTop: platform({web: -1, ios: -1, android: -2}), + marginTop: platform({web: 0, ios: 0, android: -1}), }, ]}> <VerificationCheck - width={14} + width={platform({android: 13, default: 12})} verifier={verification.role === 'verifier'} /> </View> |