fix regression trash shown on collection bar

This commit is contained in:
Abhinav 2022-07-05 00:42:56 +05:30
parent 409d83fafa
commit b3ba9ff56d
3 changed files with 19 additions and 13 deletions

View file

@ -13,7 +13,7 @@ import { AppContext } from 'pages/_app';
interface Iprops {
open: boolean;
onClose: () => void;
sortedCollectionSummaries: CollectionSummary[];
collectionSummaries: CollectionSummary[];
setActiveCollection: (id?: number) => void;
collectionSortBy: COLLECTION_SORT_BY;
setCollectionSortBy: (v: COLLECTION_SORT_BY) => void;
@ -23,7 +23,7 @@ const LeftSlideTransition = Transition('up');
export default function AllCollections(props: Iprops) {
const {
sortedCollectionSummaries,
collectionSummaries,
open,
onClose,
setActiveCollection,
@ -46,13 +46,13 @@ export default function AllCollections(props: Iprops) {
fullScreen={isMobile}>
<AllCollectionsHeader
onClose={onClose}
collectionCount={props.sortedCollectionSummaries.length}
collectionCount={props.collectionSummaries.length}
collectionSortBy={collectionSortBy}
setCollectionSortBy={setCollectionSortBy}
/>
<Divider />
<AllCollectionContent
collectionSummaries={sortedCollectionSummaries}
collectionSummaries={collectionSummaries}
onCollectionClick={onCollectionClick}
/>
</AllCollectionDialog>

View file

@ -20,7 +20,7 @@ import CollectionSort from '../AllCollections/CollectionSort';
interface IProps {
activeCollection?: number;
setActiveCollection: (id?: number) => void;
sortedCollectionSummaries: CollectionSummary[];
collectionSummaries: CollectionSummary[];
showAllCollections: () => void;
collectionSortBy: COLLECTION_SORT_BY;
setCollectionSortBy: (v: COLLECTION_SORT_BY) => void;
@ -30,7 +30,7 @@ export default function CollectionListBar(props: IProps) {
const {
activeCollection,
setActiveCollection,
sortedCollectionSummaries,
collectionSummaries,
showAllCollections,
} = props;
@ -40,10 +40,10 @@ export default function CollectionListBar(props: IProps) {
const { componentRef, scrollComponent, onFarLeft, onFarRight } =
useComponentScroll({
dependencies: [windowSize, sortedCollectionSummaries],
dependencies: [windowSize, collectionSummaries],
});
const collectionChipsRef = sortedCollectionSummaries.reduce(
const collectionChipsRef = collectionSummaries.reduce(
(refMap, collectionSummary) => {
refMap[collectionSummary.id] = React.createRef();
return refMap;
@ -85,7 +85,7 @@ export default function CollectionListBar(props: IProps) {
/>
)}
<ScrollContainer ref={componentRef}>
{sortedCollectionSummaries.map((item) => (
{collectionSummaries.map((item) => (
<CollectionListBarCard
key={item.id}
latestFile={item.latestFile}

View file

@ -7,7 +7,11 @@ import { ALL_SECTION, COLLECTION_SORT_BY } from 'constants/collection';
import CollectionShare from 'components/Collections/CollectionShare';
import { SetCollectionNamerAttributes } from 'components/Collections/CollectionNamer';
import { ITEM_TYPE, TimeStampListItem } from 'components/PhotoList';
import { hasNonEmptyCollections, isSystemCollection } from 'utils/collection';
import {
hasNonEmptyCollections,
isSystemCollection,
shouldBeShownOnCollectionBar,
} from 'utils/collection';
import { useLocalState } from 'hooks/useLocalState';
import { sortCollectionSummaries } from 'services/collectionService';
import { LS_KEYS } from 'utils/storage/localStorage';
@ -107,7 +111,9 @@ export default function Collections(props: Iprops) {
<CollectionListBar
activeCollection={activeCollectionID}
setActiveCollection={setActiveCollectionID}
sortedCollectionSummaries={sortedCollectionSummaries}
collectionSummaries={sortedCollectionSummaries.filter((x) =>
shouldBeShownOnCollectionBar(x.type)
)}
showAllCollections={openAllCollections}
setCollectionSortBy={setCollectionSortBy}
collectionSortBy={collectionSortBy}
@ -116,8 +122,8 @@ export default function Collections(props: Iprops) {
<AllCollections
open={allCollectionView}
onClose={closeAllCollections}
sortedCollectionSummaries={sortedCollectionSummaries.filter(
(x) => !isSystemCollection(x.type)
collectionSummaries={sortedCollectionSummaries.filter((x) =>
isSystemCollection(x.type)
)}
setActiveCollection={setActiveCollectionID}
setCollectionSortBy={setCollectionSortBy}