Add feature gate for starter pack search (#11234)
This commit is contained in:
@@ -19,6 +19,7 @@ export enum Features {
|
|||||||
PostThreadKnownLikersEnable = 'post_thread:known_likers:enable',
|
PostThreadKnownLikersEnable = 'post_thread:known_likers:enable',
|
||||||
PostThreadKnownLikersFetchEnable = 'post_thread:known_likers:fetch:enable',
|
PostThreadKnownLikersFetchEnable = 'post_thread:known_likers:fetch:enable',
|
||||||
CustomLogoJapanEnable = 'custom_logo:japan:enable',
|
CustomLogoJapanEnable = 'custom_logo:japan:enable',
|
||||||
|
SearchStarterPacksV2Enable = 'search_starter_packs_v2:enable',
|
||||||
|
|
||||||
AATest = 'aa-test',
|
AATest = 'aa-test',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ let SearchResults = ({
|
|||||||
onPageSelected: (page: number) => void
|
onPageSelected: (page: number) => void
|
||||||
headerHeight: number
|
headerHeight: number
|
||||||
}): React.ReactNode => {
|
}): React.ReactNode => {
|
||||||
|
const ax = useAnalytics()
|
||||||
const {t: l} = useLingui()
|
const {t: l} = useLingui()
|
||||||
/*
|
/*
|
||||||
* People/Feeds visibility keys off post-only filters: a `lang` filter applies
|
* People/Feeds visibility keys off post-only filters: a `lang` filter applies
|
||||||
@@ -64,6 +65,10 @@ let SearchResults = ({
|
|||||||
const activePage = hasPostFilters && activeTab > 1 ? 0 : activeTab
|
const activePage = hasPostFilters && activeTab > 1 ? 0 : activeTab
|
||||||
const tabShape = hasPostFilters ? 'filtered' : 'plain'
|
const tabShape = hasPostFilters ? 'filtered' : 'plain'
|
||||||
|
|
||||||
|
const isStarterPacksEnabled = ax.features.enabled(
|
||||||
|
ax.features.SearchStarterPacksV2Enable,
|
||||||
|
)
|
||||||
|
|
||||||
const sections = useMemo(() => {
|
const sections = useMemo(() => {
|
||||||
if (!query && !hasFilters) return []
|
if (!query && !hasFilters) return []
|
||||||
/*
|
/*
|
||||||
@@ -108,20 +113,29 @@ let SearchResults = ({
|
|||||||
<SearchScreenFeedsResults query={query} active={activePage === 3} />
|
<SearchScreenFeedsResults query={query} active={activePage === 3} />
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
noFilters && {
|
noFilters &&
|
||||||
title: l`Starter packs`,
|
isStarterPacksEnabled && {
|
||||||
component: (
|
title: l`Starter packs`,
|
||||||
<SearchScreenStarterPackResults
|
component: (
|
||||||
query={query}
|
<SearchScreenStarterPackResults
|
||||||
active={activePage === 4}
|
query={query}
|
||||||
/>
|
active={activePage === 4}
|
||||||
),
|
/>
|
||||||
},
|
),
|
||||||
|
},
|
||||||
].filter(Boolean) as {
|
].filter(Boolean) as {
|
||||||
title: string
|
title: string
|
||||||
component: React.ReactNode
|
component: React.ReactNode
|
||||||
}[]
|
}[]
|
||||||
}, [l, query, filters, hasFilters, hasPostFilters, activePage])
|
}, [
|
||||||
|
l,
|
||||||
|
query,
|
||||||
|
filters,
|
||||||
|
hasFilters,
|
||||||
|
hasPostFilters,
|
||||||
|
activePage,
|
||||||
|
isStarterPacksEnabled,
|
||||||
|
])
|
||||||
|
|
||||||
// There may be fewer tabs after changing the search options.
|
// There may be fewer tabs after changing the search options.
|
||||||
const selectedPage = activePage > sections.length - 1 ? 0 : activePage
|
const selectedPage = activePage > sections.length - 1 ? 0 : activePage
|
||||||
|
|||||||
Reference in New Issue
Block a user