From c097f68a7d4116408bb848593346444a8260a16b Mon Sep 17 00:00:00 2001
From: Caidan Williams <caidan@internet.dev>
Date: Thu, 21 Aug 2025 12:53:35 -0700
Subject: refactor: extract ViewMoreCard from VideoCards component

Moved the 'View more' card logic into a separate ViewMoreCard component
for better separation of concerns and readability.

Updated imports to use named React hooks instead of React namespace. To
modernise this old component per the new guidelines.
---
 src/components/interstitials/TrendingVideos.tsx | 102 +++++++++++++-----------
 1 file changed, 55 insertions(+), 47 deletions(-)

(limited to 'src/components/interstitials/TrendingVideos.tsx')

diff --git a/src/components/interstitials/TrendingVideos.tsx b/src/components/interstitials/TrendingVideos.tsx
index 4d59e2fb5..4275f7fc8 100644
--- a/src/components/interstitials/TrendingVideos.tsx
+++ b/src/components/interstitials/TrendingVideos.tsx
@@ -1,4 +1,4 @@
-import React, {useEffect} from 'react'
+import {useCallback, useEffect, useMemo} from 'react'
 import {ScrollView, View} from 'react-native'
 import {AppBskyEmbedVideo, AtUri} from '@atproto/api'
 import {msg, Trans} from '@lingui/macro'
@@ -55,7 +55,7 @@ export function TrendingVideos() {
   const {setTrendingVideoDisabled} = useTrendingSettingsApi()
   const trendingPrompt = Prompt.usePromptControl()
 
-  const onConfirmHide = React.useCallback(() => {
+  const onConfirmHide = useCallback(() => {
     setTrendingVideoDisabled(true)
     logEvent('trendingVideos:hide', {context: 'interstitial:discover'})
   }, [setTrendingVideoDisabled])
@@ -147,9 +147,7 @@ function VideoCards({
 }: {
   data: Exclude<ReturnType<typeof usePostFeedQuery>['data'], undefined>
 }) {
-  const t = useTheme()
-  const {_} = useLingui()
-  const items = React.useMemo(() => {
+  const items = useMemo(() => {
     return data.pages
       .flatMap(page => page.slices)
       .map(slice => slice.items[0])
@@ -157,10 +155,6 @@ function VideoCards({
       .filter(item => AppBskyEmbedVideo.isView(item.post.embed))
       .slice(0, 8)
   }, [data])
-  const href = React.useMemo(() => {
-    const urip = new AtUri(VIDEO_FEED_URI)
-    return makeCustomFeedLink(urip.host, urip.rkey, undefined, 'discover')
-  }, [])
 
   return (
     <>
@@ -183,50 +177,64 @@ function VideoCards({
         </View>
       ))}
 
-      <View style={[{width: CARD_WIDTH * 2}]}>
-        <Link
-          to={href}
-          label={_(msg`View more`)}
-          style={[
-            a.justify_center,
-            a.align_center,
-            a.flex_1,
-            a.rounded_lg,
-            a.border,
-            t.atoms.border_contrast_low,
-            t.atoms.bg,
-            t.atoms.shadow_sm,
-          ]}>
-          {({pressed}) => (
+      <ViewMoreCard />
+    </>
+  )
+}
+
+function ViewMoreCard() {
+  const t = useTheme()
+  const {_} = useLingui()
+
+  const href = useMemo(() => {
+    const urip = new AtUri(VIDEO_FEED_URI)
+    return makeCustomFeedLink(urip.host, urip.rkey, undefined, 'discover')
+  }, [])
+
+  return (
+    <View style={[{width: CARD_WIDTH * 2}]}>
+      <Link
+        to={href}
+        label={_(msg`View more`)}
+        style={[
+          a.justify_center,
+          a.align_center,
+          a.flex_1,
+          a.rounded_lg,
+          a.border,
+          t.atoms.border_contrast_low,
+          t.atoms.bg,
+          t.atoms.shadow_sm,
+        ]}>
+        {({pressed}) => (
+          <View
+            style={[
+              a.flex_row,
+              a.align_center,
+              a.gap_md,
+              {
+                opacity: pressed ? 0.6 : 1,
+              },
+            ]}>
+            <Text style={[a.text_md]}>
+              <Trans>View more</Trans>
+            </Text>
             <View
               style={[
-                a.flex_row,
                 a.align_center,
-                a.gap_md,
+                a.justify_center,
+                a.rounded_full,
                 {
-                  opacity: pressed ? 0.6 : 1,
+                  width: 34,
+                  height: 34,
+                  backgroundColor: t.palette.primary_500,
                 },
               ]}>
-              <Text style={[a.text_md]}>
-                <Trans>View more</Trans>
-              </Text>
-              <View
-                style={[
-                  a.align_center,
-                  a.justify_center,
-                  a.rounded_full,
-                  {
-                    width: 34,
-                    height: 34,
-                    backgroundColor: t.palette.primary_500,
-                  },
-                ]}>
-                <ButtonIcon icon={ChevronRight} />
-              </View>
+              <ButtonIcon icon={ChevronRight} />
             </View>
-          )}
-        </Link>
-      </View>
-    </>
+          </View>
+        )}
+      </Link>
+    </View>
   )
 }
-- 
cgit 1.4.1


From 8ab49da6da0f6e253aa782808afa0a8940ccee54 Mon Sep 17 00:00:00 2001
From: Caidan Williams <caidan@internet.dev>
Date: Thu, 21 Aug 2025 13:23:53 -0700
Subject: refactor: replace View with Button in ViewMoreCard for consistent
 colors across themes

Updated ViewMoreCard to use a Button component instead of a styled View
for the 'View more' action. This improves accessibility and consistency
with other interactive elements in TrendingVideos.
---
 src/components/interstitials/TrendingVideos.tsx | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

(limited to 'src/components/interstitials/TrendingVideos.tsx')

diff --git a/src/components/interstitials/TrendingVideos.tsx b/src/components/interstitials/TrendingVideos.tsx
index 4275f7fc8..6be64335a 100644
--- a/src/components/interstitials/TrendingVideos.tsx
+++ b/src/components/interstitials/TrendingVideos.tsx
@@ -219,19 +219,13 @@ function ViewMoreCard() {
             <Text style={[a.text_md]}>
               <Trans>View more</Trans>
             </Text>
-            <View
-              style={[
-                a.align_center,
-                a.justify_center,
-                a.rounded_full,
-                {
-                  width: 34,
-                  height: 34,
-                  backgroundColor: t.palette.primary_500,
-                },
-              ]}>
+            <Button
+              color="primary"
+              size="small"
+              shape="round"
+              label={_(msg`View more trending videos`)}>
               <ButtonIcon icon={ChevronRight} />
-            </View>
+            </Button>
           </View>
         )}
       </Link>
-- 
cgit 1.4.1

