Skip to content

Commit 29eb28c

Browse files
author
Vikas Agarwal
committed
Github issue#1326, Load all active projects for customer card view
— Removed InfiniteScroll for time being as it is having issue of double page load. Added standard load more button instead to load more pages.
1 parent 880e628 commit 29eb28c

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

src/projects/list/components/Projects/ProjectsCardView.jsx

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require('./ProjectsGridView.scss')
1313
const ProjectsCardView = props => {
1414
//const { projects, members, totalCount, criteria, pageNum, applyFilters, sortHandler, onPageChange, error, isLoading, onNewProjectIntent } = props
1515
// TODO: use applyFilters and onNewProjectIntent. Temporary delete to avoid lint errors.
16-
const { projects, members, currentUser, onPageChange, pageNum, totalCount} = props
16+
const { projects, members, currentUser, onPageChange, pageNum, totalCount, inifinite } = props
1717
// const currentSortField = _.get(criteria, 'sort', '')
1818

1919
// annotate projects with member data
@@ -38,18 +38,30 @@ const ProjectsCardView = props => {
3838
/>
3939
</div>)
4040
}
41+
const handleLoadMore = () => {
42+
onPageChange(pageNum + 1)
43+
}
4144
return (
4245
<div className="projects card-view">
43-
<InfiniteScroll
46+
{ !!inifinite &&
47+
<InfiniteScroll
4448
initialLoad={false}
4549
pageStart={pageNum}
4650
loadMore={onPageChange}
4751
hasMore={ ((pageNum - 1) * 20 + 20 < totalCount)}
4852
loader={<LoadingIndicator />}
49-
>
50-
{ projects.map(renderProject)}
51-
<div className="project-card"><NewProjectCard /></div>
52-
</InfiniteScroll>
53+
>
54+
{ projects.map(renderProject)}
55+
<div className="project-card"><NewProjectCard /></div>
56+
</InfiniteScroll>
57+
}
58+
{ !inifinite &&
59+
<div>
60+
{ projects.map(renderProject)}
61+
<div className="project-card"><NewProjectCard /></div>
62+
</div>
63+
}
64+
{ !inifinite && <button type="button" className="tc-btn tc-btn-primary" onClick={handleLoadMore}>Load more</button> }
5365
</div>
5466
)
5567
}
@@ -71,4 +83,9 @@ ProjectsCardView.propTypes = {
7183
// criteria: PropTypes.object.isRequired
7284
}
7385

86+
87+
ProjectsCardView.defaultProps = {
88+
inifinite : false
89+
}
90+
7491
export default ProjectsCardView

src/projects/list/components/Projects/ProjectsGridView.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@
8686
}
8787

8888
.card-view {
89+
display: flex;
90+
flex-direction: column;
91+
align-items: center;
92+
8993
> div {// InfiniteScroll's div
9094
display: flex;
9195
flex-flow: row wrap;

0 commit comments

Comments
 (0)