Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[Experiment] Show "Follow Back" label (#3439)

authored by

dan and committed by
GitHub
f03390e4 887fedab

+18 -7
+18 -7
src/view/com/post-thread/PostThreadFollowBtn.tsx
··· 1 1 import React from 'react' 2 2 import {StyleSheet, TouchableOpacity, View} from 'react-native' 3 - import {useNavigation} from '@react-navigation/native' 4 3 import {AppBskyActorDefs} from '@atproto/api' 4 + import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' 5 5 import {msg, Trans} from '@lingui/macro' 6 6 import {useLingui} from '@lingui/react' 7 - import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' 7 + import {useNavigation} from '@react-navigation/native' 8 8 9 + import {useGate} from '#/lib/statsig/statsig' 9 10 import {logger} from '#/logger' 10 - import {Text} from 'view/com/util/text/Text' 11 - import * as Toast from 'view/com/util/Toast' 12 - import {s} from 'lib/styles' 11 + import {track} from 'lib/analytics/analytics' 13 12 import {usePalette} from 'lib/hooks/usePalette' 14 13 import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' 14 + import {s} from 'lib/styles' 15 15 import {Shadow, useProfileShadow} from 'state/cache/profile-shadow' 16 - import {track} from 'lib/analytics/analytics' 17 16 import { 18 17 useProfileFollowMutationQueue, 19 18 useProfileQuery, 20 19 } from 'state/queries/profile' 21 20 import {useRequireAuth} from 'state/session' 21 + import {Text} from 'view/com/util/text/Text' 22 + import * as Toast from 'view/com/util/Toast' 22 23 23 24 export function PostThreadFollowBtn({did}: {did: string}) { 24 25 const {data: profile, isLoading} = useProfileQuery({did}) ··· 47 48 'PostThreadItem', 48 49 ) 49 50 const requireAuth = useRequireAuth() 51 + const showFollowBackLabel = useGate('show_follow_back_label') 50 52 51 53 const isFollowing = !!profile.viewer?.following 54 + const isFollowedBy = !!profile.viewer?.followedBy 52 55 const [wasFollowing, setWasFollowing] = React.useState<boolean>(isFollowing) 53 56 54 57 // This prevents the button from disappearing as soon as we follow. ··· 136 139 type="button" 137 140 style={[!isFollowing ? palInverted.text : pal.text, s.bold]} 138 141 numberOfLines={1}> 139 - {!isFollowing ? <Trans>Follow</Trans> : <Trans>Following</Trans>} 142 + {!isFollowing ? ( 143 + showFollowBackLabel && isFollowedBy ? ( 144 + <Trans>Follow Back</Trans> 145 + ) : ( 146 + <Trans>Follow</Trans> 147 + ) 148 + ) : ( 149 + <Trans>Following</Trans> 150 + )} 140 151 </Text> 141 152 </TouchableOpacity> 142 153 </View>