@@ -3,6 +3,7 @@ import React from 'react';
33import { Helmet } from 'react-helmet' ;
44import { connect } from 'react-redux' ;
55import { bindActionCreators } from 'redux' ;
6+ import { withTranslation } from 'react-i18next' ;
67
78import * as ProjectActions from '../actions/project' ;
89import * as ProjectsActions from '../actions/projects' ;
@@ -14,7 +15,7 @@ import Loader from '../../App/components/loader';
1415import QuickAddList from './QuickAddList' ;
1516
1617const projectInCollection = ( project , collection ) =>
17- collection . items . find ( item => item . project . id === project . id ) != null ;
18+ collection . items . find ( item => item . projectId === project . id ) != null ;
1819
1920class CollectionList extends React . Component {
2021 constructor ( props ) {
@@ -42,9 +43,9 @@ class CollectionList extends React.Component {
4243
4344 getTitle ( ) {
4445 if ( this . props . username === this . props . user . username ) {
45- return 'p5.js Web Editor | My collections' ;
46+ return this . props . t ( 'AddToCollectionList.Title' ) ;
4647 }
47- return `p5.js Web Editor | ${ this . props . username } 's collections` ;
48+ return this . props . t ( 'AddToCollectionList.AnothersTitle' , { anotheruser : this . props . username } ) ;
4849 }
4950
5051 handleCollectionAdd = ( collection ) => {
@@ -74,19 +75,22 @@ class CollectionList extends React.Component {
7475 items = { collectionWithSketchStatus }
7576 onAdd = { this . handleCollectionAdd }
7677 onRemove = { this . handleCollectionRemove }
78+ t = { this . props . t }
7779 />
7880 ) ;
7981 } else {
80- content = 'No collections' ;
82+ content = this . props . t ( 'AddToCollectionList.Empty' ) ;
8183 }
8284
8385 return (
84- < div className = "quick-add-wrapper" >
85- < Helmet >
86- < title > { this . getTitle ( ) } </ title >
87- </ Helmet >
88-
89- { content }
86+ < div className = "collection-add-sketch" >
87+ < div className = "quick-add-wrapper" >
88+ < Helmet >
89+ < title > { this . getTitle ( ) } </ title >
90+ </ Helmet >
91+
92+ { content }
93+ </ div >
9094 </ div >
9195 ) ;
9296 }
@@ -133,7 +137,8 @@ CollectionList.propTypes = {
133137 owner : PropTypes . shape ( {
134138 id : PropTypes . string
135139 } )
136- } )
140+ } ) ,
141+ t : PropTypes . func . isRequired
137142} ;
138143
139144CollectionList . defaultProps = {
@@ -162,4 +167,4 @@ function mapDispatchToProps(dispatch) {
162167 ) ;
163168}
164169
165- export default connect ( mapStateToProps , mapDispatchToProps ) ( CollectionList ) ;
170+ export default withTranslation ( ) ( connect ( mapStateToProps , mapDispatchToProps ) ( CollectionList ) ) ;
0 commit comments