Skip to content

Commit

Permalink
Don't hide recommended
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Dec 18, 2024
1 parent 2d1a5e7 commit 6eac66c
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions src/screens/Search/components/ExploreRecommendations.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
import React from 'react'
import {View} from 'react-native'
import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {Trans} from '@lingui/macro'

import {logEvent} from '#/lib/statsig/statsig'
import {isWeb} from '#/platform/detection'
import {
useTrendingSettings,
useTrendingSettingsApi,
} from '#/state/preferences/trending'
import {
DEFAULT_LIMIT as RECOMMENDATIONS_COUNT,
useTrendingTopics,
} from '#/state/queries/trending/useTrendingTopics'
import {useTrendingConfig} from '#/state/trending-config'
import {atoms as a, useGutters, useTheme} from '#/alf'
import {Hashtag_Stroke2_Corner0_Rounded} from '#/components/icons/Hashtag'
import * as Prompt from '#/components/Prompt'
import {
TrendingTopic,
TrendingTopicLink,
Expand All @@ -26,23 +18,14 @@ import {Text} from '#/components/Typography'

export function ExploreRecommendations() {
const {enabled} = useTrendingConfig()
const {trendingDisabled} = useTrendingSettings()
return enabled && !trendingDisabled ? <Inner /> : null
return enabled ? <Inner /> : null
}

function Inner() {
const t = useTheme()
const {_} = useLingui()
const gutters = useGutters([0, 'compact'])
const {data: trending, error, isLoading} = useTrendingTopics()
const noRecs = !isLoading && !error && !trending?.suggested?.length
const {setTrendingDisabled} = useTrendingSettingsApi()
const trendingPrompt = Prompt.usePromptControl()

const onConfirmHide = React.useCallback(() => {
logEvent('trendingTopics:hide', {context: 'explore:recommendations'})
setTrendingDisabled(true)
}, [setTrendingDisabled])

return error || noRecs ? null : (
<>
Expand Down Expand Up @@ -106,14 +89,6 @@ function Inner() {
)}
</View>
</View>

<Prompt.Basic
control={trendingPrompt}
title={_(msg`Hide trending topics?`)}
description={_(msg`You can update this later from your settings.`)}
confirmButtonCta={_(msg`Hide`)}
onConfirm={onConfirmHide}
/>
</>
)
}

0 comments on commit 6eac66c

Please sign in to comment.