Skip to content
Open
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
8 changes: 8 additions & 0 deletions frontend/src/components/projects/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,14 @@ export default defineMessages({
id: 'project.results.retry',
defaultMessage: 'Retry',
},
imagery: {
id: 'project.navFilters.imagery',
defaultMessage: 'Imagery',
},
selectImagery: {
id: 'project.navFilters.selectImagery',
defaultMessage: 'Select imagery',
},
partner: {
id: 'project.navFilters.partner',
defaultMessage: 'Partner',
Expand Down
22 changes: 22 additions & 0 deletions frontend/src/components/projects/moreFiltersForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useSelector } from 'react-redux';
import { Link } from 'react-router-dom';
import { useQueryParam, BooleanParam } from 'use-query-params';
import { FormattedMessage } from 'react-intl';
import Select from 'react-select';

import messages from './messages';
import { Button } from '../button';
Expand All @@ -13,6 +14,7 @@ import { ProjectFilterSelect } from './filterSelectFields';
import { PartnersFilterSelect } from './partnersFilterSelect';
import { CommaArrayParam } from '../../utils/CommaArrayParam';
import { formatFilterCountriesData } from '../../utils/countries';
import { IMAGERY_OPTIONS } from '../../hooks/UseImageryOption';

export const MoreFiltersForm = (props) => {
/* one useQueryParams for the main form */
Expand All @@ -27,6 +29,7 @@ export const MoreFiltersForm = (props) => {
organisation: orgInQuery,
location: countryInQuery,
interests: interestInQuery,
imagery: imageryInQuery,
} = formQuery;
const [campaignAPIState] = useTagAPI([], 'campaigns');
const [orgAPIState] = useTagAPI([], 'organisations');
Expand Down Expand Up @@ -131,6 +134,25 @@ export const MoreFiltersForm = (props) => {
/>
)}

<fieldset id="imageryFilter" className={`${fieldsetStyle} mb3`}>
<legend className={titleStyle}>
<FormattedMessage {...messages.imagery} />
</legend>
<Select
classNamePrefix="react-select"
isClearable={true}
options={IMAGERY_OPTIONS}
value={IMAGERY_OPTIONS.find((o) => o.value === imageryInQuery) || null}
placeholder={<FormattedMessage {...messages.selectImagery} />}
onChange={(option) =>
setFormQuery(
{ ...formQuery, page: undefined, imagery: option ? option.value : undefined },
'pushIn',
)
}
/>
</fieldset>

<div className="tr w-100 mt3 pb3 ph2">
<Link to="/explore">
<Button className="bg-white blue-dark mr1 f6 pv2">
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 @@ -45,6 +45,7 @@ const projectQueryAllSpecification = {
partnershipTo: StringParam,
downloadAsCSV: BooleanParam,
view: StringParam,
imagery: StringParam,
};

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

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