Style follow buttons in expanded bundles, add client event on expand
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
import {type Platform} from 'react-native'
|
import {type Platform} from 'react-native'
|
||||||
|
|
||||||
import {type NotificationReason} from '#/lib/hooks/useNotificationHandler'
|
import {type NotificationReason} from '#/lib/hooks/useNotificationHandler'
|
||||||
|
import {type NotificationType} from '#/state/queries/notifications/types'
|
||||||
import {type FeedDescriptor} from '#/state/queries/post-feed'
|
import {type FeedDescriptor} from '#/state/queries/post-feed'
|
||||||
import {type LiveEventFeedMetricContext} from '#/features/liveEvents/types'
|
import {type LiveEventFeedMetricContext} from '#/features/liveEvents/types'
|
||||||
|
|
||||||
@@ -53,6 +54,10 @@ export type Events = {
|
|||||||
context: 'StartOnboarding' | 'AfterOnboarding' | 'Login' | 'Home'
|
context: 'StartOnboarding' | 'AfterOnboarding' | 'Login' | 'Home'
|
||||||
status: 'granted' | 'denied' | 'undetermined'
|
status: 'granted' | 'denied' | 'undetermined'
|
||||||
}
|
}
|
||||||
|
'notifications:bundleExpand': {
|
||||||
|
notificationType: NotificationType
|
||||||
|
authorCount: number
|
||||||
|
}
|
||||||
'state:background': {
|
'state:background': {
|
||||||
secondsActive: number
|
secondsActive: number
|
||||||
}
|
}
|
||||||
@@ -464,6 +469,7 @@ export type Events = {
|
|||||||
| 'OnboardingSuggestedAccounts'
|
| 'OnboardingSuggestedAccounts'
|
||||||
| 'FindContacts'
|
| 'FindContacts'
|
||||||
| 'GroupChat'
|
| 'GroupChat'
|
||||||
|
| 'NotificationExpandedProfileCard'
|
||||||
}
|
}
|
||||||
'profile:followers:view': {
|
'profile:followers:view': {
|
||||||
contextProfileDid: string
|
contextProfileDid: string
|
||||||
@@ -570,6 +576,7 @@ export type Events = {
|
|||||||
| 'OnboardingSuggestedAccounts'
|
| 'OnboardingSuggestedAccounts'
|
||||||
| 'FindContacts'
|
| 'FindContacts'
|
||||||
| 'GroupChat'
|
| 'GroupChat'
|
||||||
|
| 'NotificationExpandedProfileCard'
|
||||||
}
|
}
|
||||||
'chat:create': {
|
'chat:create': {
|
||||||
logContext:
|
logContext:
|
||||||
|
|||||||
@@ -147,14 +147,6 @@ let NotificationFeedItem = ({
|
|||||||
return ''
|
return ''
|
||||||
}, [item])
|
}, [item])
|
||||||
|
|
||||||
const onToggleAuthorsExpanded = (e?: GestureResponderEvent) => {
|
|
||||||
if (e) {
|
|
||||||
e.preventDefault()
|
|
||||||
e.stopPropagation()
|
|
||||||
}
|
|
||||||
setIsAuthorsExpanded(currentlyExpanded => !currentlyExpanded)
|
|
||||||
}
|
|
||||||
|
|
||||||
const onBeforePress = useCallback(() => {
|
const onBeforePress = useCallback(() => {
|
||||||
unstableCacheProfileView(queryClient, item.notification.author)
|
unstableCacheProfileView(queryClient, item.notification.author)
|
||||||
}, [queryClient, item.notification.author])
|
}, [queryClient, item.notification.author])
|
||||||
@@ -177,6 +169,20 @@ let NotificationFeedItem = ({
|
|||||||
)
|
)
|
||||||
}, [item, moderationOpts])
|
}, [item, moderationOpts])
|
||||||
|
|
||||||
|
const onToggleAuthorsExpanded = (e?: GestureResponderEvent) => {
|
||||||
|
if (e) {
|
||||||
|
e.preventDefault()
|
||||||
|
e.stopPropagation()
|
||||||
|
}
|
||||||
|
if (!isAuthorsExpanded) {
|
||||||
|
ax.metric('notifications:bundleExpand', {
|
||||||
|
notificationType: item.type,
|
||||||
|
authorCount: authors.length,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
setIsAuthorsExpanded(currentlyExpanded => !currentlyExpanded)
|
||||||
|
}
|
||||||
|
|
||||||
const niceTimestamp = niceDate(i18n, item.notification.indexedAt)
|
const niceTimestamp = niceDate(i18n, item.notification.indexedAt)
|
||||||
const firstAuthor = authors[0]
|
const firstAuthor = authors[0]
|
||||||
const firstAuthorName = sanitizeDisplayName(
|
const firstAuthorName = sanitizeDisplayName(
|
||||||
@@ -1097,6 +1103,8 @@ function ExpandedAuthorProfileCard({
|
|||||||
moderationOpts: ModerationOpts
|
moderationOpts: ModerationOpts
|
||||||
isLast: boolean
|
isLast: boolean
|
||||||
}) {
|
}) {
|
||||||
|
const profile = useProfileShadow(author.profile)
|
||||||
|
const isFollowing = !!profile.viewer?.following
|
||||||
return (
|
return (
|
||||||
<ProfileCard.Link
|
<ProfileCard.Link
|
||||||
profile={author.profile}
|
profile={author.profile}
|
||||||
@@ -1114,7 +1122,11 @@ function ExpandedAuthorProfileCard({
|
|||||||
<ProfileCard.FollowButton
|
<ProfileCard.FollowButton
|
||||||
profile={author.profile}
|
profile={author.profile}
|
||||||
moderationOpts={moderationOpts}
|
moderationOpts={moderationOpts}
|
||||||
logContext="ProfileCard"
|
logContext="NotificationExpandedProfileCard"
|
||||||
|
size="tiny"
|
||||||
|
variant={isFollowing ? 'ghost' : 'solid'}
|
||||||
|
color={isFollowing ? 'secondary' : 'primary_subtle'}
|
||||||
|
withIcon={isFollowing}
|
||||||
/>
|
/>
|
||||||
</ProfileCard.Header>
|
</ProfileCard.Header>
|
||||||
</ProfileCard.Outer>
|
</ProfileCard.Outer>
|
||||||
|
|||||||
Reference in New Issue
Block a user