about summary refs log tree commit diff
path: root/src/components/FeedInterstitials.tsx
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-09-12 16:34:10 -0500
committerGitHub <noreply@github.com>2024-09-12 22:34:10 +0100
commitd60a8f26c4fd14b7dc8274b7b6b0a70da7fa6859 (patch)
tree3d95d265929a22c1923ca8f1a55810fa20b33481 /src/components/FeedInterstitials.tsx
parent47bea320619b5854a56029c04ea001b9bbb19ccd (diff)
downloadvoidsky-d60a8f26c4fd14b7dc8274b7b6b0a70da7fa6859.tar.zst
Suggested follows by actor (on profiles) updates (#5243)
* If fallback, return nothing

* Compress size a bit

* Hide on own profile

* Match load state

* Remove gcTime

* Filter out followed users

* Feedback
Diffstat (limited to 'src/components/FeedInterstitials.tsx')
-rw-r--r--src/components/FeedInterstitials.tsx64
1 files changed, 34 insertions, 30 deletions
diff --git a/src/components/FeedInterstitials.tsx b/src/components/FeedInterstitials.tsx
index 5031f584e..286ded13e 100644
--- a/src/components/FeedInterstitials.tsx
+++ b/src/components/FeedInterstitials.tsx
@@ -60,16 +60,13 @@ function CardOuter({
 export function SuggestedFollowPlaceholder() {
   const t = useTheme()
   return (
-    <CardOuter style={[a.gap_sm, t.atoms.border_contrast_low]}>
+    <CardOuter style={[a.gap_md, t.atoms.border_contrast_low]}>
       <ProfileCard.Header>
         <ProfileCard.AvatarPlaceholder />
-      </ProfileCard.Header>
-
-      <View style={[a.py_xs]}>
         <ProfileCard.NameAndHandlePlaceholder />
-      </View>
+      </ProfileCard.Header>
 
-      <ProfileCard.DescriptionPlaceholder />
+      <ProfileCard.DescriptionPlaceholder numberOfLines={2} />
     </CardOuter>
   )
 }
@@ -176,9 +173,14 @@ function useExperimentalSuggestedUsersQuery() {
 }
 
 export function SuggestedFollows({feed}: {feed: FeedDescriptor}) {
-  const [feedType, feedUri] = feed.split('|')
+  const {currentAccount} = useSession()
+  const [feedType, feedUriOrDid] = feed.split('|')
   if (feedType === 'author') {
-    return <SuggestedFollowsProfile did={feedUri} />
+    if (currentAccount?.did === feedUriOrDid) {
+      return null
+    } else {
+      return <SuggestedFollowsProfile did={feedUriOrDid} />
+    }
   } else {
     return <SuggestedFollowsHome />
   }
@@ -197,6 +199,7 @@ export function SuggestedFollowsProfile({did}: {did: string}) {
       isSuggestionsLoading={isSuggestionsLoading}
       profiles={data?.suggestions ?? []}
       error={error}
+      viewContext="profile"
     />
   )
 }
@@ -212,6 +215,7 @@ export function SuggestedFollowsHome() {
       isSuggestionsLoading={isSuggestionsLoading}
       profiles={profiles}
       error={error}
+      viewContext="feed"
     />
   )
 }
@@ -220,10 +224,12 @@ export function ProfileGrid({
   isSuggestionsLoading,
   error,
   profiles,
+  viewContext = 'feed',
 }: {
   isSuggestionsLoading: boolean
   profiles: AppBskyActorDefs.ProfileViewDetailed[]
   error: Error | null
+  viewContext: 'profile' | 'feed'
 }) {
   const t = useTheme()
   const {_} = useLingui()
@@ -280,7 +286,7 @@ export function ProfileGrid({
                     shape="round"
                   />
                 </ProfileCard.Header>
-                <ProfileCard.Description profile={profile} />
+                <ProfileCard.Description profile={profile} numberOfLines={2} />
               </ProfileCard.Outer>
             </CardOuter>
           )}
@@ -297,33 +303,31 @@ export function ProfileGrid({
   return (
     <View
       style={[a.border_t, t.atoms.border_contrast_low, t.atoms.bg_contrast_25]}>
-      <View style={[a.pt_2xl, a.px_lg, a.flex_row, a.pb_xs]}>
-        <Text
-          style={[
-            a.flex_1,
-            a.text_lg,
-            a.font_bold,
-            t.atoms.text_contrast_medium,
-          ]}>
-          <Trans>Suggested for you</Trans>
+      <View
+        style={[
+          a.p_lg,
+          a.pb_xs,
+          a.flex_row,
+          a.align_center,
+          a.justify_between,
+        ]}>
+        <Text style={[a.text_sm, a.font_bold, t.atoms.text_contrast_medium]}>
+          {viewContext === 'profile' ? (
+            <Trans>Similar accounts</Trans>
+          ) : (
+            <Trans>Suggested for you</Trans>
+          )}
         </Text>
-        <Person fill={t.atoms.text_contrast_low.color} />
+        <Person fill={t.atoms.text_contrast_low.color} size="sm" />
       </View>
 
       {gtMobile ? (
-        <View style={[a.flex_1, a.px_lg, a.pt_md, a.pb_xl, a.gap_md]}>
-          <View style={[a.flex_1, a.flex_row, a.flex_wrap, a.gap_md]}>
+        <View style={[a.flex_1, a.px_lg, a.pt_sm, a.pb_lg, a.gap_md]}>
+          <View style={[a.flex_1, a.flex_row, a.flex_wrap, a.gap_sm]}>
             {content}
           </View>
 
-          <View
-            style={[
-              a.flex_row,
-              a.justify_end,
-              a.align_center,
-              a.pt_xs,
-              a.gap_md,
-            ]}>
+          <View style={[a.flex_row, a.justify_end, a.align_center, a.gap_md]}>
             <InlineLinkText
               label={_(msg`Browse more suggestions`)}
               to="/search"
@@ -339,7 +343,7 @@ export function ProfileGrid({
           showsHorizontalScrollIndicator={false}
           snapToInterval={MOBILE_CARD_WIDTH + a.gap_md.gap}
           decelerationRate="fast">
-          <View style={[a.px_lg, a.pt_md, a.pb_xl, a.flex_row, a.gap_md]}>
+          <View style={[a.px_lg, a.pt_sm, a.pb_lg, a.flex_row, a.gap_md]}>
             {content}
 
             <Button