Search in PWI (#3628)

zio/stable
dan 2024-04-20 00:29:35 +01:00 committed by GitHub
parent d3c0b48da3
commit ce1c1e1cbe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 52 additions and 92 deletions

View File

@ -393,13 +393,7 @@ function SearchScreenUserResults({
) )
} }
export function SearchScreenInner({ export function SearchScreenInner({query}: {query?: string}) {
query,
primarySearch,
}: {
query?: string
primarySearch?: boolean
}) {
const pal = usePalette('default') const pal = usePalette('default')
const setMinimalShellMode = useSetMinimalShellMode() const setMinimalShellMode = useSetMinimalShellMode()
const setDrawerSwipeDisabled = useSetDrawerSwipeDisabled() const setDrawerSwipeDisabled = useSetDrawerSwipeDisabled()
@ -419,7 +413,6 @@ export function SearchScreenInner({
const sections = React.useMemo(() => { const sections = React.useMemo(() => {
if (!query) return [] if (!query) return []
if (hasSession) {
return [ return [
{ {
title: _(msg`Top`), title: _(msg`Top`),
@ -448,19 +441,8 @@ export function SearchScreenInner({
), ),
}, },
] ]
} else { }, [_, query, activeTab])
return [
{
title: _(msg`People`),
component: (
<SearchScreenUserResults query={query} active={activeTab === 0} />
),
},
]
}
}, [hasSession, _, query, activeTab])
if (hasSession) {
return query ? ( return query ? (
<Pager <Pager
onPageSelected={onPageSelected} onPageSelected={onPageSelected}
@ -476,7 +458,7 @@ export function SearchScreenInner({
<View key={i}>{section.component}</View> <View key={i}>{section.component}</View>
))} ))}
</Pager> </Pager>
) : ( ) : hasSession ? (
<View> <View>
<CenteredView sideBorders style={pal.border}> <CenteredView sideBorders style={pal.border}>
<Text <Text
@ -497,24 +479,6 @@ export function SearchScreenInner({
<SearchScreenSuggestedFollows /> <SearchScreenSuggestedFollows />
</View> </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}> <CenteredView sideBorders style={pal.border}>
<View <View
@ -554,11 +518,7 @@ export function SearchScreenInner({
style={pal.textLight} style={pal.textLight}
/> />
<Text type="xl" style={[pal.textLight, {paddingHorizontal: 18}]}> <Text type="xl" style={[pal.textLight, {paddingHorizontal: 18}]}>
{isDesktop && !primarySearch ? ( <Trans>Find posts and users on Bluesky</Trans>
<Trans>Find users with the search tool on the right</Trans>
) : (
<Trans>Find users on Bluesky</Trans>
)}
</Text> </Text>
</View> </View>
</View> </View>