diff --git a/src/components/StarterPack/NewskieDialog.tsx b/src/components/StarterPack/NewskieDialog.tsx
index 4f85ecd234..0354bfc432 100644
--- a/src/components/StarterPack/NewskieDialog.tsx
+++ b/src/components/StarterPack/NewskieDialog.tsx
@@ -1,88 +1,85 @@
import React from 'react'
-import {Pressable, View} from 'react-native'
-import {AppBskyActorDefs, AppBskyGraphStarterpack} from '@atproto/api'
+import {View} from 'react-native'
+import {AppBskyActorDefs, moderateProfile} from '@atproto/api'
import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
+import {differenceInSeconds} from 'date-fns'
+import {useGetTimeAgo} from '#/lib/hooks/useTimeAgo'
+import {useModerationOpts} from '#/state/preferences/moderation-opts'
import {HITSLOP_10} from 'lib/constants'
-import {useTimeAgo} from 'lib/hooks/useTimeAgo'
-import {isNative} from 'platform/detection'
-import {useSession} from 'state/session'
-import {atoms as a, useTheme} from '#/alf'
+import {sanitizeDisplayName} from 'lib/strings/display-names'
+import {atoms as a} from '#/alf'
+import {Button} from '#/components/Button'
import * as Dialog from '#/components/Dialog'
import {useDialogControl} from '#/components/Dialog'
import {Newskie} from '#/components/icons/Newskie'
-import {Default as StarterPackCard} from '#/components/StarterPack/StarterPackCard'
import {Text} from '#/components/Typography'
export function NewskieDialog({
profile,
+ disabled,
}: {
profile: AppBskyActorDefs.ProfileViewDetailed
+ disabled?: boolean
}) {
const {_} = useLingui()
- const {currentAccount} = useSession()
- const t = useTheme()
+ const moderationOpts = useModerationOpts()
const control = useDialogControl()
- const {joinedViaStarterPack} = profile
- const profileName = profile.displayName || `@${profile.handle}`
- const createdAt = profile.createdAt ?? 0
- const timeAgo = useTimeAgo(createdAt, {format: 'long'})
+ const profileName = React.useMemo(() => {
+ const name = profile.displayName || profile.handle
+ if (!moderationOpts) return name
+ const moderation = moderateProfile(profile, moderationOpts)
+ return sanitizeDisplayName(name, moderation.ui('displayName'))
+ }, [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
+ }, [createdAt, now])
+
+ if (!createdAt || daysOld > 7) return null
return (
- <>
-
+
+ {({hovered, pressed}) => (
+
+ )}
+
-
-
+
+
Say hello!
- {AppBskyGraphStarterpack.isRecord(
- joinedViaStarterPack?.record,
- ) ? (
-
- {profileName} joined Bluesky {timeAgo} ago with{' '}
- {joinedViaStarterPack?.creator.did === currentAccount?.did
- ? 'your'
- : `${joinedViaStarterPack?.creator.displayName}'s` ||
- `@${joinedViaStarterPack?.creator.handle}'s`}{' '}
- starter pack.
-
- ) : (
-
- {profileName}{' '}
- recently joined Bluesky {timeAgo} ago
-
- )}
+
+ {profileName} joined Bluesky{' '}
+ {timeAgo(createdAt, now, {format: 'long'})} ago
+
- {joinedViaStarterPack && (
-
-
-
- )}
- >
+
)
}