From f94edc3f445c10db5a6b11db62532dc66fc8a968 Mon Sep 17 00:00:00 2001 From: Hailey Date: Mon, 24 Jun 2024 17:41:40 -0700 Subject: [PATCH] tweak wording for own badge (#4631) --- src/components/NewskieDialog.tsx | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/components/NewskieDialog.tsx b/src/components/NewskieDialog.tsx index d456bd6d..1a523a83 100644 --- a/src/components/NewskieDialog.tsx +++ b/src/components/NewskieDialog.tsx @@ -10,6 +10,7 @@ import {isNative} from '#/platform/detection' import {useModerationOpts} from '#/state/preferences/moderation-opts' import {HITSLOP_10} from 'lib/constants' import {sanitizeDisplayName} from 'lib/strings/display-names' +import {useSession} from 'state/session' import {atoms as a, useTheme} from '#/alf' import {Button, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' @@ -28,16 +29,27 @@ export function NewskieDialog({ const {_} = useLingui() const t = useTheme() const moderationOpts = useModerationOpts() + const {currentAccount} = useSession() + const timeAgo = useGetTimeAgo() const control = useDialogControl() + + const isMe = profile.did === currentAccount?.did + const createdAt = profile.createdAt as string | undefined + const profileName = React.useMemo(() => { const name = profile.displayName || profile.handle + + if (isMe) { + return _(msg`You`) + } + if (!moderationOpts) return name const moderation = moderateProfile(profile, moderationOpts) + return sanitizeDisplayName(name, moderation.ui('displayName')) - }, [moderationOpts, profile]) + }, [_, isMe, moderationOpts, profile]) + const [now] = React.useState(() => Date.now()) - const timeAgo = useGetTimeAgo() - const createdAt = profile.createdAt as string | undefined const daysOld = React.useMemo(() => { if (!createdAt) return Infinity return differenceInSeconds(now, new Date(createdAt)) / 86400 @@ -87,7 +99,11 @@ export function NewskieDialog({ /> - Say hello! + {isMe ? ( + Welcome, friend! + ) : ( + Say hello! + )}