log event when following from starter pack list

This commit is contained in:
Hailey
2024-06-10 13:16:47 -07:00
parent b4566fed97
commit f938fb8bd5
4 changed files with 17 additions and 7 deletions
+2
View File
@@ -125,6 +125,7 @@ export type LogEvents = {
| 'ProfileMenu' | 'ProfileMenu'
| 'ProfileHoverCard' | 'ProfileHoverCard'
| 'AvatarButton' | 'AvatarButton'
| 'StarterPackProfilesList'
} }
'profile:unfollow': { 'profile:unfollow': {
logContext: logContext:
@@ -137,6 +138,7 @@ export type LogEvents = {
| 'ProfileHoverCard' | 'ProfileHoverCard'
| 'Chat' | 'Chat'
| 'AvatarButton' | 'AvatarButton'
| 'StarterPackProfilesList'
} }
'chat:create': { 'chat:create': {
logContext: 'ProfileHeader' | 'NewChatDialog' | 'SendViaChatDialog' logContext: 'ProfileHeader' | 'NewChatDialog' | 'SendViaChatDialog'
@@ -10,7 +10,12 @@ import {List, ListRef} from 'view/com/util/List'
import {SectionRef} from '#/screens/Profile/Sections/types' import {SectionRef} from '#/screens/Profile/Sections/types'
function renderItem({item}: {item: AppBskyActorDefs.ProfileViewBasic}) { function renderItem({item}: {item: AppBskyActorDefs.ProfileViewBasic}) {
return <ProfileCardWithFollowBtn profile={item} /> return (
<ProfileCardWithFollowBtn
profile={item}
logContext="StarterPackProfilesList"
/>
)
} }
function keyExtractor(item: AppBskyActorDefs.ProfileViewBasic, index: number) { function keyExtractor(item: AppBskyActorDefs.ProfileViewBasic, index: number) {
+6 -5
View File
@@ -1,12 +1,13 @@
import React from 'react' import React from 'react'
import {StyleProp, TextStyle, View} from 'react-native' import {StyleProp, TextStyle, View} from 'react-native'
import {AppBskyActorDefs} from '@atproto/api' import {AppBskyActorDefs} from '@atproto/api'
import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {Shadow} from '#/state/cache/types'
import {useProfileFollowMutationQueue} from '#/state/queries/profile'
import {Button, ButtonType} from '../util/forms/Button' import {Button, ButtonType} from '../util/forms/Button'
import * as Toast from '../util/Toast' import * as Toast from '../util/Toast'
import {useProfileFollowMutationQueue} from '#/state/queries/profile'
import {Shadow} from '#/state/cache/types'
import {useLingui} from '@lingui/react'
import {msg} from '@lingui/macro'
export function FollowButton({ export function FollowButton({
unfollowedType = 'inverted', unfollowedType = 'inverted',
@@ -19,7 +20,7 @@ export function FollowButton({
followedType?: ButtonType followedType?: ButtonType
profile: Shadow<AppBskyActorDefs.ProfileViewBasic> profile: Shadow<AppBskyActorDefs.ProfileViewBasic>
labelStyle?: StyleProp<TextStyle> labelStyle?: StyleProp<TextStyle>
logContext: 'ProfileCard' logContext: 'ProfileCard' | 'StarterPackProfilesList'
}) { }) {
const [queueFollow, queueUnfollow] = useProfileFollowMutationQueue( const [queueFollow, queueUnfollow] = useProfileFollowMutationQueue(
profile, profile,
+3 -1
View File
@@ -251,12 +251,14 @@ export function ProfileCardWithFollowBtn({
noBorder, noBorder,
followers, followers,
onPress, onPress,
logContext = 'ProfileCard',
}: { }: {
profile: AppBskyActorDefs.ProfileViewBasic profile: AppBskyActorDefs.ProfileViewBasic
noBg?: boolean noBg?: boolean
noBorder?: boolean noBorder?: boolean
followers?: AppBskyActorDefs.ProfileView[] | undefined followers?: AppBskyActorDefs.ProfileView[] | undefined
onPress?: () => void onPress?: () => void
logContext?: 'ProfileCard' | 'StarterPackProfilesList'
}) { }) {
const {currentAccount} = useSession() const {currentAccount} = useSession()
const isMe = profile.did === currentAccount?.did const isMe = profile.did === currentAccount?.did
@@ -271,7 +273,7 @@ export function ProfileCardWithFollowBtn({
isMe isMe
? undefined ? undefined
: profileShadow => ( : profileShadow => (
<FollowButton profile={profileShadow} logContext="ProfileCard" /> <FollowButton profile={profileShadow} logContext={logContext} />
) )
} }
onPress={onPress} onPress={onPress}