Skip to content

Commit ff0e984

Browse files
author
Vikas Agarwal
committed
Github issue#1326, Load all active projects for customer card view
— put a label "end of list" so people don't keep hitting the button
1 parent 57c9d58 commit ff0e984

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,15 @@ const ProjectsCardView = props => {
4141
const handleLoadMore = () => {
4242
onPageChange(pageNum + 1)
4343
}
44+
const hasMore = ((pageNum - 1) * 20 + 20 < totalCount)
4445
return (
4546
<div className="projects card-view">
4647
{ !!inifinite &&
4748
<InfiniteScroll
4849
initialLoad={false}
4950
pageStart={pageNum}
5051
loadMore={onPageChange}
51-
hasMore={ ((pageNum - 1) * 20 + 20 < totalCount)}
52+
hasMore={ hasMore }
5253
loader={<LoadingIndicator />}
5354
>
5455
{ projects.map(renderProject)}
@@ -61,7 +62,8 @@ const ProjectsCardView = props => {
6162
<div className="project-card"><NewProjectCard /></div>
6263
</div>
6364
}
64-
{ !inifinite && <button type="button" className="tc-btn tc-btn-primary" onClick={handleLoadMore}>Load more</button> }
65+
{ !inifinite && hasMore && <button type="button" className="tc-btn tc-btn-primary" onClick={handleLoadMore}>Load more</button> }
66+
{ !hasMore && <span>End of results</span>}
6567
</div>
6668
)
6769
}

0 commit comments

Comments
 (0)