Bluesky app fork with some witchin' additions 💫

Some metrics (#7294)

* Add trending metrics

* Progress guide events

* Fix naming, improve existing events

authored by

Eric Bailey and committed by
GitHub
c6d26a0a 8b7a3318

+56 -14
+5 -1
src/components/ProgressGuide/FollowDialog.tsx
··· 10 import {useLingui} from '@lingui/react' 11 12 import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback' 13 import {cleanError} from '#/lib/strings/errors' 14 import {logger} from '#/logger' 15 import {isWeb} from '#/platform/detection' ··· 75 <> 76 <Button 77 label={_(msg`Find people to follow`)} 78 - onPress={control.open} 79 size={gtMobile ? 'small' : 'large'} 80 color="primary" 81 variant="solid">
··· 10 import {useLingui} from '@lingui/react' 11 12 import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback' 13 + import {logEvent} from '#/lib/statsig/statsig' 14 import {cleanError} from '#/lib/strings/errors' 15 import {logger} from '#/logger' 16 import {isWeb} from '#/platform/detection' ··· 76 <> 77 <Button 78 label={_(msg`Find people to follow`)} 79 + onPress={() => { 80 + control.open() 81 + logEvent('progressGuide:followDialog:open', {}) 82 + }} 83 size={gtMobile ? 'small' : 'large'} 84 color="primary" 85 variant="solid">
+6 -1
src/components/interstitials/Trending.tsx
··· 88 ) : !trending?.topics ? null : ( 89 <> 90 {trending.topics.map(topic => ( 91 - <TrendingTopicLink key={topic.link} topic={topic}> 92 {({hovered}) => ( 93 <TrendingTopic 94 topic={topic}
··· 88 ) : !trending?.topics ? null : ( 89 <> 90 {trending.topics.map(topic => ( 91 + <TrendingTopicLink 92 + key={topic.link} 93 + topic={topic} 94 + onPress={() => { 95 + logEvent('trendingTopic:click', {context: 'interstitial'}) 96 + }}> 97 {({hovered}) => ( 98 <TrendingTopic 99 topic={topic}
+13 -2
src/lib/statsig/events.ts
··· 237 'tmd:download': {} 238 'tmd:post': {} 239 240 - 'trendingTopics:show': {} 241 'trendingTopics:hide': { 242 - context: 'sidebar' | 'interstitial' | 'explore:trending' 243 } 244 }
··· 237 'tmd:download': {} 238 'tmd:post': {} 239 240 + 'trendingTopics:show': { 241 + context: 'settings' 242 + } 243 'trendingTopics:hide': { 244 + context: 'settings' | 'sidebar' | 'interstitial' | 'explore:trending' 245 + } 246 + 'trendingTopic:click': { 247 + context: 'sidebar' | 'interstitial' | 'explore' 248 + } 249 + 'recommendedTopic:click': { 250 + context: 'explore' 251 } 252 + 253 + 'progressGuide:hide': {} 254 + 'progressGuide:followDialog:open': {} 255 }
+7 -1
src/screens/Search/components/ExploreRecommendations.tsx
··· 1 import {View} from 'react-native' 2 import {Trans} from '@lingui/macro' 3 4 import {isWeb} from '#/platform/detection' 5 import { 6 DEFAULT_LIMIT as RECOMMENDATIONS_COUNT, ··· 71 ) : !trending?.suggested ? null : ( 72 <> 73 {trending.suggested.map(topic => ( 74 - <TrendingTopicLink key={topic.link} topic={topic}> 75 {({hovered}) => ( 76 <TrendingTopic 77 topic={topic}
··· 1 import {View} from 'react-native' 2 import {Trans} from '@lingui/macro' 3 4 + import {logEvent} from '#/lib/statsig/statsig' 5 import {isWeb} from '#/platform/detection' 6 import { 7 DEFAULT_LIMIT as RECOMMENDATIONS_COUNT, ··· 72 ) : !trending?.suggested ? null : ( 73 <> 74 {trending.suggested.map(topic => ( 75 + <TrendingTopicLink 76 + key={topic.link} 77 + topic={topic} 78 + onPress={() => { 79 + logEvent('recommendedTopic:click', {context: 'explore'}) 80 + }}> 81 {({hovered}) => ( 82 <TrendingTopic 83 topic={topic}
+6 -1
src/screens/Search/components/ExploreTrendingTopics.tsx
··· 106 ) : !trending?.topics ? null : ( 107 <> 108 {trending.topics.map(topic => ( 109 - <TrendingTopicLink key={topic.link} topic={topic}> 110 {({hovered}) => ( 111 <TrendingTopic 112 topic={topic}
··· 106 ) : !trending?.topics ? null : ( 107 <> 108 {trending.topics.map(topic => ( 109 + <TrendingTopicLink 110 + key={topic.link} 111 + topic={topic} 112 + onPress={() => { 113 + logEvent('trendingTopic:click', {context: 'explore'}) 114 + }}> 115 {({hovered}) => ( 116 <TrendingTopic 117 topic={topic}
+10 -1
src/screens/Settings/ContentAndMediaSettings.tsx
··· 3 import {NativeStackScreenProps} from '@react-navigation/native-stack' 4 5 import {CommonNavigatorParams} from '#/lib/routes/types' 6 import {isNative} from '#/platform/detection' 7 import {useAutoplayDisabled, useSetAutoplayDisabled} from '#/state/preferences' 8 import { ··· 120 name="show_trending_topics" 121 label={_(msg`Enable trending topics`)} 122 value={!trendingDisabled} 123 - onChange={value => setTrendingDisabled(!value)}> 124 <SettingsList.Item> 125 <SettingsList.ItemIcon icon={Graph} /> 126 <SettingsList.ItemText>
··· 3 import {NativeStackScreenProps} from '@react-navigation/native-stack' 4 5 import {CommonNavigatorParams} from '#/lib/routes/types' 6 + import {logEvent} from '#/lib/statsig/statsig' 7 import {isNative} from '#/platform/detection' 8 import {useAutoplayDisabled, useSetAutoplayDisabled} from '#/state/preferences' 9 import { ··· 121 name="show_trending_topics" 122 label={_(msg`Enable trending topics`)} 123 value={!trendingDisabled} 124 + onChange={value => { 125 + const hide = Boolean(!value) 126 + if (hide) { 127 + logEvent('trendingTopics:hide', {context: 'settings'}) 128 + } else { 129 + logEvent('trendingTopics:show', {context: 'settings'}) 130 + } 131 + setTrendingDisabled(hide) 132 + }}> 133 <SettingsList.Item> 134 <SettingsList.ItemIcon icon={Graph} /> 135 <SettingsList.ItemText>
+1 -6
src/state/preferences/trending.tsx
··· 1 import React from 'react' 2 3 - import {logEvent} from '#/lib/statsig/statsig' 4 import * as persisted from '#/state/persisted' 5 6 type StateContext = { ··· 27 (value: Exclude<persisted.Schema[T], undefined>) => void 28 >( 29 hidden => { 30 - const hide = Boolean(hidden) 31 - if (!hide) { 32 - logEvent('trendingTopics:show', {}) 33 - } 34 - _set(hide) 35 persisted.write(key, hidden) 36 }, 37 [key, _set],
··· 1 import React from 'react' 2 3 import * as persisted from '#/state/persisted' 4 5 type StateContext = { ··· 26 (value: Exclude<persisted.Schema[T], undefined>) => void 27 >( 28 hidden => { 29 + _set(Boolean(hidden)) 30 persisted.write(key, hidden) 31 }, 32 [key, _set],
+2
src/state/shell/progress-guide.tsx
··· 2 import {msg} from '@lingui/macro' 3 import {useLingui} from '@lingui/react' 4 5 import { 6 ProgressGuideToast, 7 ProgressGuideToastRef, ··· 137 endProgressGuide() { 138 setLocalGuideState(undefined) 139 mutateAsync(undefined) 140 }, 141 142 captureAction(action: ProgressGuideAction, count = 1) {
··· 2 import {msg} from '@lingui/macro' 3 import {useLingui} from '@lingui/react' 4 5 + import {logEvent} from '#/lib/statsig/statsig' 6 import { 7 ProgressGuideToast, 8 ProgressGuideToastRef, ··· 138 endProgressGuide() { 139 setLocalGuideState(undefined) 140 mutateAsync(undefined) 141 + logEvent('progressGuide:hide', {}) 142 }, 143 144 captureAction(action: ProgressGuideAction, count = 1) {
+6 -1
src/view/shell/desktop/SidebarTrendingTopics.tsx
··· 79 ) : !trending?.topics ? null : ( 80 <> 81 {trending.topics.slice(0, TRENDING_LIMIT).map(topic => ( 82 - <TrendingTopicLink key={topic.link} topic={topic}> 83 {({hovered}) => ( 84 <TrendingTopic 85 size="small"
··· 79 ) : !trending?.topics ? null : ( 80 <> 81 {trending.topics.slice(0, TRENDING_LIMIT).map(topic => ( 82 + <TrendingTopicLink 83 + key={topic.link} 84 + topic={topic} 85 + onPress={() => { 86 + logEvent('trendingTopic:click', {context: 'sidebar'}) 87 + }}> 88 {({hovered}) => ( 89 <TrendingTopic 90 size="small"