diff options
author | surfdude29 <149612116+surfdude29@users.noreply.github.com> | 2025-09-11 20:08:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-11 12:08:30 -0700 |
commit | b9a41f30a5aaef3fbee3731cd0d8016dc00d77d8 (patch) | |
tree | 77885c856fcabda58da5c3abe3711dbdd1ae022c /src | |
parent | 6a4c56dfa96ed987001adfaf0553f97580f6653e (diff) | |
download | voidsky-b9a41f30a5aaef3fbee3731cd0d8016dc00d77d8.tar.zst |
Generate separate strings for join messages in Newskie dialog (#8007)
* try again * prettier * prettier round 2 * Update src/components/NewskieDialog.tsx Co-authored-by: Samuel Newman <mozzius@protonmail.com> --------- Co-authored-by: Samuel Newman <mozzius@protonmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/NewskieDialog.tsx | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/src/components/NewskieDialog.tsx b/src/components/NewskieDialog.tsx index 30f70f549..0453d40d7 100644 --- a/src/components/NewskieDialog.tsx +++ b/src/components/NewskieDialog.tsx @@ -85,17 +85,35 @@ function DialogInner({ const isMe = profile.did === currentAccount?.did const profileName = useMemo(() => { - const name = profile.displayName || profile.handle + if (!moderationOpts) return profile.displayName || profile.handle + const moderation = moderateProfile(profile, moderationOpts) + return sanitizeDisplayName( + profile.displayName || profile.handle, + moderation.ui('displayName'), + ) + }, [moderationOpts, profile]) + + const getJoinMessage = () => { + const timeAgoString = timeAgo(createdAt, now, {format: 'long'}) if (isMe) { - return _(msg`You`) + if (profile.joinedViaStarterPack) { + return _( + msg`You joined Bluesky using a starter pack ${timeAgoString} ago`, + ) + } else { + return _(msg`You joined Bluesky ${timeAgoString} ago`) + } + } else { + if (profile.joinedViaStarterPack) { + return _( + msg`${profileName} joined Bluesky using a starter pack ${timeAgoString} ago`, + ) + } else { + return _(msg`${profileName} joined Bluesky ${timeAgoString} ago`) + } } - - if (!moderationOpts) return name - const moderation = moderateProfile(profile, moderationOpts) - - return sanitizeDisplayName(name, moderation.ui('displayName')) - }, [_, isMe, moderationOpts, profile]) + } return ( <Dialog.ScrollableInner @@ -122,17 +140,7 @@ function DialogInner({ </Text> </View> <Text style={[a.text_md, a.text_center, a.leading_snug]}> - {profile.joinedViaStarterPack ? ( - <Trans> - {profileName} joined Bluesky using a starter pack{' '} - {timeAgo(createdAt, now, {format: 'long'})} ago - </Trans> - ) : ( - <Trans> - {profileName} joined Bluesky{' '} - {timeAgo(createdAt, now, {format: 'long'})} ago - </Trans> - )} + {getJoinMessage()} </Text> {profile.joinedViaStarterPack ? ( <StarterPackCard.Link |