Skip to content

Commit

Permalink
add ep link
Browse files Browse the repository at this point in the history
  • Loading branch information
jerem1508 committed Feb 23, 2024
1 parent 72cf3f7 commit a295962
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import "../styles.scss";
export default function Horizon2020Participation() {
const [searchParams] = useSearchParams();
const params = [...searchParams].map(([key, value]) => `${key}=${value}`).join('&');
const iso2 = searchParams.get('country_code') || 'FR';

const { data, isLoading } = useQuery({
queryKey: ["european-projects", params],
Expand Down Expand Up @@ -49,7 +50,7 @@ export default function Horizon2020Participation() {
<figure>
<HighchartsReact
highcharts={Highcharts}
options={options(data["funding_programme"].filter((item) => item.country_code === 'FR'))}
options={options(data["funding_programme"].filter((item) => item.country_code === iso2))}
/>
</figure>
<div className="graph-footer">
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/european-projects/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ export default function EuropeanProjectsRoutes() {
</Route>
</Routes>
);
}
}
7 changes: 7 additions & 0 deletions client/src/pages/home-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ export default function HomePage() {
title="Atlas des effecifs étudiants"
to="/atlas" />
</Col>
<Col md={4}>
<GenericCard
description="Projets europeens"
image={<img className="fr-responsive-img" src={atlasImg} alt="" />}
title="Projets europeens"
to="/european-projects" />
</Col>
</Row>
</Container>
<footer className="fr-footer fr-mt-5w" role="contentinfo" id="footer">
Expand Down
20 changes: 20 additions & 0 deletions client/src/pages/integration/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { useSearchParams } from "react-router-dom";
import Template from "./template";

export default function Integration() {
const [searchParams] = useSearchParams();
// const params = [...searchParams].map(([key, value]) => `${key}=${value}`).join('&');
const iso2 = searchParams.get('country_code') || 'FR';
const chartId = searchParams.get('chart_id') || null;
const theme = searchParams.get('theme') || 'light';

document.documentElement.setAttribute('data-fr-theme', theme);

if (!chartId) return <Template />;

return (
<>
graph {iso2}
</>
);
}
9 changes: 9 additions & 0 deletions client/src/pages/integration/template.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default function Template() {
return (
<>
Aucun graph séléctionné
<br />
Lien de retuour ...
</>
);
}
2 changes: 2 additions & 0 deletions client/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import HomePage from './pages/home-page.tsx';
import { Layout } from './layout/Layout.tsx';
import AtlasRoutes from './pages/atlas/routes.tsx';
import EuropeanProjectsRoutes from './pages/european-projects/routes.tsx';
import Integration from './pages/integration/index.tsx';

export default function Router() {
return (
Expand All @@ -14,6 +15,7 @@ export default function Router() {
<Route path="/open-alex/*" element={<div>Open Alex tab</div>} />
<Route path="/european-projects/*" element={<EuropeanProjectsRoutes />} />
</Route>
<Route path="/integration" element={<Integration />} />
<Route path="*" element={<div>404 atlas</div>} />
</Routes>
);
Expand Down

0 comments on commit a295962

Please sign in to comment.