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

Fix/ faster load project list with no map omit #58

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
7 changes: 6 additions & 1 deletion frontend/src/components/projectDetail/downloadOsmData.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ export const DownloadOsmData = ({ projectMappingTypes, project }) => {
window.focus();
if (window._paq) {
// Check if Matomo tracking array (_paq) exists
window._paq.push(['trackEvent', 'OSMDownloads', 'Click', `${title}_${fileFormat}`]);
window._paq.push([
'trackEvent',
'OSMDownloads',
'Click',
`${project.projectId}_${title}_${fileFormat}`,
]);
}
// Check if the request was successful
if (responsehead.ok) {
Expand Down
13 changes: 12 additions & 1 deletion frontend/src/components/projects/projectNav.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect } from 'react';
import { Link, useLocation } from 'react-router-dom';
import { FormattedMessage } from 'react-intl';
import { useSelector, useDispatch } from 'react-redux';
Expand Down Expand Up @@ -84,7 +84,18 @@ export const ProjectNav = (props) => {
const encodedParams = stringify(fullProjectsQuery)
? ['?', stringify(fullProjectsQuery)].join('')
: '';
const isMapShown = useSelector((state) => state.preferences['mapShown']);

useEffect(() => {
setQuery(
{
...fullProjectsQuery,
omitMapResults:!isMapShown
},
'pushIn',
);
// eslint-disable-next-line react-hooks/exhaustive-deps
},[isMapShown])
const linkCombo = 'link ph3 f6 pv2 ba b--tan br1 ph3 fw5';

const moreFiltersAnyActive =
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/hooks/UseProjectsQueryAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const projectQueryAllSpecification = {
stale: BooleanParam,
createdFrom: StringParam,
basedOnMyInterests: BooleanParam,
omitMapResults: BooleanParam,
};

/* This can be passed into project API or used independently */
Expand Down Expand Up @@ -70,6 +71,7 @@ const backendToQueryConversion = {
stale: 'lastUpdatedTo',
createdFrom: 'createdFrom',
basedOnMyInterests: 'basedOnMyInterests',
omitMapResults:'omitMapResults',
};

const dataFetchReducer = (state, action) => {
Expand Down
Loading