Commit fa60f8e2 authored by Nitin Jadhav's avatar Nitin Jadhav
Browse files

Merge branch 'feture/filters-preserve' into 'master'

added filter preservation functionality

See merge request !88
parents 07a700d3 7dea9af9
Pipeline #273910 passed with stages
in 4 minutes and 48 seconds
......@@ -4,7 +4,7 @@ import { Apply } from "components/apply/Apply";
import { Partners } from "components/content/Partners";
import { JobDetails } from "components/job-details/JobDetails";
import { Metadata } from "components/Metadata";
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import { ErrorPage404 } from "../component-templates/ErrorPages/ErrorPage404";
import EmailAlertRedirects from "../components/alerts/EmailAlertRedirects";
import { HrExcellenceInResearch } from "../components/content/HrExcellenceInResearch";
......@@ -32,11 +32,11 @@ export function App() {
<Router history={history} basename="jobs">
<Metadata />
<div className="vf-body">
<Switch>
<Route exact path="/" component={EMBLHome} />
<Route path={["/position/:jobRef"]} component={JobDetails} />
<Route path="/apply" component={Apply} />
<Route path="/partners" component={Partners} />
<Routes>
<Route path="/" element={<EMBLHome />} />
<Route path="/position/:jobRef" element={<JobDetails />} />
<Route path="/apply" element={<Apply />} />
<Route path="/partners" element={<Partners />} />
<Route
path="/alerts/alert-email/:jobRef"
......@@ -44,56 +44,56 @@ export function App() {
<EmailAlertRedirects jobId={match.params.jobRef} />
)}
/>
<Route path="/alerts" component={Alerts} />
<Route path="/alerts" element={<Alerts />} />
<Route path="/ebi/iframe" component={EBIHome} />
<Route path="/ebi/iframe" element={<EBIHome />} />
<Route
path="/hr-excellence-in-research"
component={HrExcellenceInResearch}
element={<HrExcellenceInResearch />}
/>
<Route path="/science4refugees" component={Science4Refugees} />
<Route path="/science4refugees" element={<Science4Refugees />} />
<Route
path="/work-at-embl/group-leader-recruitment"
component={GroupLeaderRecruitment}
element={<GroupLeaderRecruitment />}
/>
<Route exact path="/work-at-embl" component={WorkAtEmbl} />
<Route exact path="/work-at-embl" element={<WorkAtEmbl />} />
<Route
exact
path="/work-at-embl/conditions-employment"
component={ConditionsEmployment}
element={<ConditionsEmployment />}
/>
<Route
path="/work-at-embl/conditions-employment/family-life"
component={FamilyLife}
element={<FamilyLife />}
/>
<Route
path="/work-at-embl/conditions-employment/financial-support"
component={FinancialSupport}
element={<FinancialSupport />}
/>
<Route
path="/work-at-embl/conditions-employment/remuneration"
component={Remuneration}
element={<Remuneration />}
/>
<Route
path="/work-at-embl/conditions-employment/social-security"
component={SocialSecurity}
element={<SocialSecurity />}
/>
<Route
path="/work-at-embl/conditions-employment/training"
component={Training}
element={<Training />}
/>
<Route
path="/work-at-embl/conditions-employment/visa-requirements"
component={VisaRequirement}
element={<VisaRequirement />}
/>
<Route
path="/work-at-embl/conditions-employment/working-hours-leave"
component={WorkingHoursLeave}
element={<WorkingHoursLeave />}
/>
{/* default route */}
<Route path="*" component={ErrorPage404} />
</Switch>
<Route path="*" element={<ErrorPage404 />} />
</Routes>
</div>
</Router>
</AppContext.Provider>
......
import { useEffect, useState } from "react";
import { Redirect } from "react-router-dom";
import { Navigate } from "react-router-dom";
import { useFetchJobsList } from "../../services/useFetchJobsList";
import { VFLoaderBox } from "component-templates/VFLoader/VFLoader";
import { JobNotFound } from "components/job-details/JobDetails";
/* Raison d'être of this component is to redirect users that come from email alerts to actual job page */
export default function EmailAlertRedirects({ jobId }) {
/* Raison d'être of this component is to Navigate users that come from email alerts to actual job page */
export default function EmailAlertNavigates({ jobId }) {
const { filteredJobs, loading, error } = useFetchJobsList();
const [job, setJob] = useState();
useEffect(() => {
......@@ -16,7 +16,7 @@ export default function EmailAlertRedirects({ jobId }) {
}, [filteredJobs]);
if (job) {
return (
<Redirect
<Navigate
to={{
pathname: `/position/${job.field_jobs_reference_number}`,
state: { job },
......
......@@ -329,9 +329,9 @@ export function GroupLeaderRecruitment() {
</div>
</section>
{/* Group Leader recruitment
{/* Group Leader recruitment
<section
className="embl-grid embl-grid--has-centered-content"
id="group-leader-positions"
......@@ -357,7 +357,7 @@ export function GroupLeaderRecruitment() {
</a>
</h3>
<p className="vf-summary__text">
EMBL Barcelona is a research unit focusing on Tissue Biology and Disease Modelling. We aim to go beyond the molecular and cellular scale, integrating gene circuits with a quantitative understanding of tissues and organs, both healthy and diseased. Developing and using in vitro 3D tissue models, such...
EMBL Barcelona is a research unit focusing on Tissue Biology and Disease Modelling. We aim to go beyond the molecular and cellular scale, integrating gene circuits with a quantitative understanding of tissues and organs, both healthy and diseased. Developing and using in vitro 3D tissue models, such...
</p>
<p className="vf-summary__date">
{" "}
......@@ -371,7 +371,7 @@ export function GroupLeaderRecruitment() {
href="https://www.embl.org/jobs/position/BCN00063"
className="vf-summary__link"
>
Group Leader – Theoretical approaches to tissue biology and disease modelling
Group Leader – Theoretical approaches to tissue biology and disease modelling
</a>
</h3>
<p className="vf-summary__text">
......@@ -383,7 +383,7 @@ export function GroupLeaderRecruitment() {
</p>
</article>
</div>
<div className="vf-links vf-links--tight vf-links__list--s vf-links__list--very-easy">
......@@ -406,8 +406,8 @@ export function GroupLeaderRecruitment() {
Tissue Biology and Disease Modelling
</a>
</li>
<li className="vf-list__item">
<a
className="vf-list__link"
......@@ -420,8 +420,6 @@ export function GroupLeaderRecruitment() {
</div>
</section>
*/}
</EMBLContentTemplate>
);
}
import { VFSearchBox } from "component-templates/VFSearchBox";
import { JobListFilters } from "components/job-list-filters/JobListFilters";
import { JobList } from "components/job-list/JobList";
import { useState } from "react";
import { useFetchJobsList } from "services/useFetchJobsList";
import { useUrlFilters } from "../../helpers/useUrlFilters";
import "./Home.scss";
export const getInitialFilters = () => ({
selectedLocations: [],
selectedJobTypes: [],
selectedClosingDateSortDir: "DESC",
searchTerm: "",
});
export function Home({ showLocations = true, jobLocation, isIframe = false }) {
const [filters, setFilters] = useState(getInitialFilters());
const resetFilters = () => {
setFilters(getInitialFilters());
};
const { filters, setFilters, resetFilters } = useUrlFilters();
const {
filteredJobs: jobs,
......
import { useState, useEffect } from "react";
import { useSearchParams } from "react-router-dom";
const getInitialFilters = () => ({
selectedLocations: [],
selectedJobTypes: [],
selectedClosingDateSortDir: "DESC",
searchTerm: "",
});
export function useUrlFilters() {
const [searchParams, setSearchParams] = useSearchParams();
/* Init lazy loaded filters from url */
const [filters, setFilters] = useState(() => {
const {
selectedLocations,
selectedJobTypes,
selectedClosingDateSortDir,
searchTerm,
} = getInitialFilters();
return {
selectedLocations: searchParams.getAll("l") || selectedLocations,
selectedJobTypes: searchParams.getAll("t") || selectedJobTypes,
selectedClosingDateSortDir:
searchParams.get("sort") || selectedClosingDateSortDir,
searchTerm: searchParams.get("s") || searchTerm,
};
});
const resetFilters = () => {
setFilters(getInitialFilters());
};
useEffect(() => {
setSearchParams({
l: filters.selectedLocations || [],
t: filters.selectedJobTypes || [],
...(filters.searchTerm && { s: filters.searchTerm }),
...(filters.selectedClosingDateSortDir === "ASC" && {
sort: filters.selectedClosingDateSortDir,
}),
});
}, [filters]);
return { filters, setFilters, resetFilters };
}
......@@ -1255,13 +1255,20 @@
dependencies:
regenerator-runtime "^0.13.4"
 
"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4":
"@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4":
version "7.14.6"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.14.6.tgz#535203bc0892efc7dec60bdc27b2ecf6e409062d"
integrity sha512-/PCB2uJ7oM44tz8YhC4Z/6PeOKXp4K588f+5M3clr1M4zbqztlo0XEfJ2LEzj/FgwfgGcIdl8n7YYjTCI0BYwg==
dependencies:
regenerator-runtime "^0.13.4"
 
"@babel/runtime@^7.7.6":
version "7.17.2"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.17.2.tgz#66f68591605e59da47523c631416b18508779941"
integrity sha512-hzeyJyMA1YGdJTuWU0e/j4wKXrU4OMFvY2MSlaI9B7VQb0r5cxTE3EAIS2Q7Tn2RIcDkRvTA/v2JsAEhxe99uw==
dependencies:
regenerator-runtime "^0.13.4"
"@babel/template@^7.10.4", "@babel/template@^7.14.5", "@babel/template@^7.3.3":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.14.5.tgz#a9bc9d8b33354ff6e55a9c60d1109200a68974f4"
......@@ -8687,17 +8694,12 @@ highlight.js@^11.0.0:
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-11.0.1.tgz#a78bafccd9aa297978799fe5eed9beb7ee1ef887"
integrity sha512-EqYpWyTF2s8nMfttfBA2yLKPNoZCO33pLS4MnbXQ4hECf1TKujCt1Kq7QAdrio7roL4+CqsfjqwYj4tYgq0pJQ==
 
history@^4.9.0:
version "4.10.1"
resolved "https://registry.yarnpkg.com/history/-/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3"
integrity sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==
history@^5.2.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/history/-/history-5.3.0.tgz#1548abaa245ba47992f063a0783db91ef201c73b"
integrity sha512-ZqaKwjjrAYUYfLG+htGaIIZ4nioX2L70ZUMIFysS3xvBsSG4x/n1V6TXV3N8ZYNuFGlDirFg32T7B6WOUPDYcQ==
dependencies:
"@babel/runtime" "^7.1.2"
loose-envify "^1.2.0"
resolve-pathname "^3.0.0"
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"
value-equal "^1.0.1"
"@babel/runtime" "^7.7.6"
 
hmac-drbg@^1.0.1:
version "1.0.1"
......@@ -8708,13 +8710,6 @@ hmac-drbg@^1.0.1:
minimalistic-assert "^1.0.0"
minimalistic-crypto-utils "^1.0.1"
 
hoist-non-react-statics@^3.1.0:
version "3.3.2"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
dependencies:
react-is "^16.7.0"
homedir-polyfill@^1.0.1:
version "1.0.3"
resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8"
......@@ -11127,7 +11122,7 @@ longest-streak@^2.0.0, longest-streak@^2.0.1:
resolved "https://registry.yarnpkg.com/longest-streak/-/longest-streak-2.0.4.tgz#b8599957da5b5dab64dee3fe316fa774597d90e4"
integrity sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg==
 
loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1, loose-envify@^1.4.0:
loose-envify@^1.1.0, loose-envify@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
......@@ -11623,14 +11618,6 @@ min-indent@^1.0.0:
resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869"
integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==
 
mini-create-react-context@^0.4.0:
version "0.4.1"
resolved "https://registry.yarnpkg.com/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz#072171561bfdc922da08a60c2197a497cc2d1d5e"
integrity sha512-YWCYEmd5CQeHGSAKrYvXgmzzkrvssZcuuQDDeqkT+PziKGMgE+0MCCtcKbROzocGBG1meBLl2FotlRwf4gAzbQ==
dependencies:
"@babel/runtime" "^7.12.1"
tiny-warning "^1.0.3"
mini-css-extract-plugin@0.11.3:
version "0.11.3"
resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.11.3.tgz#15b0910a7f32e62ffde4a7430cfefbd700724ea6"
......@@ -12773,13 +12760,6 @@ path-to-regexp@0.1.7:
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c"
integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=
 
path-to-regexp@^1.7.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.8.0.tgz#887b3ba9d84393e87a0a0b9f4cb756198b53548a"
integrity sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==
dependencies:
isarray "0.0.1"
path-to-regexp@^6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-6.2.0.tgz#f7b3803336104c346889adece614669230645f38"
......@@ -14155,7 +14135,7 @@ prompts@^2.0.1:
kleur "^3.0.3"
sisteransi "^1.0.5"
 
prop-types@^15.6.2, prop-types@^15.7.2:
prop-types@^15.7.2:
version "15.7.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
......@@ -14456,7 +14436,7 @@ react-hook-form@7.9.0:
resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.9.0.tgz#0b5ed2f262a1e3cc64cfcf855f09a6e236d46ac3"
integrity sha512-1SazsTvsC5A4jLxc8fIf0bB92kEp4MGjP69k8s+2nI1spHPha5UkLwaebOXhO9vY95aGqcyBU67pRiv+6T5KZQ==
 
react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1:
react-is@^16.8.1:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
......@@ -14471,34 +14451,20 @@ react-refresh@^0.8.3:
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.8.3.tgz#721d4657672d400c5e3c75d063c4a85fb2d5d68f"
integrity sha512-X8jZHc7nCMjaCqoU+V2I0cOhNW+QMBwSUkeXnTi8IPe6zaRWfn60ZzvFDZqWPfmSJfjub7dDW1SP0jaHWLu/hg==
 
react-router-dom@5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.2.0.tgz#9e65a4d0c45e13289e66c7b17c7e175d0ea15662"
integrity sha512-gxAmfylo2QUjcwxI63RhQ5G85Qqt4voZpUXSEqCwykV0baaOTQDR1f0PmY8AELqIyVc0NEZUj0Gov5lNGcXgsA==
dependencies:
"@babel/runtime" "^7.1.2"
history "^4.9.0"
loose-envify "^1.3.1"
prop-types "^15.6.2"
react-router "5.2.0"
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"
react-router@5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.2.0.tgz#424e75641ca8747fbf76e5ecca69781aa37ea293"
integrity sha512-smz1DUuFHRKdcJC0jobGo8cVbhO3x50tCL4icacOlcwDOEQPq4TMqwx3sY1TP+DvtTgz4nm3thuo7A+BK2U0Dw==
dependencies:
"@babel/runtime" "^7.1.2"
history "^4.9.0"
hoist-non-react-statics "^3.1.0"
loose-envify "^1.3.1"
mini-create-react-context "^0.4.0"
path-to-regexp "^1.7.0"
prop-types "^15.6.2"
react-is "^16.6.0"
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"
react-router-dom@6.2.2:
version "6.2.2"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.2.2.tgz#f1a2c88365593c76b9612ae80154a13fcb72e442"
integrity sha512-AtYEsAST7bDD4dLSQHDnk/qxWLJdad5t1HFa1qJyUrCeGgEuCSw0VB/27ARbF9Fi/W5598ujvJOm3ujUCVzuYQ==
dependencies:
history "^5.2.0"
react-router "6.2.2"
react-router@6.2.2:
version "6.2.2"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.2.2.tgz#495e683a0c04461eeb3d705fe445d6cf42f0c249"
integrity sha512-/MbxyLzd7Q7amp4gDOGaYvXwhEojkJD5BtExkuKmj39VEE0m3l/zipf6h2WIB2jyAO0lI6NGETh4RDcktRm4AQ==
dependencies:
history "^5.2.0"
 
react-scripts@4.0.3:
version "4.0.3"
......@@ -15137,11 +15103,6 @@ resolve-options@^1.1.0:
dependencies:
value-or-function "^3.0.0"
 
resolve-pathname@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-3.0.0.tgz#99d02224d3cf263689becbb393bc560313025dcd"
integrity sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==
resolve-url-loader@^3.1.2:
version "3.1.4"
resolved "https://registry.yarnpkg.com/resolve-url-loader/-/resolve-url-loader-3.1.4.tgz#3c16caebe0b9faea9c7cc252fa49d2353c412320"
......@@ -17050,16 +17011,6 @@ timsort@^0.3.0:
resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4"
integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=
 
tiny-invariant@^1.0.2:
version "1.1.0"
resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.1.0.tgz#634c5f8efdc27714b7f386c35e6760991d230875"
integrity sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw==
tiny-warning@^1.0.0, tiny-warning@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754"
integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==
tmp@^0.0.33:
version "0.0.33"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
......@@ -17774,11 +17725,6 @@ validate-npm-package-license@^3.0.1:
spdx-correct "^3.0.0"
spdx-expression-parse "^3.0.0"
 
value-equal@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c"
integrity sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==
value-or-function@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/value-or-function/-/value-or-function-3.0.0.tgz#1c243a50b595c1be54a754bfece8563b9ff8d813"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment