From 964acee540eeedc6b04d41864a907df440f5e3ec Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 17 Jan 2025 23:58:24 +0000 Subject: [PATCH] follow button --- src/lib/statsig/events.ts | 2 + src/screens/Feeds/VibeScreen.tsx | 99 ++++++++++++++++++++++++-------- 2 files changed, 77 insertions(+), 24 deletions(-) diff --git a/src/lib/statsig/events.ts b/src/lib/statsig/events.ts index 1a680c211d..af759e94e2 100644 --- a/src/lib/statsig/events.ts +++ b/src/lib/statsig/events.ts @@ -163,6 +163,7 @@ export type LogEvents = { | 'FeedInterstitial' | 'ProfileHeaderSuggestedFollows' | 'PostOnboardingFindFollows' + | 'ImmersiveVideo' } 'profile:unfollow': { logContext: @@ -179,6 +180,7 @@ export type LogEvents = { | 'FeedInterstitial' | 'ProfileHeaderSuggestedFollows' | 'PostOnboardingFindFollows' + | 'ImmersiveVideo' } 'chat:create': { logContext: 'ProfileHeader' | 'NewChatDialog' | 'SendViaChatDialog' diff --git a/src/screens/Feeds/VibeScreen.tsx b/src/screens/Feeds/VibeScreen.tsx index 81abaef5b2..f59a0e858b 100644 --- a/src/screens/Feeds/VibeScreen.tsx +++ b/src/screens/Feeds/VibeScreen.tsx @@ -54,12 +54,14 @@ import {sanitizeDisplayName} from '#/lib/strings/display-names' import {sanitizeHandle} from '#/lib/strings/handles' import {isAndroid} from '#/platform/detection' import {POST_TOMBSTONE, Shadow, usePostShadow} from '#/state/cache/post-shadow' +import {useProfileShadow} from '#/state/cache/profile-shadow' import {usePostLikeMutationQueue} from '#/state/queries/post' import { AuthorFilter, FeedPostSliceItem, usePostFeedQuery, } from '#/state/queries/post-feed' +import {useProfileFollowMutationQueue} from '#/state/queries/profile' import {useSetMinimalShellMode} from '#/state/shell' import {useSetLightStatusBar} from '#/state/shell/light-status-bar' import {List} from '#/view/com/util/List' @@ -69,7 +71,8 @@ import {UserAvatar} from '#/view/com/util/UserAvatar' import {Header} from '#/screens/VideoFeed/Header' import {atoms as a, platform, ThemeProvider, tokens, useTheme} from '#/alf' import {setNavigationBar} from '#/alf/util/navigationBar' -import {Button, ButtonText} from '#/components/Button' +import {Button, ButtonIcon, ButtonText} from '#/components/Button' +import {Check_Stroke2_Corner0_Rounded as CheckIcon} from '#/components/icons/Check' import * as Layout from '#/components/Layout' import {Link} from '#/components/Link' import {ListFooter} from '#/components/Lists' @@ -472,6 +475,12 @@ function Overlay({ const navigation = useNavigation() const seekingAnimationSV = useSharedValue(0) + const profile = useProfileShadow(post.author) + const [queueFollow, queueUnfollow] = useProfileFollowMutationQueue( + profile, + 'ImmersiveVideo', + ) + const pushToProfile = useNonReactiveCallback(() => { navigation.navigate('Profile', {name: post.author.did}) }) @@ -517,31 +526,73 @@ function Overlay({ colors={['rgba(0,0,0,0)', 'rgba(0,0,0,0.8)', 'rgba(0,0,0,0.95)']} style={[a.w_full, a.pt_md]}> - - - - - {sanitizeDisplayName( + + + + + + {sanitizeDisplayName( + post.author.displayName || post.author.handle, + )} + + + {sanitizeHandle(post.author.handle, '@')} + + + + {/* show button based on non-reactive version, so it doesn't hide on press */} + {!post.author.viewer?.following && ( + + )} + {record?.text?.trim() && (