Compare commits

...

1 Commits

Author SHA1 Message Date
Hailey 9d2e3e6049 env var tweaks (#7457)
* add new events

* Discard changes to package.json

* Discard changes to src/lib/constants.ts

* Discard changes to src/state/feed-feedback.tsx

* Discard changes to yarn.lock

* remove unused event
2025-01-26 17:26:57 -08:00
7 changed files with 76 additions and 6 deletions
+23 -2
View File
@@ -196,6 +196,7 @@ export function SuggestedFollowsProfile({did}: {did: string}) {
<ProfileGrid
isSuggestionsLoading={isSuggestionsLoading}
profiles={data?.suggestions ?? []}
recId={data?.recId}
error={error}
viewContext="profile"
/>
@@ -222,10 +223,12 @@ export function ProfileGrid({
isSuggestionsLoading,
error,
profiles,
recId,
viewContext = 'feed',
}: {
isSuggestionsLoading: boolean
profiles: AppBskyActorDefs.ProfileViewDetailed[]
recId?: number
error: Error | null
viewContext: 'profile' | 'feed'
}) {
@@ -249,12 +252,19 @@ export function ProfileGrid({
))
) : error || !profiles.length ? null : (
<>
{profiles.slice(0, maxLength).map(profile => (
{profiles.slice(0, maxLength).map((profile, index) => (
<ProfileCard.Link
key={profile.did}
profile={profile}
onPress={() => {
logEvent('feed:interstitial:profileCard:press', {})
logEvent('suggestedUser:press', {
logContext:
viewContext === 'feed'
? 'InterstitialDiscover'
: 'InterstitialProfile',
recId,
position: index,
})
}}
style={[
a.flex_1,
@@ -282,6 +292,17 @@ export function ProfileGrid({
logContext="FeedInterstitial"
shape="round"
colorInverted
onFollow={() => {
logEvent('suggestedUser:follow', {
logContext:
viewContext === 'feed'
? 'InterstitialDiscover'
: 'InterstitialProfile',
location: 'Card',
recId,
position: index,
})
}}
/>
</ProfileCard.Header>
<ProfileCard.Description profile={profile} numberOfLines={2} />
+3
View File
@@ -286,6 +286,7 @@ export type FollowButtonProps = {
logContext: LogEvents['profile:follow']['logContext'] &
LogEvents['profile:unfollow']['logContext']
colorInverted?: boolean
onFollow?: () => void
} & Partial<ButtonProps>
export function FollowButton(props: FollowButtonProps) {
@@ -299,6 +300,7 @@ export function FollowButtonInner({
moderationOpts,
logContext,
onPress: onPressProp,
onFollow,
colorInverted,
...rest
}: FollowButtonProps) {
@@ -325,6 +327,7 @@ export function FollowButtonInner({
),
)
onPressProp?.(e)
onFollow?.()
} catch (err: any) {
if (err?.name !== 'AbortError') {
Toast.show(_(msg`An issue occurred, please try again.`), 'xmark')
+20 -1
View File
@@ -165,6 +165,26 @@ export type LogEvents = {
| 'PostOnboardingFindFollows'
| 'ImmersiveVideo'
}
'suggestedUser:follow': {
logContext:
| 'Explore'
| 'InterstitialDiscover'
| 'InterstitialProfile'
| 'Profile'
location: 'Card' | 'Profile'
recId?: number
position: number
}
'suggestedUser:press': {
logContext: 'Explore' | 'InterstitialDiscover' | 'InterstitialProfile'
recId?: number
position: number
}
'suggestedUser:seen': {
logContext: 'Explore' | 'InterstitialDiscover' | 'InterstitialProfile'
recId?: number
position: number
}
'profile:unfollow': {
logContext:
| 'RecommendedFollowsItem'
@@ -220,7 +240,6 @@ export type LogEvents = {
domain: string
}
'feed:interstitial:profileCard:press': {}
'feed:interstitial:feedCard:press': {}
'profile:header:suggestedFollowsCard:press': {}
+1 -1
View File
@@ -120,7 +120,7 @@ export function useSuggestedFollowsByActorQuery({
const suggestions = res.data.isFallback
? []
: res.data.suggestions.filter(profile => !profile.viewer?.following)
return {suggestions}
return {suggestions, recId: res.data.recId}
},
enabled,
})
+3
View File
@@ -14,12 +14,14 @@ export function FollowButton({
profile,
labelStyle,
logContext,
onFollow,
}: {
unfollowedType?: ButtonType
followedType?: ButtonType
profile: Shadow<AppBskyActorDefs.ProfileViewBasic>
labelStyle?: StyleProp<TextStyle>
logContext: 'ProfileCard' | 'StarterPackProfilesList'
onFollow?: () => void
}) {
const [queueFollow, queueUnfollow] = useProfileFollowMutationQueue(
profile,
@@ -30,6 +32,7 @@ export function FollowButton({
const onPressFollow = async () => {
try {
await queueFollow()
onFollow?.()
} catch (e: any) {
if (e?.name !== 'AbortError') {
Toast.show(_(msg`An issue occurred, please try again.`), 'xmark')
+7 -1
View File
@@ -184,6 +184,7 @@ export function ProfileCardWithFollowBtn({
noBg,
noBorder,
onPress,
onFollow,
logContext = 'ProfileCard',
showKnownFollowers,
}: {
@@ -191,6 +192,7 @@ export function ProfileCardWithFollowBtn({
noBg?: boolean
noBorder?: boolean
onPress?: () => void
onFollow?: () => void
logContext?: 'ProfileCard' | 'StarterPackProfilesList'
showKnownFollowers?: boolean
}) {
@@ -206,7 +208,11 @@ export function ProfileCardWithFollowBtn({
isMe
? undefined
: profileShadow => (
<FollowButton profile={profileShadow} logContext={logContext} />
<FollowButton
profile={profileShadow}
logContext={logContext}
onFollow={onFollow}
/>
)
}
onPress={onPress}
+19 -1
View File
@@ -10,6 +10,7 @@ import {
import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {logEvent} from '#/lib/statsig/statsig'
import {cleanError} from '#/lib/strings/errors'
import {logger} from '#/logger'
import {isNative, isWeb} from '#/platform/detection'
@@ -259,6 +260,7 @@ type ExploreScreenItems =
type: 'profile'
key: string
profile: AppBskyActorDefs.ProfileView
recId?: number
}
| {
type: 'feed'
@@ -383,6 +385,7 @@ export function Explore() {
type: 'profile',
key: actor.did,
profile: actor,
recId: page.recId,
})
}
}
@@ -511,7 +514,7 @@ export function Explore() {
])
const renderItem = React.useCallback(
({item}: {item: ExploreScreenItems}) => {
({item, index}: {item: ExploreScreenItems; index: number}) => {
switch (item.type) {
case 'header': {
return (
@@ -540,6 +543,21 @@ export function Explore() {
noBg
noBorder
showKnownFollowers
onPress={() => {
logEvent('suggestedUser:press', {
logContext: 'Explore',
recId: item.recId,
position: index,
})
}}
onFollow={() => {
logEvent('suggestedUser:follow', {
logContext: 'Explore',
location: 'Card',
recId: item.recId,
position: index,
})
}}
/>
</View>
)