@@ -15,13 +15,11 @@ import * as boardActions from '../actions/BoardActions'
15
15
import * as laneActions from '../actions/LaneActions'
16
16
17
17
class BoardContainer extends Component {
18
- //+add 2018.08.23
19
18
state = {
20
19
addLaneMode : false
21
20
}
22
21
23
- //+end
24
- componentWillMount ( ) {
22
+ componentDidMount ( ) {
25
23
const { actions, eventBusHandle} = this . props
26
24
actions . loadBoard ( this . props . data )
27
25
if ( eventBusHandle ) {
@@ -48,8 +46,7 @@ class BoardContainer extends Component {
48
46
49
47
onLaneDrop = ( { removedIndex, addedIndex, payload} ) => {
50
48
const { actions, handleLaneDragEnd} = this . props
51
- if ( removedIndex !== addedIndex ) { // 2018.08.22
52
- // actions.moveLane({oldIndex: removedIndex, newIndex: addedIndex});
49
+ if ( removedIndex !== addedIndex ) {
53
50
handleLaneDragEnd ( removedIndex , addedIndex , payload )
54
51
}
55
52
}
@@ -77,12 +74,12 @@ class BoardContainer extends Component {
77
74
toLaneId : event . toLaneId ,
78
75
cardId : event . cardId ,
79
76
index : event . index
80
- } ) ;
77
+ } )
81
78
case 'UPDATE_LANES' :
82
79
return actions . updateLanes ( event . lanes )
83
80
}
84
- } ,
85
- } ;
81
+ }
82
+ }
86
83
eventBusHandle ( eventBus )
87
84
}
88
85
@@ -109,7 +106,7 @@ class BoardContainer extends Component {
109
106
} )
110
107
return < span > { newCardWithProps } </ span >
111
108
} else {
112
- return < NewLane onCancel = { this . hideEditableLane } onAdd = { this . addNewLane } />
109
+ return < NewLane onCancel = { this . hideEditableLane } onAdd = { this . addNewLane } />
113
110
}
114
111
}
115
112
@@ -142,7 +139,7 @@ class BoardContainer extends Component {
142
139
'addCardTitle' ,
143
140
'newLaneTemplate' ,
144
141
'newCardTemplate'
145
- ] ) ;
142
+ ] )
146
143
147
144
return (
148
145
< BoardDiv style = { style } { ...otherProps } draggable = { false } >
@@ -153,8 +150,7 @@ class BoardContainer extends Component {
153
150
onDrop = { this . onLaneDrop }
154
151
lockAxis = "x"
155
152
getChildPayload = { index => this . getLaneDetails ( index ) }
156
- groupName = { `TrelloBoard${ id } ` }
157
- >
153
+ groupName = { `TrelloBoard${ id } ` } >
158
154
{ reducerData . lanes . map ( ( lane , index ) => {
159
155
const { id, droppable, ...otherProps } = lane
160
156
const laneToRender = (
@@ -167,28 +163,23 @@ class BoardContainer extends Component {
167
163
{ ...otherProps }
168
164
{ ...passthroughProps }
169
165
/>
170
- ) ;
171
- return draggable && laneDraggable ? (
172
- < Draggable key = { lane . id } > { laneToRender } </ Draggable >
173
- ) : (
174
- < span key = { lane . id } > { laneToRender } </ span >
175
- ) ;
166
+ )
167
+ return draggable && laneDraggable ? < Draggable key = { lane . id } > { laneToRender } </ Draggable > : < span key = { lane . id } > { laneToRender } </ span >
176
168
} ) }
177
169
</ Container >
178
- {
179
- canAddLanes &&
180
- < Container
181
- orientation = "horizontal"
182
- >
170
+ { canAddLanes && (
171
+ < Container orientation = "horizontal" >
183
172
{ editable && ! addLaneMode ? (
184
- < LaneSection style = { { width : 200 } } >
173
+ < LaneSection style = { { width : 200 } } >
185
174
< NewLaneButton onClick = { this . showEditableLane } > { addLaneTitle } </ NewLaneButton >
186
175
</ LaneSection >
187
- ) : ( addLaneMode && this . renderNewLane ( ) ) }
176
+ ) : (
177
+ addLaneMode && this . renderNewLane ( )
178
+ ) }
188
179
</ Container >
189
- }
180
+ ) }
190
181
</ BoardDiv >
191
- ) ;
182
+ )
192
183
}
193
184
}
194
185
@@ -226,7 +217,7 @@ BoardContainer.propTypes = {
226
217
addLaneTitle : PropTypes . string ,
227
218
addCardTitle : PropTypes . string ,
228
219
newLaneTemplate : PropTypes . node
229
- } ;
220
+ }
230
221
231
222
BoardContainer . defaultProps = {
232
223
onDataChange : ( ) => { } ,
@@ -245,12 +236,15 @@ BoardContainer.defaultProps = {
245
236
laneDragClass : 'react_trello_dragLaneClass' ,
246
237
addLaneTitle : '+ Add another lane' ,
247
238
addCardTitle : 'Add Card'
248
- } ;
239
+ }
249
240
250
241
const mapStateToProps = state => {
251
242
return state . lanes ? { reducerData : state } : { }
252
- } ;
243
+ }
253
244
254
245
const mapDispatchToProps = dispatch => ( { actions : bindActionCreators ( { ...boardActions , ...laneActions } , dispatch ) } )
255
246
256
- export default connect ( mapStateToProps , mapDispatchToProps ) ( BoardContainer )
247
+ export default connect (
248
+ mapStateToProps ,
249
+ mapDispatchToProps
250
+ ) ( BoardContainer )
0 commit comments