Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

facebook/chore/update rapid #24

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
0131aa8
Restructured API Endpoints for ohsomeNow stats
HelNershingThapa Aug 9, 2023
dea1dd4
Implementing production API endpoints for ohsomeNow stats retrieval
HelNershingThapa Aug 16, 2023
de4bf0a
Simplify API request URL and update statistics base URL
HelNershingThapa Aug 17, 2023
a5fa2cb
Add `StatsTimestamp` component
HelNershingThapa Aug 21, 2023
1c089bb
Revise generic tooltip (ohsomeNow Stats) message
HelNershingThapa Oct 3, 2023
fd198ea
Update test cases to reflect API restructuring
HelNershingThapa Oct 3, 2023
a519545
Fix UTC to user location conversion issue in My Contributions
royallsilwallz Oct 6, 2023
70b8674
feat: add tooltip to ohsomeNow stats section in homepage
royallsilwallz Oct 9, 2023
ad12b69
style ohsomeNow stat tooltip in home page
royallsilwallz Oct 9, 2023
99ec96b
add TimeZone information to project stats Tooltip
royallsilwallz Oct 10, 2023
e84aec0
refactor ohsomeNow stat tooltip to use same StatsTimestamp component
royallsilwallz Oct 10, 2023
5c7f928
fix stats tooltip typo
royallsilwallz Oct 10, 2023
a858e01
Merge pull request #6021 from hotosm/enhancement/5999-ohsomeNow-stats
ramyaragupathy Oct 10, 2023
547e0ce
Revert changes to yarn.lock in #6021 (#6076)
HelNershingThapa Oct 11, 2023
de8bfc3
replace zero with - for ohsomeNow stats no value case in My Contribut…
royallsilwallz Oct 11, 2023
5b895a4
Merge pull request #6080 from hotosm/enhancement/6078-ohsomeNow-myCon…
ramyaragupathy Oct 12, 2023
95417b3
Merge branch 'chore/update-rapid' of github.com:facebook/OSM-HOT-Task…
royallsilwallz Oct 16, 2023
5475b68
fix test case fail error
royallsilwallz Oct 16, 2023
e90ebd9
Fix syntax error parsing JSON string
eternaltyro Oct 18, 2023
635d259
Merge pull request #6084 from hotosm/fix/json-loadstring-syntax
eternaltyro Oct 18, 2023
2f1b2d5
Update CircleCI AWS CLI Orb syntax
eternaltyro Oct 19, 2023
c847f49
Remove Postgis extension creation
eternaltyro Oct 19, 2023
216ef04
Merge pull request #6086 from hotosm/fix/circleci-oidc-syntax
eternaltyro Oct 19, 2023
b078afe
fix: unable to access draft and private projects
kaditya97 Oct 20, 2023
43c6a63
Merge pull request #6089 from hotosm/hotfix/access-draft-private-proj…
ramyaragupathy Oct 20, 2023
59938b3
Enable IPv6 for Application Load Balancers
eternaltyro Oct 24, 2023
0e48534
Merge pull request #6099 from hotosm/fix/enable-ipv6-for-loadbalancers
eternaltyro Oct 24, 2023
bd41bf6
Enable IPv6 for RDS databases
eternaltyro Oct 24, 2023
b5d3822
Merge pull request #6100 from hotosm/fix/enable-ipv6-for-databases
eternaltyro Oct 24, 2023
a08e580
Make RDS databases publicly inaccessible
eternaltyro Oct 24, 2023
088551a
Merge pull request #6101 from hotosm/fix/make-database-not-publicly-a…
eternaltyro Oct 24, 2023
cf3f38d
Remove IPv6 for databases
eternaltyro Oct 24, 2023
3dd998c
Roadmap link updated
ramyaragupathy Oct 26, 2023
d560a76
Roadmap link update
ramyaragupathy Oct 26, 2023
f27b463
Fix My Tasks list view not showing pagination issue
royallsilwallz Oct 31, 2023
7da7a50
Do not show pagination when no data present in ProjectCardPaginator
royallsilwallz Oct 31, 2023
03b2dcc
Fix test case failure issue for projectCardPaginator.test
royallsilwallz Oct 31, 2023
405e3b0
Fix crash issue when user logout from settings page
royallsilwallz Nov 1, 2023
206ba20
Fix incomplete contributor list for validating multiple tasksin tasks…
royallsilwallz Nov 2, 2023
90d39ba
Fix sonarlint error
royallsilwallz Nov 2, 2023
8257917
Fix username tags not displaying in comment section in project Q&A
royallsilwallz Nov 3, 2023
a6399ff
Address Sonarlint error in Questions and Comments section
royallsilwallz Nov 6, 2023
b4df635
fix: inconsistent mapper level label on user profile page
kaditya97 Nov 8, 2023
85075e8
updating latest label names
ramyaragupathy Nov 8, 2023
7e00fe2
Override tachyons styles for code tag
royallsilwallz Nov 22, 2023
8ee9132
fix: associated projects in teams page
kaditya97 Nov 24, 2023
009023d
fix: team delete message for associated projects
kaditya97 Nov 24, 2023
1965f37
fix: reformatted using black
kaditya97 Nov 24, 2023
d4d2f98
Merge pull request #6139 from hotosm/fix/6133-editor-code-tag-style
ramyaragupathy Nov 27, 2023
aac4981
Merge pull request #6129 from hotosm/fix/6114-username-tags-in-projec…
ramyaragupathy Nov 27, 2023
3de8782
Merge pull request #6127 from hotosm/fix/6115-incomplete-contributor-…
ramyaragupathy Nov 27, 2023
d94f350
Merge pull request #6118 from hotosm/fix/6116-my-tasks-pagination-mis…
ramyaragupathy Nov 27, 2023
40a24cb
Merge pull request #6122 from royallsilwallz/fix/6121-logout-from-set…
ramyaragupathy Nov 27, 2023
e1fe660
Merge pull request #6134 from hotosm/fix/inconsistent-mapper-level-label
ramyaragupathy Nov 27, 2023
8b3ccc2
Merge pull request #6141 from hotosm/fix/associated-projects-in-teams…
ramyaragupathy Nov 27, 2023
3e43f21
Merge pull request #6142 from hotosm/fix/team-delete-message-for-asso…
ramyaragupathy Nov 27, 2023
238e567
Remove references to rapid context methods that no longer exist.
Bonkles Apr 11, 2023
a177c4f
Rapid v2: Show the GPX data
tsmock Apr 12, 2023
df2849a
Fix NPE in rapidEditor
tsmock Apr 12, 2023
0fe1823
Rapid updates
tsmock Apr 17, 2023
f12712a
Bump rapid version to 2.0.3, also make use of imagery and init promis…
Bonkles May 3, 2023
bb81204
Fix bug that would cause the 'custom editor' useEffect code to fire e…
Bonkles May 3, 2023
b2a0ebe
Update yarn.lock
tsmock Jun 8, 2023
7aedba9
Rapid: Update for next Rapid version
tsmock Jul 27, 2023
d56d40f
Update Rapid to v2.1.1
tsmock Aug 30, 2023
35b3e2d
Rapid: Use system interface for setting up Rapid
tsmock Aug 30, 2023
d3eddb9
Rapid: Load css and data resources from CDN
tsmock Aug 31, 2023
5e5b5ad
Rapid: Fix issue where toggling sidebar would lose data, ensure mapvi…
tsmock Aug 31, 2023
8b6c267
Don't try to upload to sentry if we aren't logged in
tsmock Aug 31, 2023
c024ce0
Rapid: Fix preauth
tsmock Aug 31, 2023
b33d5ac
Rapid: Use URL hash parameters instead of function calls
tsmock Sep 5, 2023
8d22791
Rapid: Get it working between task switches
tsmock Sep 8, 2023
ce11c1a
Rapid: Store dom node in state for reuse
tsmock Sep 8, 2023
ac1b842
Rapid: Export functions that may be useful for iD and add basic tests…
tsmock Sep 8, 2023
b120d32
Listen for reset events to update task state disable state
tsmock Sep 11, 2023
0b66836
rapid: Add PropTypes for SonarLint
tsmock Oct 16, 2023
4c5962e
Update sidebar test for Rapid changes
tsmock Nov 28, 2023
3420409
Merge branch 'develop' of github.com:hotosm/tasking-manager into develop
royallsilwallz Nov 29, 2023
94524a2
Merge branch 'chore/update-rapid' of github.com:facebook/OSM-HOT-Task…
royallsilwallz Nov 29, 2023
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
53 changes: 32 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
version: 2.1

orbs:
aws-cli: circleci/[email protected]
aws-cli: circleci/[email protected]
aws-ecs: circleci/[email protected]
opsgenie: opsgenie/[email protected]


jobs:
frontend-code-test:
resource_class: large
Expand Down Expand Up @@ -68,7 +70,7 @@ jobs:
TM_ORG_CODE: "CICode"
TM_ORG_NAME: "CircleCI Test Organisation"

- image: cimg/postgres:14.2-postgis
- image: cimg/postgres:14.9-postgis
environment:
POSTGRES_USER: taskingmanager
POSTGRES_DB: test_tm
Expand All @@ -79,12 +81,6 @@ jobs:
- run: sudo apt-get update
- run: sudo apt-get -y install libgeos-dev # Required for shapely
- run: sudo apt-get -y install proj-bin libproj-dev
- run:
name: Configure Postgresql Test database
command: |
psql \
-d $SQLALCHEMY_DATABASE_URI \
-c "CREATE EXTENSION postgis;"
- run: pip install --upgrade pip pdm
- run: pdm config --global python.use_venv False
- run: pdm export --dev --without-hashes > requirements.txt
Expand Down Expand Up @@ -113,13 +109,13 @@ jobs:
description: "Cloudformation stack name"
type: string
docker:
- image: cimg/postgres:15.1-postgis
- image: cimg/postgres:15.4-postgis
steps:
- aws-cli/setup:
role-arn: "arn:aws:iam::$ORG_AWS_ACCOUNT_ID:role/CircleCI-OIDC-Connect"
profile-name: "OIDC-Profile"
role-session-name: "database-snapshot"
session-duration: "2700"
role_arn: "arn:aws:iam::$ORG_AWS_ACCOUNT_ID:role/CircleCI-OIDC-Connect"
profile_name: "OIDC-Profile"
role_session_name: "database-snapshot"
session_duration: "2700"
- run:
name: Find the instance ID of the database in the stack to backup
command: |
Expand Down Expand Up @@ -193,10 +189,10 @@ jobs:
steps:
- checkout
- aws-cli/setup:
role-arn: "arn:aws:iam::$ORG_AWS_ACCOUNT_ID:role/CircleCI-OIDC-Connect"
profile-name: "OIDC-Profile"
role-session-name: "backend-deploy"
session-duration: "2700"
role_arn: "arn:aws:iam::$ORG_AWS_ACCOUNT_ID:role/CircleCI-OIDC-Connect"
profile_name: "OIDC-Profile"
role_session_name: "backend-deploy"
session_duration: "2700"
- run: sudo apt-get update
- run: sudo apt-get -y install libgeos-dev jq
- run: sudo yarn global add @mapbox/cfn-config @mapbox/cloudfriend
Expand All @@ -222,6 +218,21 @@ jobs:
export JSON_CONFIG="$(< $CIRCLE_WORKING_DIRECTORY/cfn-config-<< parameters.stack_name >>.json)"
cfn-config update << parameters.stack_name >> $CIRCLE_WORKING_DIRECTORY/scripts/aws/cloudformation/tasking-manager.template.js -f -c hot-cfn-config -t hot-cfn-config -r $AWS_REGION -p "$JSON_CONFIG"

backend_deploy_containers:
working_directory: /home/circleci/tasking-manager
docker:
- image: cimg/python:3.10.7
steps:
- checkout
- aws-cli/setup:
role_arn: "arn:aws:iam::$ORG_AWS_ACCOUNT_ID:role/CircleCI-OIDC-Connect"
profile_name: "OIDC-Profile"
role_session_name: "backend-deploy-containers"
session_duration: "2700"
- run: sudo apt-get update
- run: sudo apt-get -y install curl
- run: echo "Run AWS Fargate"

frontend_deploy:
working_directory: /home/circleci/tasking-manager
resource_class: large
Expand All @@ -234,10 +245,10 @@ jobs:
steps:
- checkout
- aws-cli/setup:
role-arn: "arn:aws:iam::$ORG_AWS_ACCOUNT_ID:role/CircleCI-OIDC-Connect"
profile-name: "OIDC-Profile"
role-session-name: "frontend-deploy"
session-duration: "1800"
role_arn: "arn:aws:iam::$ORG_AWS_ACCOUNT_ID:role/CircleCI-OIDC-Connect"
profile_name: "OIDC-Profile"
role_session_name: "frontend-deploy"
session_duration: "1800"
- run:
name: Deploy Frontend to S3
command: |
Expand Down
8 changes: 4 additions & 4 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"Component: Frontend":
"codebase: frontend":
- frontend/**/*
"Component: Backend":
"codebase: backend":
- backend/**/*
- tests/**/*
- migrations/**/*
- ./manage.py
- ./pyproject.toml
"Component: Infrastructure":
"infrastructure":
- .circleci/*
- .github/**/*
- scripts/aws/**/*
Expand All @@ -20,5 +20,5 @@
- frontend/yarn.lock
"python":
- ./pyproject.toml
"Type: Translations":
"type: translations":
- frontend/src/locales/*
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ This is Free and Open Source Software. You are welcome to use the code and set u
* Read the monthly update blogs on [OSM Discourse](https://community.openstreetmap.org/c/general/38/all).

## Product Roadmap
We have included below a high level roadmap/plan [subject to change] that can be used as an overview.
![image](https://user-images.githubusercontent.com/98902727/218763601-f08e3879-51f3-40a7-ae6e-bdf96f8a5979.png)

We have included below a [high level roadmap/plan](https://github.com/orgs/hotosm/projects/28/) [subject to change] that can be used as an overview.


## Developers
Expand Down
3 changes: 1 addition & 2 deletions backend/api/teams/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ def delete(self, team_id):
"SubCode": "UserNotTeamManager",
}, 401

TeamService.delete_team(team_id)
return {"Success": "Team deleted"}, 200
return TeamService.delete_team(team_id)


class TeamsAllAPI(Resource):
Expand Down
2 changes: 1 addition & 1 deletion backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class EnvironmentConfig:
"""
import json

_params = json.loads(os.getenv("OAUTH2_APP_CREDENTIALS"), None)
_params = json.loads(os.getenv("OAUTH2_APP_CREDENTIALS", None))
OAUTH_CLIENT_ID = _params.get("CLIENT_ID", None)
OAUTH_CLIENT_SECRET = _params.get("CLIENT_SECRET", None)
OAUTH_REDIRECT_URI = _params.get("REDIRECT_URI", None)
Expand Down
6 changes: 5 additions & 1 deletion backend/services/team_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,12 @@ def delete_team(team_id: int):

if team.can_be_deleted():
team.delete()
return {"Success": "Team deleted"}, 200
else:
raise TeamServiceError("Team has projects, cannot be deleted")
return {
"Error": "Team has projects, cannot be deleted",
"SubCode": "This team has projects associated. Before deleting team, unlink any associated projects.",
}, 400

@staticmethod
def check_team_membership(project_id: int, allowed_roles: list, user_id: int):
Expand Down
6 changes: 3 additions & 3 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ OSM_REGISTER_URL=https://www.openstreetmap.org/user/new
# It's not required to set this tag. Case it isn't set, an image will be used as background.
# TM_HOMEPAGE_VIDEO_URL=

# Endpoint for the missing maps stats
# API base URL and token(used to retrieve user stats only) for ohsomeNow Stats
#
TM_USER_STATS_API_URL=https://osm-stats-production-api.azurewebsites.net/users/
TM_HOMEPAGE_STATS_API_URL=https://osmstats-api.hotosm.org/wildcard?key=hotosm-project-*
OHSOME_STATS_BASE_URL=https://stats.now.ohsome.org/api
OHSOME_STATS_TOKEN=testSuperSecretTestToken

# Secret (required)
#
Expand Down
4 changes: 2 additions & 2 deletions frontend/.env.expand
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ REACT_APP_MAPBOX_TOKEN=$TM_MAPBOX_TOKEN
REACT_APP_ENABLE_SERVICEWORKER=$TM_ENABLE_SERVICEWORKER
REACT_APP_MAX_FILESIZE=$TM_IMPORT_MAX_FILESIZE
REACT_APP_MAX_AOI_AREA=$TM_MAX_AOI_AREA
REACT_APP_USER_STATS_API_URL=$TM_USER_STATS_API_URL
REACT_APP_HOMEPAGE_STATS_API_URL=$TM_HOMEPAGE_STATS_API_URL
REACT_APP_OHSOME_STATS_BASE_URL=$OHSOME_STATS_BASE_URL
REACT_APP_OHSOME_STATS_TOKEN=$OHSOME_STATS_TOKEN
REACT_APP_OSM_CLIENT_ID=$TM_CLIENT_ID
REACT_APP_OSM_CLIENT_SECRET=$TM_CLIENT_SECRET
REACT_APP_OSM_REDIRECT_URI=$TM_REDIRECT_URI
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/api/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ export const useProjectsQuery = (fullProjectsQuery, action) => {
};

export const useProjectQuery = (projectId) => {
const token = useSelector((state) => state.auth.token);
const locale = useSelector((state) => state.preferences['locale']);
const fetchProject = ({ signal }) => {
return api().get(`projects/${projectId}/`, {
return api(token, locale).get(`projects/${projectId}/`, {
signal,
});
};
Expand Down
19 changes: 7 additions & 12 deletions frontend/src/api/stats.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useQuery } from '@tanstack/react-query';

import api from './apiClient';
import { HOMEPAGE_STATS_API_URL } from '../config';
import { OHSOME_STATS_BASE_URL } from '../config';

export const useSystemStatisticsQuery = () => {
const fetchSystemStats = ({ signal }) => {
Expand Down Expand Up @@ -33,7 +33,7 @@ export const useProjectStatisticsQuery = (projectId) => {

export const useOsmStatsQuery = () => {
const fetchOsmStats = ({ signal }) => {
return api().get(HOMEPAGE_STATS_API_URL, {
return api().get(`${OHSOME_STATS_BASE_URL}/stats/hotosm-project-%2A`, {
signal,
});
};
Expand All @@ -42,27 +42,22 @@ export const useOsmStatsQuery = () => {
queryKey: ['osm-stats'],
queryFn: fetchOsmStats,
useErrorBoundary: true,
select: (data) => data.data.result
});
};

export const useOsmHashtagStatsQuery = (defaultComment) => {
const fetchOsmStats = ({ signal }) => {
return api().get(
`https://osm-stats-production-api.azurewebsites.net/stats/${defaultComment[0].replace(
'#',
'',
)}`,
{
signal,
},
);
return api().get(`${OHSOME_STATS_BASE_URL}/stats/${defaultComment[0].replace('#', '')}`, {
signal,
});
};

return useQuery({
queryKey: ['osm-hashtag-stats'],
queryFn: fetchOsmStats,
useErrorBoundary: true,
enabled: Boolean(defaultComment?.[0]),
select: (data) => data.data,
select: (data) => data.data.result,
});
};
5 changes: 5 additions & 0 deletions frontend/src/assets/styles/_extra.scss
Original file line number Diff line number Diff line change
Expand Up @@ -616,3 +616,8 @@ a[href="https://www.mapbox.com/map-feedback/"]
.link:focus {
outline: revert;
}

// Override tachyons font-family for code tag
.code {
font-family: inherit;
}
6 changes: 3 additions & 3 deletions frontend/src/components/homepage/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ export const StatsSection = () => {
<div className="pt5 pb2 ph6-l ph4 flex justify-around flex-wrap flex-nowrap-ns stats-container">
<StatsColumn
label={messages.buildingsStats}
value={hasStatsLoaded ? osmStatsData?.data.building_count_add : undefined}
value={hasStatsLoaded ? osmStatsData?.buildings : undefined}
/>
<StatsColumn
label={messages.roadsStats}
value={hasStatsLoaded ? osmStatsData?.data.road_km_add : undefined}
value={hasStatsLoaded ? osmStatsData?.roads : undefined}
/>
<StatsColumn
label={messages.editsStats}
value={hasStatsLoaded ? osmStatsData?.data.edits : undefined}
value={hasStatsLoaded ? osmStatsData?.edits : undefined}
/>
<StatsColumn
label={messages.communityStats}
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/components/homepage/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,9 @@
padding-bottom: 3.345rem;
}
}

.info-ohsome-tooltip {
display: flex;
justify-content: flex-end;
padding-right: 0.875rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ export const PostProjectComment = ({ projectId, refetchComments, contributors })
isShowUserPicture
isShowFooter
isShowTabNavs
contributors={contributors?.userContributions?.map((user) => user.username)}
contributors={
Array.isArray(contributors) ? contributors.map((user) => user.username) : undefined
}
/>
</div>

Expand Down
21 changes: 9 additions & 12 deletions frontend/src/components/projectStats/edits.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
import React from 'react';
import ReactTooltip from 'react-tooltip';
import { FormattedMessage, useIntl } from 'react-intl';
import { FormattedMessage } from 'react-intl';

import projectMessages from './messages';
import userDetailMessages from '../userDetail/messages';
import { MappingIcon, HomeIcon, RoadIcon, EditIcon, InfoIcon } from '../svgIcons';
import { MappingIcon, HomeIcon, RoadIcon, EditIcon } from '../svgIcons';
import { StatsCard } from '../statsCard';
import StatsTimestamp from '../statsTimestamp';

export const EditsStats = ({ data }) => {
const intl = useIntl();
const { changesets, buildings, roads, edits } = data;

const iconClass = 'h-50 w-50';
const iconStyle = { height: '45px' };

return (
<div className="cf w-100 pb4 ph2 ph4-ns blue-dark">
<h3 className="barlow-condensed ttu f3">
<FormattedMessage {...projectMessages.edits} />
<InfoIcon
data-tip={intl.formatMessage(projectMessages.editsStats)}
className="blue-grey h1 w1 v-mid pb1 ml2"
/>
</h3>
<ReactTooltip place="top" className="mw6" effect="solid" />
<div className="flex items-center">
<h3 className="barlow-condensed ttu f3">
<FormattedMessage {...projectMessages.edits} />
</h3>
<StatsTimestamp messageType="project" />
</div>
<div className="db pb2 project-edit-stats">
<StatsCard
field={'changesets'}
Expand Down
4 changes: 0 additions & 4 deletions frontend/src/components/projectStats/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,4 @@ export default defineMessages({
id: 'project.stats.edits',
defaultMessage: 'Edits',
},
editsStats: {
id: 'project.stats.edits.info',
defaultMessage: 'These stats are retrieved using the default changeset comment of the project',
},
});
3 changes: 2 additions & 1 deletion frontend/src/components/projects/projectCardPaginator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const ProjectCardPaginator = ({ status, pagination, fullProjectsQuery, se
);
};

if (!apiIsFetched) {
// do not show pagination when the data is being fetched or it has zero results
if (!apiIsFetched || !pagination?.total) {
return null;
}
const activePage = (apiIsFetched && pagination?.page) || 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('ProjectCardPaginator Component', () => {
hasPrev: false,
page: 1,
pages: 3,
total: 10,
}}
/>,
);
Expand All @@ -32,6 +33,7 @@ describe('ProjectCardPaginator Component', () => {
hasPrev: false,
page: 1,
pages: 3,
total: 10,
}}
/>,
);
Expand Down
Loading
Loading