diff --git a/src/components/pages/gallery/Collections.tsx b/src/components/pages/gallery/Collections.tsx index 5b99da833..a1f7edf19 100644 --- a/src/components/pages/gallery/Collections.tsx +++ b/src/components/pages/gallery/Collections.tsx @@ -16,6 +16,8 @@ import CollectionOptions from './CollectionOptions'; import OptionIcon, { OptionIconWrapper } from './OptionIcon'; export const ARCHIVE_COLLECTION = -1; +export const ALL_SECTION = 0; + interface CollectionProps { collections: Collection[]; selected?: number; @@ -101,9 +103,9 @@ export default function Collections(props: CollectionProps) { collectionRef.current.scrollLeft = 0; }, [collections]); - const clickHandler = (collection?: Collection) => () => { - setSelectedCollectionID(collection?.id); - setActiveCollection(collection?.id); + const clickHandler = (collectionID?: number) => () => { + setSelectedCollectionID(collectionID); + setActiveCollection(collectionID ?? ALL_SECTION); }; const user: User = getData(LS_KEYS.USER); @@ -120,7 +122,7 @@ export default function Collections(props: CollectionProps) { setDialogMessage: props.setDialogMessage, startLoadingBar: props.startLoadingBar, showCollectionShareModal: setCollectionShareModalView.bind(null, true), - redirectToAll: setActiveCollection.bind(null, 0), + redirectToAll: setActiveCollection.bind(null, ALL_SECTION), }); const scrollCollection = (direction: SCROLL_DIRECTION) => () => { @@ -172,7 +174,9 @@ export default function Collections(props: CollectionProps) { /> )} - + All
+ onClick={clickHandler(item.id)}> {item.name} {item.type !== CollectionType.favorites && item.owner.id === user?.id ? (