@@ -2,18 +2,15 @@ import PropTypes from 'prop-types';
2
2
import React from 'react' ;
3
3
import { Link } from 'react-router-dom' ;
4
4
import { useTranslation } from 'react-i18next' ;
5
+ import { useDispatch } from 'react-redux' ;
6
+ import { removeFromCollection } from '../../IDE/actions/collections' ;
5
7
import dates from '../../../utils/formatDate' ;
6
8
import RemoveIcon from '../../../images/close.svg' ;
7
9
8
- const CollectionItemRow = ( {
9
- collection,
10
- item,
11
- isOwner,
12
- removeFromCollection
13
- } ) => {
10
+ const CollectionItemRow = ( { collection, item, isOwner } ) => {
14
11
const { t } = useTranslation ( ) ;
12
+ const dispatch = useDispatch ( ) ;
15
13
const projectIsDeleted = item . isDeleted ;
16
-
17
14
const handleSketchRemove = ( ) => {
18
15
const name = projectIsDeleted ? 'deleted sketch' : item . project . name ;
19
16
@@ -22,7 +19,7 @@ const CollectionItemRow = ({
22
19
t ( 'Collection.DeleteFromCollection' , { name_sketch : name } )
23
20
)
24
21
) {
25
- removeFromCollection ( collection . id , item . projectId ) ;
22
+ dispatch ( removeFromCollection ( collection . id , item . projectId ) ) ;
26
23
}
27
24
} ;
28
25
@@ -75,10 +72,9 @@ CollectionItemRow.propTypes = {
75
72
user : PropTypes . shape ( {
76
73
username : PropTypes . string . isRequired
77
74
} )
78
- } ) . isRequired
75
+ } )
79
76
} ) . isRequired ,
80
- isOwner : PropTypes . bool . isRequired ,
81
- removeFromCollection : PropTypes . func . isRequired
77
+ isOwner : PropTypes . bool . isRequired
82
78
} ;
83
79
84
80
export default CollectionItemRow ;
0 commit comments