From 317fc7c86ff722cf9e5da1ea776e00e2d788b805 Mon Sep 17 00:00:00 2001 From: Hailey Date: Fri, 7 Jun 2024 13:31:43 -0700 Subject: [PATCH] add a dialog for newskies to profiles (cherry picked from commit fe16f55e9c5e8faef540b563662b0c0c9a1d2d77) (cherry picked from commit c5b9f1b16ace276f422832069db076a5360616fe) --- src/components/StarterPack/NewskieDialog.tsx | 65 ++++++++++++++++++++ src/components/icons/Newskie.tsx | 2 +- src/screens/Profile/Header/DisplayName.tsx | 12 ++-- 3 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 src/components/StarterPack/NewskieDialog.tsx diff --git a/src/components/StarterPack/NewskieDialog.tsx b/src/components/StarterPack/NewskieDialog.tsx new file mode 100644 index 0000000000..92919111a7 --- /dev/null +++ b/src/components/StarterPack/NewskieDialog.tsx @@ -0,0 +1,65 @@ +import React from 'react' +import {Pressable, View} from 'react-native' +import {AppBskyActorDefs, AppBskyGraphStarterpack} from '@atproto/api' +import {msg, Trans} from '@lingui/macro' +import {useLingui} from '@lingui/react' + +import {HITSLOP_10} from 'lib/constants' +import {isNative} from 'platform/detection' +import {atoms as a} from '#/alf' +import * as Dialog from '#/components/Dialog' +import {useDialogControl} from '#/components/Dialog' +import {Newskie} from '#/components/icons/Newskie' +import {Text} from '#/components/Typography' + +export function NewskieDialog({ + profile, +}: { + profile: AppBskyActorDefs.ProfileViewDetailed +}) { + const {_} = useLingui() + const control = useDialogControl() + + const profileName = profile.displayName || `@${profile.handle}` + const joinedVia = profile.joinedViaStarterPack + + return ( + <> + + + + + + + + + + {profileName} is new here! + + + {AppBskyGraphStarterpack.isRecord(joinedVia?.record) ? ( + + {profileName} recently joined Bluesky with{' '} + {joinedVia?.creator.displayName || + `@${joinedVia?.creator.handle}`} + 's starter pack! + + ) : ( + + {profileName} recently joined Bluesky on {profile.createdAt}. + + )} + + + + + + ) +} diff --git a/src/components/icons/Newskie.tsx b/src/components/icons/Newskie.tsx index 881255736c..ba4943f1be 100644 --- a/src/components/icons/Newskie.tsx +++ b/src/components/icons/Newskie.tsx @@ -3,7 +3,7 @@ import {View} from 'react-native' import Svg, {Path} from 'react-native-svg' export function Newskie({size}: {size: number}) { return ( - + + @@ -26,6 +27,9 @@ export function ProfileHeaderDisplayName({ moderation.ui('displayName'), )} + + + ) }