From dbbbba1d32cbb96d9ab98eb871f3618df7f6e628 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 30 Aug 2024 16:54:55 +0100 Subject: [Experiment] Suggest profiles in profile (#5030) * Rename variable to disambiguate with parent scope * More variables where they are used * Inline variables * Add suggestions in profile * Gate it * rm space * Remove header suggestions under gate --- src/view/com/posts/Feed.tsx | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) (limited to 'src/view/com/posts/Feed.tsx') diff --git a/src/view/com/posts/Feed.tsx b/src/view/com/posts/Feed.tsx index f0709a3ea..bad6ccfea 100644 --- a/src/view/com/posts/Feed.tsx +++ b/src/view/com/posts/Feed.tsx @@ -101,7 +101,7 @@ const feedInterstitialType = 'interstitialFeeds' const followInterstitialType = 'interstitialFollows' const progressGuideInterstitialType = 'interstitialProgressGuide' const interstials: Record< - 'following' | 'discover', + 'following' | 'discover' | 'profile', (FeedItem & { type: | 'interstitialFeeds' @@ -128,6 +128,16 @@ const interstials: Record< slot: 20, }, ], + profile: [ + { + type: followInterstitialType, + params: { + variant: 'default', + }, + key: followInterstitialType, + slot: 5, + }, + ], } export function getFeedPostSlice(feedItem: FeedItem): FeedPostSlice | null { @@ -193,9 +203,7 @@ let Feed = ({ const [isPTRing, setIsPTRing] = React.useState(false) const checkForNewRef = React.useRef<(() => void) | null>(null) const lastFetchRef = React.useRef(Date.now()) - const [feedType, feedUri] = feed.split('|') - const feedIsDiscover = feedUri === DISCOVER_FEED_URI - const feedIsFollowing = feedType === 'following' + const [feedType, feedUri, feedTab] = feed.split('|') const gate = useGate() const opts = React.useMemo( @@ -339,14 +347,21 @@ let Feed = ({ } if (hasSession) { - const feedType = feedIsFollowing - ? 'following' - : feedIsDiscover - ? 'discover' - : undefined + let feedKind: 'following' | 'discover' | 'profile' | undefined + if (feedType === 'following') { + feedKind = 'following' + } else if (feedUri === DISCOVER_FEED_URI) { + feedKind = 'discover' + } else if ( + feedType === 'author' && + (feedTab === 'posts_and_author_threads' || + feedTab === 'posts_with_replies') + ) { + feedKind = 'profile' + } - if (feedType) { - for (const interstitial of interstials[feedType]) { + if (feedKind) { + for (const interstitial of interstials[feedKind]) { const shouldShow = (interstitial.type === feedInterstitialType && gate('suggested_feeds_interstitial')) || @@ -377,9 +392,9 @@ let Feed = ({ isEmpty, lastFetchedAt, data, + feedType, feedUri, - feedIsDiscover, - feedIsFollowing, + feedTab, gate, hasSession, ]) @@ -470,7 +485,7 @@ let Feed = ({ } else if (item.type === feedInterstitialType) { return } else if (item.type === followInterstitialType) { - return + return } else if (item.type === progressGuideInterstitialType) { return } else if (item.type === 'slice') { -- cgit 1.4.1