Ungate Top/Latest search (#3627)

zio/stable
dan 2024-04-19 21:58:18 +01:00 committed by GitHub
parent c42a557417
commit ade2ea6172
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 38 additions and 68 deletions

View File

@ -5,7 +5,6 @@ export type Gate =
| 'disable_poll_on_discover_v2' | 'disable_poll_on_discover_v2'
| 'hide_vertical_scroll_indicators' | 'hide_vertical_scroll_indicators'
| 'new_profile_scroll_component' | 'new_profile_scroll_component'
| 'new_search'
| 'receive_updates' | 'receive_updates'
| 'show_follow_back_label_v2' | 'show_follow_back_label_v2'
| 'start_session_with_following_v2' | 'start_session_with_following_v2'

View File

@ -407,7 +407,6 @@ export function SearchScreenInner({
const {isDesktop} = useWebMediaQueries() const {isDesktop} = useWebMediaQueries()
const [activeTab, setActiveTab] = React.useState(0) const [activeTab, setActiveTab] = React.useState(0)
const {_} = useLingui() const {_} = useLingui()
const gate = useGate()
const onPageSelected = React.useCallback( const onPageSelected = React.useCallback(
(index: number) => { (index: number) => {
@ -420,74 +419,46 @@ export function SearchScreenInner({
const sections = React.useMemo(() => { const sections = React.useMemo(() => {
if (!query) return [] if (!query) return []
if (gate('new_search')) { if (hasSession) {
if (hasSession) { return [
return [ {
{ title: _(msg`Top`),
title: _(msg`Top`), component: (
component: ( <SearchScreenPostResults
<SearchScreenPostResults query={query}
query={query} sort="top"
sort="top" active={activeTab === 0}
active={activeTab === 0} />
/> ),
), },
}, {
{ title: _(msg`Latest`),
title: _(msg`Latest`), component: (
component: ( <SearchScreenPostResults
<SearchScreenPostResults query={query}
query={query} sort="latest"
sort="latest" active={activeTab === 1}
active={activeTab === 1} />
/> ),
), },
}, {
{ title: _(msg`People`),
title: _(msg`People`), component: (
component: ( <SearchScreenUserResults query={query} active={activeTab === 2} />
<SearchScreenUserResults query={query} active={activeTab === 2} /> ),
), },
}, ]
]
} else {
return [
{
title: _(msg`People`),
component: (
<SearchScreenUserResults query={query} active={activeTab === 0} />
),
},
]
}
} else { } else {
if (hasSession) { return [
return [ {
{ title: _(msg`People`),
title: _(msg`Posts`), component: (
component: ( <SearchScreenUserResults query={query} active={activeTab === 0} />
<SearchScreenPostResults query={query} active={activeTab === 0} /> ),
), },
}, ]
{
title: _(msg`Users`),
component: (
<SearchScreenUserResults query={query} active={activeTab === 1} />
),
},
]
} else {
return [
{
title: _(msg`Users`),
component: (
<SearchScreenUserResults query={query} active={activeTab === 0} />
),
},
]
}
} }
}, [hasSession, gate, _, query, activeTab]) }, [hasSession, _, query, activeTab])
if (hasSession) { if (hasSession) {
return query ? ( return query ? (