From 2a7bfb1e5d39548306aa227f029ace31cfe61953 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 20 Jan 2025 17:02:59 -0600 Subject: [PATCH] Add videos tab to profile --- src/screens/Profile/Sections/Feed.tsx | 2 ++ src/state/queries/post-feed.ts | 1 + src/view/screens/Profile.tsx | 23 +++++++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/src/screens/Profile/Sections/Feed.tsx b/src/screens/Profile/Sections/Feed.tsx index 0ad197f5f2..9119c6ca6c 100644 --- a/src/screens/Profile/Sections/Feed.tsx +++ b/src/screens/Profile/Sections/Feed.tsx @@ -45,6 +45,7 @@ export const ProfileFeedSection = React.forwardRef< const [hasNew, setHasNew] = React.useState(false) const [isScrolledDown, setIsScrolledDown] = React.useState(false) const shouldUseAdjustedNumToRender = feed.endsWith('posts_and_author_threads') + const isVideoFeed = isNative && feed.endsWith('posts_with_video') const adjustedInitialNumToRender = useInitialNumToRender({ screenHeightOffset: headerHeight, }) @@ -89,6 +90,7 @@ export const ProfileFeedSection = React.forwardRef< initialNumToRender={ shouldUseAdjustedNumToRender ? adjustedInitialNumToRender : undefined } + isVideoFeed={isVideoFeed} /> {(isScrolledDown || hasNew) && ( (null) const repliesSectionRef = React.useRef(null) const mediaSectionRef = React.useRef(null) + const videosSectionRef = React.useRef(null) const likesSectionRef = React.useRef(null) const feedsSectionRef = React.useRef(null) const listsSectionRef = React.useRef(null) @@ -218,6 +219,7 @@ function ProfileScreenLoaded({ const showPostsTab = true const showRepliesTab = hasSession const showMediaTab = !hasLabeler + const showVideosTab = !hasLabeler const showLikesTab = isMe const showFeedsTab = isMe || (profile.associated?.feedgens || 0) > 0 const showStarterPacksTab = @@ -231,6 +233,7 @@ function ProfileScreenLoaded({ showPostsTab ? _(msg`Posts`) : undefined, showRepliesTab ? _(msg`Replies`) : undefined, showMediaTab ? _(msg`Media`) : undefined, + showVideosTab ? _(msg`Videos`) : undefined, showLikesTab ? _(msg`Likes`) : undefined, showFeedsTab ? _(msg`Feeds`) : undefined, showStarterPacksTab ? _(msg`Starter Packs`) : undefined, @@ -242,6 +245,7 @@ function ProfileScreenLoaded({ let postsIndex: number | null = null let repliesIndex: number | null = null let mediaIndex: number | null = null + let videosIndex: number | null = null let likesIndex: number | null = null let feedsIndex: number | null = null let starterPacksIndex: number | null = null @@ -258,6 +262,9 @@ function ProfileScreenLoaded({ if (showMediaTab) { mediaIndex = nextIndex++ } + if (showVideosTab) { + videosIndex = nextIndex++ + } if (showLikesTab) { likesIndex = nextIndex++ } @@ -281,6 +288,8 @@ function ProfileScreenLoaded({ repliesSectionRef.current?.scrollToTop() } else if (index === mediaIndex) { mediaSectionRef.current?.scrollToTop() + } else if (index === videosIndex) { + videosSectionRef.current?.scrollToTop() } else if (index === likesIndex) { likesSectionRef.current?.scrollToTop() } else if (index === feedsIndex) { @@ -296,6 +305,7 @@ function ProfileScreenLoaded({ postsIndex, repliesIndex, mediaIndex, + videosIndex, likesIndex, feedsIndex, listsIndex, @@ -435,6 +445,19 @@ function ProfileScreenLoaded({ /> ) : null} + {showVideosTab + ? ({headerHeight, isFocused, scrollElRef}) => ( + + ) + : null} {showLikesTab ? ({headerHeight, isFocused, scrollElRef}) => (