diff --git a/client/modules/IDE/components/CollectionPopover/CollectionPopover.jsx b/client/modules/IDE/components/CollectionPopover/CollectionPopover.jsx index 2b3ffe76..2129d153 100644 --- a/client/modules/IDE/components/CollectionPopover/CollectionPopover.jsx +++ b/client/modules/IDE/components/CollectionPopover/CollectionPopover.jsx @@ -7,8 +7,6 @@ import { bindActionCreators } from 'redux'; import * as CollectionsActions from '../../actions/collections'; import getSortedCollections from '../../selectors/collections'; -// import { Link } from 'react-router'; - import exitUrl from '../../../../images/exit.svg'; import { Searchbar } from '../Searchbar'; @@ -34,9 +32,13 @@ const NoCollections = () => (
*/} ); +const projectInCollection = (project, collection) => ( + collection.items.find(item => item.project.id === project.id) != null +); + const CollectionPopover = ({ - onClose, project, collections, addToCollection, getCollections, user + onClose, project, collections, addToCollection, removeFromCollection, getCollections, user }) => { const [searchTerm, setSearchTerm] = React.useState(''); const filteredCollections = searchTerm === '' ? @@ -51,6 +53,10 @@ const CollectionPopover = ({ addToCollection(collectionId, project.id); }; + const handleRemoveFromCollection = (collectionId) => { + removeFromCollection(collectionId, project.id); + }; + return (