use new time ago hook
This commit is contained in:
@@ -5,7 +5,7 @@ import {msg, Trans} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {HITSLOP_10} from 'lib/constants'
|
import {HITSLOP_10} from 'lib/constants'
|
||||||
import {ago} from 'lib/strings/time'
|
import {useTimeAgo} from 'lib/hooks/useTimeAgo'
|
||||||
import {isNative} from 'platform/detection'
|
import {isNative} from 'platform/detection'
|
||||||
import {useSession} from 'state/session'
|
import {useSession} from 'state/session'
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
@@ -27,6 +27,7 @@ export function NewskieDialog({
|
|||||||
const {joinedViaStarterPack} = profile
|
const {joinedViaStarterPack} = profile
|
||||||
const profileName = profile.displayName || `@${profile.handle}`
|
const profileName = profile.displayName || `@${profile.handle}`
|
||||||
const createdAt = profile.createdAt ?? 0
|
const createdAt = profile.createdAt ?? 0
|
||||||
|
const timeAgo = useTimeAgo(createdAt, {format: 'long'})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -53,7 +54,7 @@ export function NewskieDialog({
|
|||||||
joinedViaStarterPack?.record,
|
joinedViaStarterPack?.record,
|
||||||
) ? (
|
) ? (
|
||||||
<Trans>
|
<Trans>
|
||||||
{profileName} joined Bluesky {ago(createdAt, true)} ago with{' '}
|
{profileName} joined Bluesky {timeAgo} ago with{' '}
|
||||||
{joinedViaStarterPack?.creator.did === currentAccount?.did
|
{joinedViaStarterPack?.creator.did === currentAccount?.did
|
||||||
? 'your'
|
? 'your'
|
||||||
: `${joinedViaStarterPack?.creator.displayName}'s` ||
|
: `${joinedViaStarterPack?.creator.displayName}'s` ||
|
||||||
@@ -63,7 +64,7 @@ export function NewskieDialog({
|
|||||||
) : (
|
) : (
|
||||||
<Trans>
|
<Trans>
|
||||||
<Text style={[a.font_bold, a.text_md]}>{profileName}</Text>{' '}
|
<Text style={[a.font_bold, a.text_md]}>{profileName}</Text>{' '}
|
||||||
recently joined Bluesky {ago(createdAt, true)} ago
|
recently joined Bluesky {timeAgo} ago
|
||||||
</Trans>
|
</Trans>
|
||||||
)}
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
Reference in New Issue
Block a user