Skip to content

Commit

Permalink
Display message if there is no gpu data
Browse files Browse the repository at this point in the history
  • Loading branch information
smdsgn committed Sep 20, 2024
1 parent e18221f commit ab66020
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
17 changes: 16 additions & 1 deletion assets/scripts/components/layout/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import Trajectoires from '@components/pages/Trajectoires';
import RapportLocal from '@components/pages/RapportLocal';
import Update from '@components/pages/Update';
import OcsgeStatus from '@components/widgets/OcsgeStatus';
import GpuStatus from '@components/widgets/GpuStatus';

interface DashboardProps {
projectId: string;
Expand Down Expand Up @@ -88,7 +89,21 @@ const Dashboard: React.FC<DashboardProps> = ({ projectId }) => {
/>
<Route
path="/project/:projectId/tableau-de-bord/zonages-d-urbanisme"
element={data.ocsge_coverage_status === "COMPLETE_UNIFORM" ? <Gpu /> : <OcsgeStatus status={data.ocsge_coverage_status} />}
element={
<>
{data.ocsge_coverage_status === "COMPLETE_UNIFORM" && data.has_zonage_urbanisme && (
<Gpu />
)}
{(data.ocsge_coverage_status !== "COMPLETE_UNIFORM" || !data.has_zonage_urbanisme) && (
<>
{data.ocsge_coverage_status !== "COMPLETE_UNIFORM" && (
<OcsgeStatus status={data.ocsge_coverage_status} />
)}
{!data.has_zonage_urbanisme && <GpuStatus />}
</>
)}
</>
}
/>
<Route
path="/project/:projectId/tableau-de-bord/rapport-local"
Expand Down
28 changes: 28 additions & 0 deletions assets/scripts/components/widgets/GpuStatus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import styled from 'styled-components';

const NoticeContainer = styled.div`
margin: 2rem 1rem;
`;

const NoticeBody = styled.div`
flex-direction: column;
display: flex;
gap: 0.5rem;
`;


const GpuStatus: React.FC = () => {
return (
<NoticeContainer className="fr-notice fr-notice--info">
<div className="fr-container">
<NoticeBody className="fr-notice__body">
<p className="fr-notice__title">Données de zonages d'urbanisme non disponibles.</p>
<p className="fr-notice__desc fr-text--sm">Les données de zonages d'urbanisme issus du GPU (Géoportail de l'Urbanisme) ne sont pas disponibles sur ce territoire.</p>
</NoticeBody>
</div>
</NoticeContainer>
);
};

export default GpuStatus;
8 changes: 1 addition & 7 deletions project/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@ class Meta:
"analyse_start_date",
"analyse_end_date",
"territory_name",
"area",
"target_2031",
"get_bilan_conso_time_scoped",
"theme_map_conso",
"theme_map_artif",
"theme_map_understand_artif",
"theme_map_gpu",
"ocsge_coverage_status",
"has_zonage_urbanisme",
]


Expand Down

0 comments on commit ab66020

Please sign in to comment.