@@ -2,18 +2,15 @@ import PropTypes from 'prop-types';
22import React from 'react' ;
33import { Link } from 'react-router-dom' ;
44import { useTranslation } from 'react-i18next' ;
5+ import { useDispatch } from 'react-redux' ;
6+ import { removeFromCollection } from '../../IDE/actions/collections' ;
57import dates from '../../../utils/formatDate' ;
68import RemoveIcon from '../../../images/close.svg' ;
79
8- const CollectionItemRow = ( {
9- collection,
10- item,
11- isOwner,
12- removeFromCollection
13- } ) => {
10+ const CollectionItemRow = ( { collection, item, isOwner } ) => {
1411 const { t } = useTranslation ( ) ;
12+ const dispatch = useDispatch ( ) ;
1513 const projectIsDeleted = item . isDeleted ;
16-
1714 const handleSketchRemove = ( ) => {
1815 const name = projectIsDeleted ? 'deleted sketch' : item . project . name ;
1916
@@ -22,7 +19,7 @@ const CollectionItemRow = ({
2219 t ( 'Collection.DeleteFromCollection' , { name_sketch : name } )
2320 )
2421 ) {
25- removeFromCollection ( collection . id , item . projectId ) ;
22+ dispatch ( removeFromCollection ( collection . id , item . projectId ) ) ;
2623 }
2724 } ;
2825
@@ -75,10 +72,9 @@ CollectionItemRow.propTypes = {
7572 user : PropTypes . shape ( {
7673 username : PropTypes . string . isRequired
7774 } )
78- } ) . isRequired
75+ } )
7976 } ) . isRequired ,
80- isOwner : PropTypes . bool . isRequired ,
81- removeFromCollection : PropTypes . func . isRequired
77+ isOwner : PropTypes . bool . isRequired
8278} ;
8379
8480export default CollectionItemRow ;
0 commit comments