tweak wording for own badge (#4631)

zio/stable
Hailey 2024-06-24 17:41:40 -07:00 committed by GitHub
parent dd5198f317
commit f94edc3f44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 20 additions and 4 deletions

View File

@ -10,6 +10,7 @@ import {isNative} from '#/platform/detection'
import {useModerationOpts} from '#/state/preferences/moderation-opts' import {useModerationOpts} from '#/state/preferences/moderation-opts'
import {HITSLOP_10} from 'lib/constants' import {HITSLOP_10} from 'lib/constants'
import {sanitizeDisplayName} from 'lib/strings/display-names' import {sanitizeDisplayName} from 'lib/strings/display-names'
import {useSession} from 'state/session'
import {atoms as a, useTheme} from '#/alf' import {atoms as a, useTheme} from '#/alf'
import {Button, ButtonText} from '#/components/Button' import {Button, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog' import * as Dialog from '#/components/Dialog'
@ -28,16 +29,27 @@ export function NewskieDialog({
const {_} = useLingui() const {_} = useLingui()
const t = useTheme() const t = useTheme()
const moderationOpts = useModerationOpts() const moderationOpts = useModerationOpts()
const {currentAccount} = useSession()
const timeAgo = useGetTimeAgo()
const control = useDialogControl() const control = useDialogControl()
const isMe = profile.did === currentAccount?.did
const createdAt = profile.createdAt as string | undefined
const profileName = React.useMemo(() => { const profileName = React.useMemo(() => {
const name = profile.displayName || profile.handle const name = profile.displayName || profile.handle
if (isMe) {
return _(msg`You`)
}
if (!moderationOpts) return name if (!moderationOpts) return name
const moderation = moderateProfile(profile, moderationOpts) const moderation = moderateProfile(profile, moderationOpts)
return sanitizeDisplayName(name, moderation.ui('displayName')) return sanitizeDisplayName(name, moderation.ui('displayName'))
}, [moderationOpts, profile]) }, [_, isMe, moderationOpts, profile])
const [now] = React.useState(() => Date.now()) const [now] = React.useState(() => Date.now())
const timeAgo = useGetTimeAgo()
const createdAt = profile.createdAt as string | undefined
const daysOld = React.useMemo(() => { const daysOld = React.useMemo(() => {
if (!createdAt) return Infinity if (!createdAt) return Infinity
return differenceInSeconds(now, new Date(createdAt)) / 86400 return differenceInSeconds(now, new Date(createdAt)) / 86400
@ -87,7 +99,11 @@ export function NewskieDialog({
/> />
</View> </View>
<Text style={[a.font_bold, a.text_xl]}> <Text style={[a.font_bold, a.text_xl]}>
{isMe ? (
<Trans>Welcome, friend!</Trans>
) : (
<Trans>Say hello!</Trans> <Trans>Say hello!</Trans>
)}
</Text> </Text>
</View> </View>
<Text style={[a.text_md, a.text_center, a.leading_snug]}> <Text style={[a.text_md, a.text_center, a.leading_snug]}>