From 1f3e8e94660a2b710b83016b27272f2292a44929 Mon Sep 17 00:00:00 2001 From: ARREY-ETTA BESSONG EKEP OBASI Date: Thu, 4 Jan 2024 15:25:37 +0100 Subject: [PATCH 01/37] fix: hid play button for 0 or 1 TLDR results --- src/components/App/SideBar/Trending/index.tsx | 5 ++- src/utils/index.ts | 2 + src/utils/trending/__tests__/index.ts | 39 +++++++++++++++++++ src/utils/trending/index.ts | 4 ++ 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 src/utils/trending/__tests__/index.ts create mode 100644 src/utils/trending/index.ts diff --git a/src/components/App/SideBar/Trending/index.tsx b/src/components/App/SideBar/Trending/index.tsx index 69484fe99..ba5b30341 100644 --- a/src/components/App/SideBar/Trending/index.tsx +++ b/src/components/App/SideBar/Trending/index.tsx @@ -14,6 +14,7 @@ import { useModal } from '~/stores/useModalStore' import { Trending as TrendingType } from '~/types' import { colors } from '~/utils/colors' import { BriefDescription } from './BriefDescriptionModal' +import { showPlayButton } from '~/utils' const TRENDING_TOPICS = ['Drivechain', 'Ordinals', 'L402', 'Nostr', 'AI'] @@ -115,6 +116,8 @@ export const Trending = ({ onSubmit }: Props) => { }) } + const hideButton = showPlayButton(trendingTopics) + return (
@@ -125,7 +128,7 @@ export const Trending = ({ onSubmit }: Props) => { {loading ? : }
- {trendingTopics.some((topic) => topic.audio_EN) ? ( + {hideButton ? (