Skip to content

Commit bd2986c

Browse files
authored
Merge pull request #1487 from MTES-MCT/feature/add-competence-planification-to-landmodel
Ajouter compétence planification à LandModel et l'afficher dans la synthèse
2 parents 5608c6d + a64b642 commit bd2986c

File tree

12 files changed

+81
-40
lines changed

12 files changed

+81
-40
lines changed

frontend/scripts/components/layout/Dashboard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import RouteWrapper from '@components/ui/RouteWrapper';
2323
import ConsoCorrectionStatus, { ConsoCorrectionStatusEnum } from '@components/features/status/ConsoCorrectionStatus';
2424
import OcsgeStatus, { OcsgeStatusEnum } from '@components/features/status/OcsgeStatus';
2525
import LogementVacantStatus from '@components/features/status/LogementVacantStatus';
26-
import { LogementVacantStatusEnum } from '@services/types/land';
2726
import FricheStatus from '@components/features/status/FricheStatus';
2827

2928
interface DashboardProps {
@@ -233,6 +232,7 @@ const Dashboard: React.FC<DashboardProps> = ({ landType, landId, landSlug }) =>
233232
<RouteWrapper
234233
title="Téléchargements"
235234
landData={landData}
235+
showFeedback={false}
236236
>
237237
<Downloads landData={landData} />
238238
</RouteWrapper>
@@ -244,6 +244,7 @@ const Dashboard: React.FC<DashboardProps> = ({ landType, landId, landSlug }) =>
244244
<RouteWrapper
245245
title="Téléchargements"
246246
landData={landData}
247+
showFeedback={false}
247248
>
248249
<Downloads landData={landData} />
249250
</RouteWrapper>

frontend/scripts/components/pages/Artificialisation/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from "react";
2+
import Loader from "@components/ui/Loader";
23
import { LandDetailResultType } from "@services/types/land";
34
import Triptych from "@components/ui/Triptych";
45
import { TopBarContent } from "@components/layout/TopBarContent";
@@ -71,7 +72,7 @@ const ArtificialisationContent: React.FC = () => {
7172
const { isLoading, error, name, millesimes, isInterdepartemental } = useArtificialisationContext();
7273

7374
if (isLoading) {
74-
return <div role="status" aria-live="polite">Chargement...</div>;
75+
return <Loader wrap={true} />;
7576
}
7677

7778
if (error) {

frontend/scripts/components/pages/Downloads/editor/ContentZone.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useEffect, useCallback, useRef } from 'react';
2+
import Loader from '@components/ui/Loader';
23
import { useEditor, EditorContent } from '@tiptap/react';
34
import Document from '@tiptap/extension-document';
45
import Paragraph from '@tiptap/extension-paragraph';
@@ -218,7 +219,7 @@ const EditableContent: React.FC<{
218219
<Label className="fr-label">Commentaire</Label>
219220
</ZoneHeader>
220221
<EditorArea>
221-
<p style={{ color: 'var(--text-mention-grey)', fontStyle: 'italic' }}>Chargement...</p>
222+
<Loader size={32} />
222223
</EditorArea>
223224
</ZoneWrapper>
224225
);

frontend/scripts/components/pages/Downloads/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import Loader from '@components/ui/Loader';
23
import styled from 'styled-components';
34
import { LandDetailResultType } from '@services/types/land';
45
import { buildUrls } from '@utils/projectUrls';
@@ -145,8 +146,7 @@ const Downloads: React.FC<DownloadsProps> = ({ landData }) => {
145146

146147
{isDraftsLoading ? (
147148
<EmptyDrafts>
148-
<span className="fr-spinner fr-spinner--sm" aria-hidden="true" />
149-
Chargement...
149+
<Loader size={32} />
150150
</EmptyDrafts>
151151
) : drafts.length === 0 ? (
152152
<EmptyDrafts>

frontend/scripts/components/pages/Synthese/components/DiagnosticsHub.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const DIAGNOSTICS = [
4949
];
5050

5151
const Container = styled(BaseCard)`
52-
background: linear-gradient(135deg, ${theme.colors.primaryBg} 0%, white 100%);
52+
background: ${theme.colors.primaryBg};
5353
`;
5454

5555
const Title = styled.h4`

frontend/scripts/components/pages/Synthese/components/TerritoryIdentityCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ export const TerritoryIdentityCard = ({ landData, className }: TerritoryIdentity
122122
});
123123

124124
const population = populationData?.[0]?.population || null;
125-
const hasCompetenceUrba = true; // TODO: remove this once we have the competence urbanisme data
126-
125+
const hasCompetenceUrba = landData.competence_planification;
126+
console.log(landData.competence_planification)
127127
const identityItems = [
128128
{
129129
icon: "bi bi-geo-alt-fill",

frontend/scripts/components/ui/Feedback.tsx

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,44 @@ const starPop = keyframes`
3232
const Wrapper = styled(BaseCard)`
3333
display: flex;
3434
align-items: stretch;
35+
background: ${theme.colors.primaryBg};
3536
`;
3637

3738
const AnimationSide = styled.div`
3839
position: relative;
39-
width: 25%;
40-
min-width: 200px;
41-
background: linear-gradient(145deg, ${theme.colors.primary} 0%, ${theme.colors.primaryHover} 100%);
40+
flex: 0 0 220px;
41+
overflow: visible;
4242
4343
@media (max-width: 768px) {
4444
display: none;
4545
}
4646
`;
4747

48+
const AnimationBackground = styled.div`
49+
position: absolute;
50+
inset: 0;
51+
background: linear-gradient(145deg, ${theme.colors.primary} 0%, ${theme.colors.primaryHover} 100%);
52+
clip-path: ellipse(48% 40% at 26% 85%);
53+
z-index: 0;
54+
max-width: 300px;
55+
`;
56+
57+
const AnimationSideInner = styled.div`
58+
position: relative;
59+
width: 100%;
60+
height: 100%;
61+
display: flex;
62+
align-items: flex-end;
63+
justify-content: flex-start;
64+
z-index: 1;
65+
`;
66+
4867
const AnimationWrapper = styled.div`
4968
position: absolute;
50-
top: 50%;
51-
left: 50%;
52-
transform: translate(-50%, -50%);
53-
width: 60%;
69+
bottom: -7%;
70+
left: -5%;
71+
width: 115%;
72+
max-width: 300px;
5473
height: auto;
5574
filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.2));
5675
@@ -60,8 +79,7 @@ const AnimationWrapper = styled.div`
6079
`;
6180

6281
const ContentSide = styled.div`
63-
flex: 1;
64-
padding: 2vw 2vw 2vw 3vw;
82+
flex: 1 1 auto;
6583
display: flex;
6684
flex-direction: column;
6785
justify-content: center;
@@ -229,17 +247,20 @@ const Feedback: React.FC<FeedbackProps> = ({ context }) => {
229247
return (
230248
<Wrapper>
231249
<AnimationSide>
232-
<AnimationWrapper>
233-
<Lottie
234-
lottieRef={lottieRef}
235-
animationData={animation}
236-
loop={false}
237-
autoplay={false}
238-
style={{ width: '100%', height: '100%' }}
239-
/>
240-
</AnimationWrapper>
250+
<AnimationBackground />
251+
<AnimationSideInner>
252+
<AnimationWrapper>
253+
<Lottie
254+
lottieRef={lottieRef}
255+
animationData={animation}
256+
loop={false}
257+
autoplay={false}
258+
style={{ width: '100%', height: '100%' }}
259+
/>
260+
</AnimationWrapper>
261+
</AnimationSideInner>
241262
</AnimationSide>
242-
<ContentSide>
263+
<ContentSide className="fr-p-3w">
243264
{submitted ? (
244265
<>
245266
<Title>Votre avis a bien été envoyé !</Title>

frontend/scripts/components/ui/RouteWrapper.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
import React, { ReactNode, useEffect } from 'react';
22
import { useLocation } from 'react-router-dom';
3+
import styled from 'styled-components';
34
import usePageTitle from '@hooks/usePageTitle';
45
import Feedback, { FeedbackContext } from '@components/ui/Feedback';
56

7+
const PageLayout = styled.div`
8+
display: flex;
9+
flex-direction: column;
10+
flex: 1;
11+
`;
12+
13+
const PageContent = styled.div`
14+
flex: 1;
15+
min-height: calc(100vh - 280px);
16+
`;
17+
618
export interface FeedbackLandData {
719
land_type: string;
820
land_id: string;
@@ -47,15 +59,15 @@ const RouteWrapper: React.FC<RouteWrapperProps> = ({
4759

4860
if (!showTitle && !showStatus && showPage) {
4961
return (
50-
<>
51-
{children}
62+
<PageLayout>
63+
<PageContent>{children}</PageContent>
5264
{showFeedback && <Feedback context={feedbackContext} />}
53-
</>
65+
</PageLayout>
5466
);
5567
}
5668

5769
return (
58-
<>
70+
<PageLayout>
5971
<div className="fr-container--fluid fr-pt-3w fr-pl-3w fr-pr-3w fr-pb-1w">
6072
<div className="fr-grid-row">
6173
<div className="fr-col-12">
@@ -64,10 +76,9 @@ const RouteWrapper: React.FC<RouteWrapperProps> = ({
6476
</div>
6577
</div>
6678
</div>
67-
68-
{showPage && children}
79+
<PageContent>{showPage && children}</PageContent>
6980
{showFeedback && <div className="fr-p-3w"><Feedback context={feedbackContext} /></div>}
70-
</>
81+
</PageLayout>
7182
);
7283
};
7384

frontend/scripts/services/types/land.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ export type LandDetailResultType = {
179179
evolution_residences_secondaires_percent: number | null;
180180
evolution_residences_secondaires_absolute: number | null;
181181
densite_residences_secondaires: number | null;
182+
competence_planification: boolean;
182183
};
183184

184185
type LandDetailQueryArg = string | FetchArgs | {

project/charts/ObjectiveChart.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,11 @@ def series(self):
134134
reference_label = f"suggéré ({target_reference}%)"
135135
else:
136136
reference_label = f"réglementaire ({target_reference}%)"
137-
color_bar = "#A558A0" # Violet
138-
color_line = "#8B4789" # Violet foncé
139137
else:
140138
reference_label = "national (50%)"
141-
color_bar = "#b6c1ea" # Bleu
142-
color_line = "#8c9ace" # Bleu foncé
139+
140+
color_bar = "#bce3d5"
141+
color_line = "#059669"
143142

144143
series = [
145144
{
@@ -180,15 +179,15 @@ def series(self):
180179
"name": f"Consommation annualisée selon objectif personnalisé ({target_custom}%)",
181180
"yAxis": 1,
182181
"data": list(),
183-
"color": "#B6DFDE",
182+
"color": "#d8ccff", # Violet clair (purpleBorder)
184183
"zIndex": 1,
185184
},
186185
{
187186
"name": f"Consommation cumulée selon objectif personnalisé ({target_custom}%)",
188187
"data": list(),
189188
"type": "line",
190189
"dashStyle": "Dash",
191-
"color": "#98cecc",
190+
"color": "#4318FF", # Violet (purple)
192191
"zIndex": 4,
193192
},
194193
]

0 commit comments

Comments
 (0)