Merge branch 'master' into move-files

This commit is contained in:
abhinav-grd 2021-09-22 12:02:58 +05:30
commit 6eb47c1fb9

View file

@ -15,6 +15,8 @@ import { SetCollectionNamerAttributes } from './CollectionNamer';
import CollectionOptions from './CollectionOptions'; import CollectionOptions from './CollectionOptions';
import OptionIcon, { OptionIconWrapper } from './OptionIcon'; import OptionIcon, { OptionIconWrapper } from './OptionIcon';
export const ALL_SECTION = 0;
interface CollectionProps { interface CollectionProps {
collections: Collection[]; collections: Collection[];
selected?: number; selected?: number;
@ -100,9 +102,9 @@ export default function Collections(props: CollectionProps) {
collectionRef.current.scrollLeft = 0; collectionRef.current.scrollLeft = 0;
}, [collections]); }, [collections]);
const clickHandler = (collection?: Collection) => () => { const clickHandler = (collectionID?: number) => () => {
setSelectedCollectionID(collection?.id); setSelectedCollectionID(collectionID);
setActiveCollection(collection?.id); setActiveCollection(collectionID ?? ALL_SECTION);
}; };
const user: User = getData(LS_KEYS.USER); const user: User = getData(LS_KEYS.USER);
@ -119,7 +121,7 @@ export default function Collections(props: CollectionProps) {
setDialogMessage: props.setDialogMessage, setDialogMessage: props.setDialogMessage,
startLoadingBar: props.startLoadingBar, startLoadingBar: props.startLoadingBar,
showCollectionShareModal: setCollectionShareModalView.bind(null, true), showCollectionShareModal: setCollectionShareModalView.bind(null, true),
redirectToAll: setActiveCollection.bind(null, 0), redirectToAll: setActiveCollection.bind(null, ALL_SECTION),
}); });
const scrollCollection = (direction: SCROLL_DIRECTION) => () => { const scrollCollection = (direction: SCROLL_DIRECTION) => () => {
@ -171,7 +173,9 @@ export default function Collections(props: CollectionProps) {
/> />
)} )}
<Wrapper ref={collectionRef} onScroll={updateScrollObj}> <Wrapper ref={collectionRef} onScroll={updateScrollObj}>
<Chip active={!selected} onClick={clickHandler()}> <Chip
active={!selected}
onClick={clickHandler(ALL_SECTION)}>
All All
<div <div
style={{ style={{
@ -188,7 +192,7 @@ export default function Collections(props: CollectionProps) {
overlay={renderTooltip(item.id)}> overlay={renderTooltip(item.id)}>
<Chip <Chip
active={selected === item.id} active={selected === item.id}
onClick={clickHandler(item)}> onClick={clickHandler(item.id)}>
{item.name} {item.name}
{item.type !== CollectionType.favorites && {item.type !== CollectionType.favorites &&
item.owner.id === user?.id ? ( item.owner.id === user?.id ? (