tweaks
(cherry picked from commit 070363c947)
(cherry picked from commit c30855d4ff311e31fb6ae357a9d6cd1662b291d5)
This commit is contained in:
@@ -4,8 +4,10 @@ import {AppBskyActorDefs, AppBskyGraphStarterpack} from '@atproto/api'
|
|||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
|
import {useGetTimeAgo} from '#/lib/hooks/useTimeAgo'
|
||||||
import {HITSLOP_10} from 'lib/constants'
|
import {HITSLOP_10} from 'lib/constants'
|
||||||
import {isNative} from 'platform/detection'
|
import {isNative} from 'platform/detection'
|
||||||
|
import {useSession} from 'state/session'
|
||||||
import {atoms as a} from '#/alf'
|
import {atoms as a} from '#/alf'
|
||||||
import * as Dialog from '#/components/Dialog'
|
import * as Dialog from '#/components/Dialog'
|
||||||
import {useDialogControl} from '#/components/Dialog'
|
import {useDialogControl} from '#/components/Dialog'
|
||||||
@@ -18,10 +20,13 @@ export function NewskieDialog({
|
|||||||
profile: AppBskyActorDefs.ProfileViewDetailed
|
profile: AppBskyActorDefs.ProfileViewDetailed
|
||||||
}) {
|
}) {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
|
const {currentAccount} = useSession()
|
||||||
const control = useDialogControl()
|
const control = useDialogControl()
|
||||||
|
const {joinedViaStarterPack} = profile
|
||||||
const profileName = profile.displayName || `@${profile.handle}`
|
const profileName = profile.displayName || `@${profile.handle}`
|
||||||
const joinedVia = profile.joinedViaStarterPack
|
const timeAgo = useGetTimeAgo()
|
||||||
|
|
||||||
|
if (!profile.createdAt) return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -43,17 +48,23 @@ export function NewskieDialog({
|
|||||||
<Text style={[a.font_bold, a.text_xl]}>
|
<Text style={[a.font_bold, a.text_xl]}>
|
||||||
<Trans>Say hello!</Trans>
|
<Trans>Say hello!</Trans>
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={[]}>
|
<Text style={[a.text_md]}>
|
||||||
{AppBskyGraphStarterpack.isRecord(joinedVia?.record) ? (
|
{AppBskyGraphStarterpack.isRecord(
|
||||||
|
joinedViaStarterPack?.record,
|
||||||
|
) ? (
|
||||||
<Trans>
|
<Trans>
|
||||||
{profileName} recently joined Bluesky with{' '}
|
{profileName} joined Bluesky{' '}
|
||||||
{joinedVia?.creator.displayName ||
|
{timeAgo(profile.createdAt, {format: 'long'})} ago with{' '}
|
||||||
`@${joinedVia?.creator.handle}`}
|
{joinedViaStarterPack?.creator.did === currentAccount?.did
|
||||||
's starter pack!
|
? 'your'
|
||||||
|
: `${joinedViaStarterPack?.creator.displayName}'s` ||
|
||||||
|
`@${joinedViaStarterPack?.creator.handle}'s`}{' '}
|
||||||
|
starter pack.
|
||||||
</Trans>
|
</Trans>
|
||||||
) : (
|
) : (
|
||||||
<Trans>
|
<Trans>
|
||||||
{profileName} recently joined Bluesky on {profile.createdAt}.
|
{profileName} recently joined Bluesky{' '}
|
||||||
|
{timeAgo(profile.createdAt)} ago
|
||||||
</Trans>
|
</Trans>
|
||||||
)}
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
Reference in New Issue
Block a user