about summary refs log tree commit diff
path: root/src/view/com/posts/PostFeed.tsx
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2025-01-21 18:45:33 -0600
committerGitHub <noreply@github.com>2025-01-22 00:45:33 +0000
commit6538013484a42a3b92001725ec2602dab86eb939 (patch)
treee6a2377105482f9046865a6071a845cb9b31491b /src/view/com/posts/PostFeed.tsx
parent1403570a6a231099c35c977afe38f84349d92018 (diff)
downloadvoidsky-6538013484a42a3b92001725ec2602dab86eb939.tar.zst
Add videos tab to profile (#7517)
* Add videos tab to profile

* Modify sourceContext for author feeds

* Use actual typecast, better name for feedUri

* Make EOF conditional

* Clearer condition

---------

Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
Diffstat (limited to 'src/view/com/posts/PostFeed.tsx')
-rw-r--r--src/view/com/posts/PostFeed.tsx39
1 files changed, 27 insertions, 12 deletions
diff --git a/src/view/com/posts/PostFeed.tsx b/src/view/com/posts/PostFeed.tsx
index 0afc7f61a..c50d7f979 100644
--- a/src/view/com/posts/PostFeed.tsx
+++ b/src/view/com/posts/PostFeed.tsx
@@ -25,6 +25,7 @@ import {useFeedFeedbackContext} from '#/state/feed-feedback'
 import {useTrendingSettings} from '#/state/preferences/trending'
 import {STALE} from '#/state/queries'
 import {
+  AuthorFilter,
   FeedDescriptor,
   FeedParams,
   FeedPostSlice,
@@ -38,6 +39,7 @@ import {useProgressGuide} from '#/state/shell/progress-guide'
 import {List, ListRef} from '#/view/com/util/List'
 import {PostFeedLoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder'
 import {LoadMoreRetryBtn} from '#/view/com/util/LoadMoreRetryBtn'
+import {VideoFeedSourceContext} from '#/screens/VideoFeed/types'
 import {useBreakpoints} from '#/alf'
 import {ProgressGuide, SuggestedFollows} from '#/components/FeedInterstitials'
 import {
@@ -194,7 +196,7 @@ let PostFeed = ({
   const [isPTRing, setIsPTRing] = React.useState(false)
   const checkForNewRef = React.useRef<(() => void) | null>(null)
   const lastFetchRef = React.useRef<number>(Date.now())
-  const [feedType, feedUri, feedTab] = feed.split('|')
+  const [feedType, feedUriOrActorDid, feedTab] = feed.split('|')
   const {gtMobile, gtTablet} = useBreakpoints()
   const areVideoFeedsEnabled = isNative
 
@@ -307,7 +309,7 @@ let PostFeed = ({
     let feedKind: 'following' | 'discover' | 'profile' | 'thevids' | undefined
     if (feedType === 'following') {
       feedKind = 'following'
-    } else if (feedUri === DISCOVER_FEED_URI) {
+    } else if (feedUriOrActorDid === DISCOVER_FEED_URI) {
       feedKind = 'discover'
     } else if (
       feedType === 'author' &&
@@ -318,7 +320,7 @@ let PostFeed = ({
     }
 
     let arr: FeedRow[] = []
-    if (KNOWN_SHUTDOWN_FEEDS.includes(feedUri)) {
+    if (KNOWN_SHUTDOWN_FEEDS.includes(feedUriOrActorDid)) {
       arr.push({
         type: 'feedShutdownMsg',
         key: 'feedShutdownMsg',
@@ -376,7 +378,7 @@ let PostFeed = ({
               type: 'videoGridRow',
               key: row.map(r => r.item._reactKey).join('-'),
               items: row.map(r => r.item),
-              sourceFeedUri: feedUri,
+              sourceFeedUri: feedUriOrActorDid,
               feedContexts: row.map(r => r.feedContext),
             })
           }
@@ -504,7 +506,7 @@ let PostFeed = ({
     lastFetchedAt,
     data,
     feedType,
-    feedUri,
+    feedUriOrActorDid,
     feedTab,
     hasSession,
     showProgressIntersitial,
@@ -595,7 +597,7 @@ let PostFeed = ({
       } else if (row.type === 'loading') {
         return <PostFeedLoadingPlaceholder />
       } else if (row.type === 'feedShutdownMsg') {
-        return <FeedShutdownMsg feedUri={feedUri} />
+        return <FeedShutdownMsg feedUri={feedUriOrActorDid} />
       } else if (row.type === 'interstitialFollows') {
         return <SuggestedFollows feed={feed} />
       } else if (row.type === 'interstitialProgressGuide') {
@@ -646,14 +648,25 @@ let PostFeed = ({
           </View>
         )
       } else if (row.type === 'videoGridRow') {
+        let sourceContext: VideoFeedSourceContext
+        if (feedType === 'author') {
+          sourceContext = {
+            type: 'author',
+            did: feedUriOrActorDid,
+            filter: feedTab as AuthorFilter,
+          }
+        } else {
+          sourceContext = {
+            type: 'feedgen',
+            uri: row.sourceFeedUri,
+            sourceInterstitial: feedCacheKey ?? 'none',
+          }
+        }
+
         return (
           <PostFeedVideoGridRow
             items={row.items}
-            sourceContext={{
-              type: 'feedgen',
-              uri: row.sourceFeedUri,
-              sourceInterstitial: feedCacheKey ?? 'none',
-            }}
+            sourceContext={sourceContext}
           />
         )
       } else {
@@ -668,7 +681,9 @@ let PostFeed = ({
       savedFeedConfig,
       _,
       onPressRetryLoadMore,
-      feedUri,
+      feedType,
+      feedUriOrActorDid,
+      feedTab,
       feedCacheKey,
     ],
   )