From 560c93ff8e5d372c17a9adab1ae984687327d210 Mon Sep 17 00:00:00 2001 From: Karlen9 Date: Wed, 18 Sep 2024 17:39:57 +0300 Subject: [PATCH] feat: shuffle all apps --- apps/common/components/CategorySection.tsx | 6 +----- pages/home/[category].tsx | 7 ++----- pages/home/index.tsx | 1 - 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/apps/common/components/CategorySection.tsx b/apps/common/components/CategorySection.tsx index 21c754abf..363185b8c 100644 --- a/apps/common/components/CategorySection.tsx +++ b/apps/common/components/CategorySection.tsx @@ -10,10 +10,9 @@ type TAppSectionProps = { title: string; onExpandClick: () => void; apps: TApp[]; - shouldRandomize?: boolean; }; -export function CategorySection({title, onExpandClick, apps, shouldRandomize = false}: TAppSectionProps): ReactElement { +export function CategorySection({title, onExpandClick, apps}: TAppSectionProps): ReactElement { const [shuffledApps, set_shuffledApps] = useState([]); /********************************************************************************************** @@ -23,9 +22,6 @@ export function CategorySection({title, onExpandClick, apps, shouldRandomize = f if (apps.length < 1) { return; } - if (!shouldRandomize) { - return set_shuffledApps(apps); - } set_shuffledApps(apps.toSorted(() => 0.5 - Math.random())); }); return ( diff --git a/pages/home/[category].tsx b/pages/home/[category].tsx index d2ce57b7f..c8fbc8542 100644 --- a/pages/home/[category].tsx +++ b/pages/home/[category].tsx @@ -16,16 +16,13 @@ export default function Index(props: {router: NextRouter}): ReactElement { }, [props.router.asPath]); /********************************************************************************************** - ** On component mount we shuffle the array of Integration Apps to avoid any bias. + ** On component mount we shuffle the array of Apps to avoid any bias. **********************************************************************************************/ useMountEffect(() => { if (currentCatrgory.apps.length < 1) { return; } - if (currentCatrgory.categoryName === 'Integrations') { - set_shuffledApps(currentCatrgory.apps.toSorted(() => 0.5 - Math.random())); - } - set_shuffledApps(currentCatrgory.apps); + set_shuffledApps(currentCatrgory.apps.toSorted(() => 0.5 - Math.random())); }); return ( diff --git a/pages/home/index.tsx b/pages/home/index.tsx index 16ebbdf24..7f5387b21 100644 --- a/pages/home/index.tsx +++ b/pages/home/index.tsx @@ -99,7 +99,6 @@ export default function Home(): ReactElement { /> router.push('/home/integrations')} apps={INTEGRATIONS_APPS}