Search in PWI (#3628)

This commit is contained in:
dan
2024-04-20 00:29:35 +01:00
committed by GitHub
parent d3c0b48da3
commit ce1c1e1cbe
+4 -44
View File
@@ -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,7 +413,6 @@ export function SearchScreenInner({
const sections = React.useMemo(() => {
if (!query) return []
if (hasSession) {
return [
{
title: _(msg`Top`),
@@ -448,19 +441,8 @@ export function SearchScreenInner({
),
},
]
} else {
return [
{
title: _(msg`People`),
component: (
<SearchScreenUserResults query={query} active={activeTab === 0} />
),
},
]
}
}, [hasSession, _, query, activeTab])
}, [_, query, activeTab])
if (hasSession) {
return query ? (
<Pager
onPageSelected={onPageSelected}
@@ -476,7 +458,7 @@ export function SearchScreenInner({
<View key={i}>{section.component}</View>
))}
</Pager>
) : (
) : hasSession ? (
<View>
<CenteredView sideBorders style={pal.border}>
<Text
@@ -497,24 +479,6 @@ export function SearchScreenInner({
<SearchScreenSuggestedFollows />
</View>
)
}
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>
) : (
<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>