@@ -21,6 +21,7 @@ import {
21
21
EDIT_CLASSROOM_BUTTON_CLASS ,
22
22
EDIT_CLASSROOM_VALIDATE_BUTTON_ID ,
23
23
EDIT_CLASSROOM_CANCEL_BUTTON_ID ,
24
+ EDIT_CLASSROOM_DELETE_DATA_BUTTON_CLASS ,
24
25
} from '../../config/selectors' ;
25
26
import ClassroomNameTextField from './ClassroomNameTextField' ;
26
27
import { isClassroomNameValid } from '../../utils/classroom' ;
@@ -56,6 +57,7 @@ class EditClassroomButton extends Component {
56
57
spaces : PropTypes . arrayOf ( { } ) . isRequired ,
57
58
} ) . isRequired ,
58
59
t : PropTypes . func . isRequired ,
60
+ userId : PropTypes . string . isRequired ,
59
61
} ;
60
62
61
63
state = ( ( ) => {
@@ -95,9 +97,10 @@ class EditClassroomButton extends Component {
95
97
const {
96
98
dispatchEditClassroom,
97
99
classroom : { id } ,
100
+ userId,
98
101
} = this . props ;
99
102
if ( isClassroomNameValid ( name ) ) {
100
- dispatchEditClassroom ( { name, id, deleteSelection } ) ;
103
+ dispatchEditClassroom ( { name, id, deleteSelection, userId } ) ;
101
104
this . close ( ) ;
102
105
}
103
106
} ;
@@ -142,6 +145,7 @@ class EditClassroomButton extends Component {
142
145
) : (
143
146
< Tooltip title = { t ( `Delete this space` ) } >
144
147
< IconButton
148
+ className = { EDIT_CLASSROOM_DELETE_DATA_BUTTON_CLASS }
145
149
color = "inherit"
146
150
onClick = { e => this . changeDeleteSelection ( e , spaceId , true ) }
147
151
>
@@ -151,7 +155,7 @@ class EditClassroomButton extends Component {
151
155
) ;
152
156
153
157
return (
154
- < >
158
+ < Grid container data-space-id = { spaceId } alignItems = "center" >
155
159
< Grid item xs = { 2 } >
156
160
{ button }
157
161
</ Grid >
@@ -166,7 +170,7 @@ class EditClassroomButton extends Component {
166
170
>
167
171
< Typography > { spaceName } </ Typography >
168
172
</ Grid >
169
- </ >
173
+ </ Grid >
170
174
) ;
171
175
} ) }
172
176
</ Grid >
@@ -231,12 +235,16 @@ class EditClassroomButton extends Component {
231
235
}
232
236
}
233
237
238
+ const mapStateToProps = ( { authentication } ) => ( {
239
+ userId : authentication . getIn ( [ 'user' , 'id' ] ) ,
240
+ } ) ;
241
+
234
242
const mapDispatchToProps = {
235
243
dispatchEditClassroom : editClassroom ,
236
244
} ;
237
245
238
246
const ConnectedComponent = connect (
239
- null ,
247
+ mapStateToProps ,
240
248
mapDispatchToProps
241
249
) ( EditClassroomButton ) ;
242
250
0 commit comments