From 7848f2046623300377d675666a70426a06220e24 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 3 Jun 2022 13:46:00 +0530 Subject: [PATCH] remove collections props from collection bar --- src/components/Collections/CollectionBar/index.tsx | 13 ++++++------- src/components/Collections/index.tsx | 1 - 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/Collections/CollectionBar/index.tsx b/src/components/Collections/CollectionBar/index.tsx index 3dcaefe0e..4598cbfdc 100644 --- a/src/components/Collections/CollectionBar/index.tsx +++ b/src/components/Collections/CollectionBar/index.tsx @@ -1,6 +1,6 @@ import ScrollButton from 'components/Collections/CollectionBar/ScrollButton'; import React, { useEffect, useMemo } from 'react'; -import { Collection, CollectionSummaries } from 'types/collection'; +import { CollectionSummaries } from 'types/collection'; import constants from 'utils/strings/constants'; import { ALL_SECTION, COLLECTION_SORT_BY } from 'constants/collection'; import { Typography } from '@mui/material'; @@ -18,7 +18,6 @@ import { SpaceBetweenFlex } from 'components/Container'; import { sortCollectionSummaries } from 'services/collectionService'; interface IProps { - collections: Collection[]; activeCollection?: number; setActiveCollection: (id?: number) => void; isInSearchMode: boolean; @@ -29,7 +28,7 @@ interface IProps { export default function CollectionBar(props: IProps) { const { activeCollection, - collections, + setActiveCollection, collectionSummaries, showAllCollections, @@ -53,12 +52,12 @@ export default function CollectionBar(props: IProps) { onFarLeft, onFarRight, } = useComponentScroll({ - dependencies: [windowSize, collections], + dependencies: [windowSize, collectionSummaries], }); - const collectionChipsRef = props.collections.reduce( - (refMap, collection) => { - refMap[collection.id] = React.createRef(); + const collectionChipsRef = sortedCollectionSummary.reduce( + (refMap, collectionSummary) => { + refMap[collectionSummary.attributes.id] = React.createRef(); return refMap; }, {} diff --git a/src/components/Collections/index.tsx b/src/components/Collections/index.tsx index 6bc57df73..ba181c81a 100644 --- a/src/components/Collections/index.tsx +++ b/src/components/Collections/index.tsx @@ -45,7 +45,6 @@ export default function Collections(props: Iprops) { return ( <>