diff --git a/client/modules/IDE/components/CollectionList/CollectionListRow.jsx b/client/modules/IDE/components/CollectionList/CollectionListRow.jsx index 07aaf74d..cf646d54 100644 --- a/client/modules/IDE/components/CollectionList/CollectionListRow.jsx +++ b/client/modules/IDE/components/CollectionList/CollectionListRow.jsx @@ -9,9 +9,13 @@ import * as ProjectActions from '../../actions/project'; import * as CollectionsActions from '../../actions/collections'; import * as IdeActions from '../../actions/ide'; import * as ToastActions from '../../actions/toast'; -import AddRemoveButton from '../../../../components/AddRemoveButton'; const downFilledTriangle = require('../../../../images/down-filled-triangle.svg'); +const check = require('../../../../images/check.svg'); + +const checkIcon = ( + +); class CollectionListRowBase extends React.Component { static projectInCollection(project, collection) { @@ -139,16 +143,30 @@ class CollectionListRowBase extends React.Component { this.props.removeFromCollection(this.props.collection.id, this.props.project.id); } + handleAddRemove = (evt) => { + // Clicking on View action should not perform add/remove + const didOriginateInLink = evt.target.nodeName === 'A'; + + if (didOriginateInLink) { + return; + } + + if (CollectionListRowBase.projectInCollection(this.props.project, this.props.collection)) { + this.handleCollectionRemove(); + } else { + this.handleCollectionAdd(); + } + } + renderActions = () => { const { optionsOpen } = this.state; const userIsOwner = this.props.user.username === this.props.username; if (this.props.addMode === true && this.props.project) { - return CollectionListRowBase.projectInCollection(this.props.project, this.props.collection) ? - : - ; + return View; } + return (