Skip to content

Commit c39a04b

Browse files
committed
refactor: update parseInt to Number.parseInt
1 parent fdf102b commit c39a04b

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

frontend/src/components/partnerMapswipeStats/contributionsHeatmap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export const ContributionsHeatmap = ({ contributionsByGeo = [] }) => {
169169
const currentZoom = map.current.getZoom();
170170
const h3ResBasedOnZoom =
171171
currentZoom >= 1
172-
? zoomToH3ResMapping[parseInt(currentZoom)] ?? Math.floor((currentZoom - 2) * 0.7)
172+
? zoomToH3ResMapping[Number.parseInt(currentZoom)] ?? Math.floor((currentZoom - 2) * 0.7)
173173
: 1;
174174

175175
map.current.getSource('hexbin').setData({

frontend/src/components/partners/currentProjects.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function CurrentProjects({ currentProjects }) {
3131

3232
const fetchData = async () => {
3333
try {
34-
const projectIds = currentProjects.split(',').map((id) => parseInt(id.trim(), 10));
34+
const projectIds = currentProjects.split(',').map((id) => Number.parseInt(id.trim(), 10));
3535
const promises = projectIds.map(async (id) => {
3636
const response = await fetch(API_URL + `projects/${id}/tasks/`);
3737

frontend/src/components/projectDetail/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ export const ProjectDetail = (props) => {
323323
size={'large'}
324324
textColor="white"
325325
users={contributors}
326-
maxLength={parseInt(size[0] / 75) > 12 ? 12 : parseInt(size[0] / 75)}
326+
maxLength={Number.parseInt(size[0] / 75) > 12 ? 12 : Number.parseInt(size[0] / 75)}
327327
/>
328328
)}
329329
</div>

frontend/src/components/teamsAndOrgs/orgUsageLevel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
// this component is designed to the FREE organisation type
1616
export function OrganisationUsageLevel({ completedActions, orgName }) {
1717
const [currentLevel, nextLevelThreshold] = useOrganisationLevel(completedActions);
18-
const percent = parseInt((completedActions / nextLevelThreshold) * 100);
18+
const percent = Number.parseInt((completedActions / nextLevelThreshold) * 100);
1919
const yearPrediction = usePredictYearlyTasks(completedActions, new Date());
2020
const levelPrediction = usePredictLevel(yearPrediction, 'FREE');
2121
const currentYear = getYear(new Date());
@@ -110,7 +110,7 @@ export function OrganisationTier({ completedActions, type, subscriptionTier }) {
110110
? levels.filter((level) => level.level === selectedTier.level + 1)[0].minActions
111111
: null;
112112
const nextLevel = useGetLevel(selectedTierMax);
113-
const percent = parseInt((completedActions / selectedTierMax) * 100);
113+
const percent = Number.parseInt((completedActions / selectedTierMax) * 100);
114114
const showDiscountLabel = levelPrediction.tier !== 'free' && type === 'DISCOUNTED';
115115
const currentYear = getYear(new Date());
116116

frontend/src/config/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const PROJECTCARD_CONTRIBUTION_SHOWN_THRESHOLD =
1616
process.env.REACT_APP_PROJECTCARD_CONTRIBUTION_SHOWN_THRESHOLD || 5;
1717
export const ENABLE_SERVICEWORKER = process.env.REACT_APP_ENABLE_SERVICEWORKER || 0;
1818
export const MAX_AOI_AREA = Number(process.env.REACT_APP_MAX_AOI_AREA) || 5000;
19-
export const MAX_FILESIZE = parseInt(process.env.REACT_APP_MAX_FILESIZE) || 1000000; // bytes
19+
export const MAX_FILESIZE = Number.parseInt(process.env.REACT_APP_MAX_FILESIZE) || 1000000; // bytes
2020

2121
// ORGANISATIONAL INFORMATION
2222
export const ORG_NAME = process.env.REACT_APP_ORG_NAME || 'Humanitarian OpenStreetMap Team';

frontend/src/hooks/UseProjectCompletenessCalc.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ export function useComputeCompleteness(tasks) {
1212
).length;
1313
const validated = getStatusCount(tasks, 'VALIDATED');
1414
const badImagery = getStatusCount(tasks, 'BADIMAGERY');
15-
setPercentMapped(parseInt(((mapped + validated) / (totalTasks - badImagery)) * 100));
16-
setPercentValidated(parseInt((validated / (totalTasks - badImagery)) * 100));
17-
setPercentBadImagery(parseInt((badImagery / totalTasks) * 100));
15+
setPercentMapped(Number.parseInt(((mapped + validated) / (totalTasks - badImagery)) * 100));
16+
setPercentValidated(Number.parseInt((validated / (totalTasks - badImagery)) * 100));
17+
setPercentBadImagery(Number.parseInt((badImagery / totalTasks) * 100));
1818
}
1919
}, [tasks, setPercentMapped, setPercentValidated, setPercentBadImagery]);
2020
return { percentMapped, percentValidated, percentBadImagery };

frontend/src/utils/taskGrid.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ export const createTaskGrid = (areaOfInterestExtent, zoomLevel) => {
5656
const step = AXIS_OFFSET / Math.pow(2, zoomLevel - 1);
5757

5858
// Calculate the min and max task indices at the required zoom level to cover the whole area of interest
59-
const xminstep = parseInt(Math.floor((xmin + AXIS_OFFSET) / step));
60-
const xmaxstep = parseInt(Math.ceil((xmax + AXIS_OFFSET) / step));
61-
const yminstep = parseInt(Math.floor((ymin + AXIS_OFFSET) / step));
62-
const ymaxstep = parseInt(Math.ceil((ymax + AXIS_OFFSET) / step));
59+
const xminstep = Number.parseInt(Math.floor((xmin + AXIS_OFFSET) / step));
60+
const xmaxstep = Number.parseInt(Math.ceil((xmax + AXIS_OFFSET) / step));
61+
const yminstep = Number.parseInt(Math.floor((ymin + AXIS_OFFSET) / step));
62+
const ymaxstep = Number.parseInt(Math.ceil((ymax + AXIS_OFFSET) / step));
6363

6464
let taskFeatures = [];
6565
// Generate an array of task features

0 commit comments

Comments
 (0)