Skip to content

Commit 56ae5f1

Browse files
committed
fix: issue about pagination and gap line
1 parent a432b2c commit 56ae5f1

File tree

4 files changed

+27
-12
lines changed

4 files changed

+27
-12
lines changed

src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.jsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,26 +192,27 @@ class ManageMilestones extends React.Component {
192192
// no challenges
193193
if (!challengeIds.length) {
194194
return [
195-
<MilestoneChallengeHeader isUpdatable={isUpdatable}/>,
196-
<MilestoneChallengeRow isEmpty isUpdatable={isUpdatable}/>
195+
<MilestoneChallengeHeader key="header" isUpdatable={isUpdatable}/>,
196+
<MilestoneChallengeRow isEmpty key="row" isUpdatable={isUpdatable}/>
197197
]
198198
}
199199

200200
// loading challenges
201201
if (milestone.isLoadingChallenges) {
202202
return [
203-
<MilestoneChallengeHeader isUpdatable={isUpdatable}/>,
204-
<MilestoneChallengeRow isLoading isUpdatable={isUpdatable}/>
203+
<MilestoneChallengeHeader key="header" isUpdatable={isUpdatable}/>,
204+
<MilestoneChallengeRow isLoading key="row" isUpdatable={isUpdatable}/>,
205+
<MilestoneChallengeFooter isLoading key="footer" onLoadChallengesByPage={this.onLoadChallengesByPage} isUpdatable={isUpdatable}/>
205206
]
206207
}
207208

208209
const rows = _.map(milestone.challenges, (c) => {
209-
return <MilestoneChallengeRow challenge={c} isUpdatable={isUpdatable}/>
210+
return <MilestoneChallengeRow key={c.id} challenge={c} isUpdatable={isUpdatable}/>
210211
})
211212
return [
212-
<MilestoneChallengeHeader isUpdatable={isUpdatable}/>,
213+
<MilestoneChallengeHeader key="header" isUpdatable={isUpdatable}/>,
213214
...rows,
214-
<MilestoneChallengeFooter milestone={milestone} onLoadChallengesByPage={this.onLoadChallengesByPage} isUpdatable={isUpdatable}/>
215+
<MilestoneChallengeFooter milestone={milestone} key="footer" onLoadChallengesByPage={this.onLoadChallengesByPage} isUpdatable={isUpdatable}/>
215216
]
216217
}
217218
getSelectCount() {
@@ -262,6 +263,7 @@ class ManageMilestones extends React.Component {
262263
{canEdit ? <div styleName="unselect-bottom" onClick={this.onUnselectAll}>
263264
<IconUnselect /> {this.getSelectCount()} PROJECTS SELECTED
264265
</div>: null }
266+
{canEdit ? <div styleName="line"/>: null}
265267
{ canEdit ? <div styleName="delete-button">
266268
<MilestoneDeleteButton onDelete={this.onDeleteAll}/>
267269
</div>: null }

src/projects/detail/components/SimplePlan/ManageMilestones/ManageMilestones.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,20 @@
1717
font-size: 12px;
1818
padding: 0 5px;
1919
cursor: pointer;
20-
2120
svg {
2221
margin-right: 4px;
2322
height: 13px;
2423
width: 13px;
2524
}
2625
margin-right: 20px;
2726
}
27+
.line {
28+
width: 1px;
29+
height: 20px;
30+
display: inline-block;
31+
border: 1px solid #C4C4C4;
32+
margin-right: 10px;
33+
}
2834
.delete-button {
2935
cursor: pointer;
3036
margin: 0 10px;

src/projects/detail/components/SimplePlan/components/MilestoneChallengeFooter/MilestoneChallengeFooter.jsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class MilestoneChallengeFooter extends React.Component {
2929
if (this.state.curPage === page) {
3030
return
3131
}
32-
this.state.curPage = page
32+
this.setState({curPage: page})
3333
onLoadChallengesByPage(page, milestone)
3434
}
3535
renderPagination() {
@@ -60,10 +60,15 @@ class MilestoneChallengeFooter extends React.Component {
6060
render() {
6161
const {
6262
isUpdatable,
63-
milestone
63+
milestone,
64+
isLoading,
6465
} = this.props
65-
const url = `${WORK_MANAGER_APP}/${milestone.projectId}/challenges`
6666

67+
if (isLoading) {
68+
return null
69+
}
70+
71+
const url = `${WORK_MANAGER_APP}/${milestone.projectId}/challenges`
6772

6873
return (
6974
<tr styleName="challenge-table-row-wrap">
@@ -88,7 +93,8 @@ class MilestoneChallengeFooter extends React.Component {
8893
MilestoneChallengeFooter.propTypes = {
8994
onLoadChallengesByPage: PT.func,
9095
milestone: PT.shape(),
91-
isUpdatable: PT.bool
96+
isUpdatable: PT.bool,
97+
isLoading: PT.bool
9298
}
9399

94100
export default MilestoneChallengeFooter

src/projects/detail/components/SimplePlan/components/MilestoneChallengeRow/MilestoneChallengeRow.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
&.Registration { background-color: $tc-orange-100; }
3535
&.Appeals { background-color: $tc-orange-100; }
3636
&.AppealsResponse { background-color: $tc-orange-100; }
37+
&.Post-Mortem { background-color: $tc-orange-100; }
3738
&.Draft { background-color: $tc-gray-20; }
3839
&.Stalled { background-color: $tc-gray-20; }
3940
&.Completed { background-color: $tc-green-100; }

0 commit comments

Comments
 (0)