Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/api/projects.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import _ from 'lodash'
import { axiosInstance as axios } from './requestInterceptor'
import { TC_API_URL } from '../config/constants'
import { TC_API_URL, PROJECT_LIST_PAGE_SIZE } from '../config/constants'

export function getProjects(criteria, pageNum) {
// add default params
const includeFields = ['id', 'name', 'description', 'members', 'status', 'type', 'actualPrice', 'estimatedPrice', 'createdAt', 'updatedAt', 'details']
const params = {
limit: 20,
offset: (pageNum - 1) * 20,
limit: PROJECT_LIST_PAGE_SIZE,
offset: (pageNum - 1) * PROJECT_LIST_PAGE_SIZE,
fields: includeFields.join(',')
}
// filters
Expand Down
6 changes: 6 additions & 0 deletions src/config/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,3 +268,9 @@ export const GA_CLIENT_ID = '_gacid'

// ToolTip
export const TOOLTIP_DEFAULT_DELAY = 300 // in ms

/*
* Project listing page size - maximum value can be 20 due to max 20 records
* restriction at back-end api end.
*/
export const PROJECT_LIST_PAGE_SIZE = 20
4 changes: 2 additions & 2 deletions src/projects/list/components/Projects/ProjectsCardView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import InfiniteScroll from 'react-infinite-scroller'
import ProjectCard from './ProjectCard'
import NewProjectCard from './NewProjectCard'
import LoadingIndicator from '../../../../components/LoadingIndicator/LoadingIndicator'

import { setDuration } from '../../../../helpers/projectHelper'
import { PROJECT_LIST_PAGE_SIZE } from '../../../../config/constants'

require('./ProjectsGridView.scss')

Expand Down Expand Up @@ -41,7 +41,7 @@ const ProjectsCardView = props => {
const handleLoadMore = () => {
onPageChange(pageNum + 1)
}
const hasMore = ((pageNum - 1) * 20 + 20 < totalCount)
const hasMore = ((pageNum - 1) * PROJECT_LIST_PAGE_SIZE + PROJECT_LIST_PAGE_SIZE < totalCount)
return (
<div className="projects card-view">
{ !!inifinite &&
Expand Down
4 changes: 2 additions & 2 deletions src/projects/list/components/Projects/ProjectsGridView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import GridView from '../../../../components/Grid/GridView'

import UserWithName from '../../../../components/User/UserWithName'
import { findCategory } from '../../../../config/projectWizard'
import { PROJECT_STATUS } from '../../../../config/constants'
import { PROJECT_STATUS, PROJECT_LIST_PAGE_SIZE } from '../../../../config/constants'

require('./ProjectsGridView.scss')

Expand Down Expand Up @@ -188,7 +188,7 @@ const ProjectsGridView = props => {
resultSet: projects,
totalCount,
currentPageNum: pageNum,
pageSize: 20
pageSize: PROJECT_LIST_PAGE_SIZE
}

return (
Expand Down