about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-11-14 13:52:23 -0600
committerPaul Frazee <pfrazee@gmail.com>2022-11-14 13:52:23 -0600
commit2271112317ef93085fa9a35fc3dd6b7f5e306819 (patch)
tree439036de079087aba4849ceb822f0cea613f0431 /src
parent75f801ed71500ff5982904067eac915fbbea5467 (diff)
downloadvoidsky-2271112317ef93085fa9a35fc3dd6b7f5e306819.tar.zst
Add link behaviors to search screen suggestions
Diffstat (limited to 'src')
-rw-r--r--src/view/com/discover/SuggestedFollows.tsx41
-rw-r--r--src/view/screens/Search.tsx2
2 files changed, 33 insertions, 10 deletions
diff --git a/src/view/com/discover/SuggestedFollows.tsx b/src/view/com/discover/SuggestedFollows.tsx
index 1b3810171..802315213 100644
--- a/src/view/com/discover/SuggestedFollows.tsx
+++ b/src/view/com/discover/SuggestedFollows.tsx
@@ -12,6 +12,7 @@ import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
 import {observer} from 'mobx-react-lite'
 import _omit from 'lodash.omit'
 import {ErrorScreen} from '../util/ErrorScreen'
+import {Link} from '../util/Link'
 import {UserAvatar} from '../util/UserAvatar'
 import Toast from '../util/Toast'
 import {useStores} from '../../../state'
@@ -23,7 +24,13 @@ import {
 import {s, colors, gradients} from '../../lib/styles'
 
 export const SuggestedFollows = observer(
-  ({onNoSuggestions}: {onNoSuggestions?: () => void}) => {
+  ({
+    onNoSuggestions,
+    asLinks,
+  }: {
+    onNoSuggestions?: () => void
+    asLinks?: boolean
+  }) => {
     const store = useStores()
     const [follows, setFollows] = useState<Record<string, string>>({})
 
@@ -75,14 +82,30 @@ export const SuggestedFollows = observer(
       }
     }
 
-    const renderItem = ({item}: {item: SuggestedActor}) => (
-      <User
-        item={item}
-        follow={follows[item.did]}
-        onPressFollow={onPressFollow}
-        onPressUnfollow={onPressUnfollow}
-      />
-    )
+    const renderItem = ({item}: {item: SuggestedActor}) => {
+      if (asLinks) {
+        return (
+          <Link
+            href={`/profile/${item.handle}`}
+            title={item.displayName || item.handle}>
+            <User
+              item={item}
+              follow={follows[item.did]}
+              onPressFollow={onPressFollow}
+              onPressUnfollow={onPressUnfollow}
+            />
+          </Link>
+        )
+      }
+      return (
+        <User
+          item={item}
+          follow={follows[item.did]}
+          onPressFollow={onPressFollow}
+          onPressUnfollow={onPressUnfollow}
+        />
+      )
+    }
     return (
       <View style={styles.container}>
         {view.isLoading ? (
diff --git a/src/view/screens/Search.tsx b/src/view/screens/Search.tsx
index 735326025..b1c78f681 100644
--- a/src/view/screens/Search.tsx
+++ b/src/view/screens/Search.tsx
@@ -25,7 +25,7 @@ export const Search = ({visible, params}: ScreenParams) => {
         </Text>
       </View>
       <Text style={styles.heading}>Suggested follows</Text>
-      <SuggestedFollows />
+      <SuggestedFollows asLinks />
     </View>
   )
 }