about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-04-20 00:29:35 +0100
committerGitHub <noreply@github.com>2024-04-20 00:29:35 +0100
commitce1c1e1cbed05183b42dd44e620fe1d4065bce1e (patch)
tree93f0b091b5d6ed5ea7a088ca53bc9b9cb8d3fd35 /src
parentd3c0b48da3053727dd4e02acc353f6372121d944 (diff)
downloadvoidsky-ce1c1e1cbed05183b42dd44e620fe1d4065bce1e.tar.zst
Search in PWI (#3628)
Diffstat (limited to 'src')
-rw-r--r--src/view/screens/Search/Search.tsx144
1 files changed, 52 insertions, 92 deletions
diff --git a/src/view/screens/Search/Search.tsx b/src/view/screens/Search/Search.tsx
index 36e780c77..099174b9b 100644
--- a/src/view/screens/Search/Search.tsx
+++ b/src/view/screens/Search/Search.tsx
@@ -393,13 +393,7 @@ function SearchScreenUserResults({
   )
 }
 
-export function SearchScreenInner({
-  query,
-  primarySearch,
-}: {
-  query?: string
-  primarySearch?: boolean
-}) {
+export function SearchScreenInner({query}: {query?: string}) {
   const pal = usePalette('default')
   const setMinimalShellMode = useSetMinimalShellMode()
   const setDrawerSwipeDisabled = useSetDrawerSwipeDisabled()
@@ -419,86 +413,35 @@ export function SearchScreenInner({
 
   const sections = React.useMemo(() => {
     if (!query) return []
-    if (hasSession) {
-      return [
-        {
-          title: _(msg`Top`),
-          component: (
-            <SearchScreenPostResults
-              query={query}
-              sort="top"
-              active={activeTab === 0}
-            />
-          ),
-        },
-        {
-          title: _(msg`Latest`),
-          component: (
-            <SearchScreenPostResults
-              query={query}
-              sort="latest"
-              active={activeTab === 1}
-            />
-          ),
-        },
-        {
-          title: _(msg`People`),
-          component: (
-            <SearchScreenUserResults query={query} active={activeTab === 2} />
-          ),
-        },
-      ]
-    } else {
-      return [
-        {
-          title: _(msg`People`),
-          component: (
-            <SearchScreenUserResults query={query} active={activeTab === 0} />
-          ),
-        },
-      ]
-    }
-  }, [hasSession, _, query, activeTab])
-
-  if (hasSession) {
-    return query ? (
-      <Pager
-        onPageSelected={onPageSelected}
-        renderTabBar={props => (
-          <CenteredView
-            sideBorders
-            style={[pal.border, pal.view, styles.tabBarContainer]}>
-            <TabBar items={sections.map(section => section.title)} {...props} />
-          </CenteredView>
-        )}
-        initialPage={0}>
-        {sections.map((section, i) => (
-          <View key={i}>{section.component}</View>
-        ))}
-      </Pager>
-    ) : (
-      <View>
-        <CenteredView sideBorders style={pal.border}>
-          <Text
-            type="title"
-            style={[
-              pal.text,
-              pal.border,
-              {
-                display: 'flex',
-                paddingVertical: 12,
-                paddingHorizontal: 18,
-                fontWeight: 'bold',
-              },
-            ]}>
-            <Trans>Suggested Follows</Trans>
-          </Text>
-        </CenteredView>
-
-        <SearchScreenSuggestedFollows />
-      </View>
-    )
-  }
+    return [
+      {
+        title: _(msg`Top`),
+        component: (
+          <SearchScreenPostResults
+            query={query}
+            sort="top"
+            active={activeTab === 0}
+          />
+        ),
+      },
+      {
+        title: _(msg`Latest`),
+        component: (
+          <SearchScreenPostResults
+            query={query}
+            sort="latest"
+            active={activeTab === 1}
+          />
+        ),
+      },
+      {
+        title: _(msg`People`),
+        component: (
+          <SearchScreenUserResults query={query} active={activeTab === 2} />
+        ),
+      },
+    ]
+  }, [_, query, activeTab])
 
   return query ? (
     <Pager
@@ -515,6 +458,27 @@ export function SearchScreenInner({
         <View key={i}>{section.component}</View>
       ))}
     </Pager>
+  ) : hasSession ? (
+    <View>
+      <CenteredView sideBorders style={pal.border}>
+        <Text
+          type="title"
+          style={[
+            pal.text,
+            pal.border,
+            {
+              display: 'flex',
+              paddingVertical: 12,
+              paddingHorizontal: 18,
+              fontWeight: 'bold',
+            },
+          ]}>
+          <Trans>Suggested Follows</Trans>
+        </Text>
+      </CenteredView>
+
+      <SearchScreenSuggestedFollows />
+    </View>
   ) : (
     <CenteredView sideBorders style={pal.border}>
       <View
@@ -554,11 +518,7 @@ export function SearchScreenInner({
             style={pal.textLight}
           />
           <Text type="xl" style={[pal.textLight, {paddingHorizontal: 18}]}>
-            {isDesktop && !primarySearch ? (
-              <Trans>Find users with the search tool on the right</Trans>
-            ) : (
-              <Trans>Find users on Bluesky</Trans>
-            )}
+            <Trans>Find posts and users on Bluesky</Trans>
           </Text>
         </View>
       </View>