Skip to content

Commit a8fbe31

Browse files
committed
fix(fundings): Rename "county" into "region"
1 parent 0f034d2 commit a8fbe31

17 files changed

Lines changed: 132 additions & 129 deletions

File tree

client/src/boards/financements-par-aap/charts/overview-by-structure/index.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { useQuery } from "@tanstack/react-query";
22
import { useSearchParams } from "react-router-dom";
3-
import "highcharts/es-modules/masters/modules/variwide.src.js";
43

54
import DefaultSkeleton from "../../../../components/charts-skeletons/default.tsx";
65
import { useChartColor } from "../../../../hooks/useChartColor.tsx";
@@ -72,7 +71,7 @@ export default function OverviewByStructure({ name }: { name: string | undefined
7271
comment: { "fr": <>Ce graphique met en regard le volume de projets et les financements perçus associés : la largeur des barres représente le nombre de projets, tandis que leur hauteur correspond au financement perçu. Le type de participation est distingué, en pointillé quand l'établissement est coordinateur, en couleur simple s'il est partenaire non-coordinateur. Le financement perçu approxime la part réelle allouée à chaque établissement partenaire d’un projet (en assimilant consommation et subvention pour le PIA). </> },
7372
id: "overviewByStructure",
7473
integrationURL: `/integration?chart_id=overviewByStructure&${searchParams.toString()}`,
75-
title: `Structure du financement : nombre de projets et financements perçus associés pour les projets auxquels participe l'établissement (${name}) ${getYearRangeLabel({ yearMax, yearMin })}`,
74+
title: `Structure du financement : nombre de projets et financements perçus associés pour les projets auxquels participe ${structure ? "l'établissement" : "la région"} (${name}) ${getYearRangeLabel({ yearMax, yearMin })}`,
7675
};
7776

7877
let hiddenPoints: string[] = [];
@@ -123,15 +122,15 @@ export default function OverviewByStructure({ name }: { name: string | undefined
123122
title: { text: "" },
124123
tooltip: {
125124
formatter: function (this: any) {
126-
return `<b>${formatCompactNumber(this.y)} €</b> financés pour <b>${this.z}</b> projets <b>${this.name}</b> auxquels participe <b>${name}</b> ${getYearRangeLabel({ isBold: true, yearMax, yearMin })}`;
125+
return `<b>${formatCompactNumber(this.y)} €</b> financés pour <b>${this.z}</b> projets <b>${this.name}</b> auxquels participe ${structure ? "l'établissement" : "la région"} <b>${name}</b> ${getYearRangeLabel({ isBold: true, yearMax, yearMin })}`;
127126
},
128127
},
129128
xAxis: {
130129
categories: undefined,
131130
title: { text: "Nombre de projets" },
132131
type: "category",
133132
},
134-
yAxis: { title: { text: getI18nLabel(i18n, 'funding_by_structure') } },
133+
yAxis: { title: { text: getI18nLabel(i18n, structure ? 'funding_by_structure' : 'funding_by_region') } },
135134
};
136135

137136
return (

client/src/boards/financements-par-aap/charts/projects-by-funder/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ const { VITE_APP_ES_INDEX_PARTICIPATIONS, VITE_APP_SERVER_URL } = import.meta.en
1717
export default function ProjectsByFunder({ name }: { name: string | undefined }) {
1818
const [searchParams] = useSearchParams()
1919
const [selectedControl, setSelectedControl] = useState("projects")
20-
const county = searchParams.get("region")
20+
const region = searchParams.get("region")
2121
const structure = searchParams.get("structure")
2222
const yearMax = searchParams.get("yearMax")
2323
const yearMin = searchParams.get("yearMin")
2424
const color = useChartColor()
2525

2626
const body = {
27-
...getEsQuery({ counties: [county], structures: [structure], yearMax, yearMin }),
27+
...getEsQuery({ regions: [region], structures: [structure], yearMax, yearMin }),
2828
aggregations: {
2929
by_project_type: {
3030
terms: {
@@ -68,7 +68,7 @@ export default function ProjectsByFunder({ name }: { name: string | undefined })
6868

6969

7070
const { data, isLoading } = useQuery({
71-
queryKey: ["fundings-projects-by-structure", county, structure, yearMax, yearMin],
71+
queryKey: ["fundings-projects-by-structure", region, structure, yearMax, yearMin],
7272
queryFn: () =>
7373
fetch(`${VITE_APP_SERVER_URL}/elasticsearch?index=${VITE_APP_ES_INDEX_PARTICIPATIONS}`, {
7474
body: JSON.stringify(body),
@@ -136,7 +136,7 @@ export default function ProjectsByFunder({ name }: { name: string | undefined })
136136
let stackLabel = function (this: any) {
137137
return `${this.total} projet${this.total > 1 ? 's' : ''}`;
138138
};
139-
let title = `Nombre de projets financés auxquels l'établissement (${name}) participe, réparti par financeur ${getYearRangeLabel({ yearMax, yearMin })}`;
139+
let title = `Nombre de projets financés auxquels ${structure ? "l'établissement" : "la région"} (${name}) participe, réparti par financeur ${getYearRangeLabel({ yearMax, yearMin })}`;
140140
let tooltip = function (this: any) {
141141
return `<b>${this.y}</b> projets <b>${this.series.name}</b> auxquels participe <b>${name}</b> ${getYearRangeLabel({ isBold: true, yearMax, yearMin })}, soit ${formatPercent(this.y_perc)} (${this.y} / ${this.total} )`;
142142
};

client/src/boards/financements-par-aap/components/cards/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ const { VITE_APP_ES_INDEX_PARTICIPATIONS, VITE_APP_SERVER_URL } = import.meta.en
1111

1212
export default function Cards() {
1313
const [searchParams] = useSearchParams()
14-
const county = searchParams.get("region")
14+
const region = searchParams.get("region")
1515
const structure = searchParams.get("structure")
1616
const yearMax = searchParams.get("yearMax")
1717
const yearMin = searchParams.get("yearMin")
1818

1919
const body = {
20-
...getEsQuery({ counties: [county], structures: [structure] }),
20+
...getEsQuery({ regions: [region], structures: [structure] }),
2121
aggregations: {
2222
by_project_type: {
2323
terms: {
@@ -61,7 +61,7 @@ export default function Cards() {
6161
};
6262

6363
const { data, isLoading } = useQuery({
64-
queryKey: ["funding-cards", structure, county],
64+
queryKey: ["funding-cards", structure, region],
6565
queryFn: () =>
6666
fetch(`${VITE_APP_SERVER_URL}/elasticsearch?index=${VITE_APP_ES_INDEX_PARTICIPATIONS}`, {
6767
body: JSON.stringify(body),

client/src/boards/financements-par-aap/components/layouts/global-layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export default function GlobalLayout() {
116116
target="_self"
117117
to={`/financements-par-aap/region?${searchParamsFiltered()}`}
118118
>
119-
{getI18nLabel(i18n, "county")}
119+
{getI18nLabel(i18n, "region")}
120120
</Link>
121121
</li>
122122
)}

client/src/boards/financements-par-aap/components/layouts/i18n.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
"cookies": {
1818
"fr": "Cookies"
1919
},
20-
"county": {
21-
"fr": "Vue par région"
22-
},
2320
"datasets": {
2421
"fr": "Jeux de données"
2522
},
@@ -38,6 +35,9 @@
3835
"personalData": {
3936
"fr": "Données personnelles"
4037
},
38+
"region": {
39+
"fr": "Vue par région"
40+
},
4141
"rightsReserved": {
4242
"fr": "Sauf mention explicite de propriété intellectuelle détenue par des tiers, les contenus de ce site sont proposés sous <a href='https://github.com/etalab/licence-ouverte/blob/master/LO.md' target='_blank' rel='noopener external' title='Voir la licence Etalab-2.0 dans une nouvelle fenêtre'>licence etalab-2.0</a>"
4343
},

client/src/boards/financements-par-aap/i18n.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"etablissement": {
1212
"fr": "Vue par structure - Financements par appels à projets - Tableaux"
1313
},
14+
"funding_by_region": {
15+
"fr": "Financement pour cette région (€)"
16+
},
1417
"funding_by_structure": {
1518
"fr": "Financement pour cet établissement (€)"
1619
},

client/src/boards/financements-par-aap/pages/comparison/components/structures-selector/index.tsx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ const { VITE_APP_ES_INDEX_PARTICIPATIONS, VITE_APP_SERVER_URL } = import.meta.en
1111

1212

1313
export default function StructuresSelector() {
14-
const [county, setCounty] = useState("*");
14+
const [region, setRegion] = useState("*");
1515
const [typology, setTypology] = useState("*");
1616
const [searchQuery, setSearchQuery] = useState("");
1717
const [searchParams, setSearchParams] = useSearchParams({});
1818
const selectedStructures: string[] = searchParams.getAll("structure");
1919

20-
const bodyCounties: any = {
20+
const bodyRegions: any = {
2121
...getEsQuery({}),
2222
aggregations: {
23-
by_county: {
23+
by_region: {
2424
terms: {
2525
field: "address.region.keyword",
2626
order: { _key: "asc" },
@@ -30,15 +30,15 @@ export default function StructuresSelector() {
3030
},
3131
};
3232
if (typology && typology !== '*') {
33-
bodyCounties.query.bool.filter.push({ term: { "participant_typologie_1.keyword": typology } });
33+
bodyRegions.query.bool.filter.push({ term: { "participant_typologie_1.keyword": typology } });
3434
}
35-
const { data: dataCounties, isLoading: isLoadingCounties } = useQuery({
36-
queryKey: ["fundings-counties", typology],
35+
const { data: dataRegions, isLoading: isLoadingRegions } = useQuery({
36+
queryKey: ["fundings-regions", typology],
3737
queryFn: () =>
3838
fetch(
3939
`${VITE_APP_SERVER_URL}/elasticsearch?index=${VITE_APP_ES_INDEX_PARTICIPATIONS}`,
4040
{
41-
body: JSON.stringify(bodyCounties),
41+
body: JSON.stringify(bodyRegions),
4242
headers: {
4343
"Access-Control-Allow-Origin": "*",
4444
"Content-Type": "application/json",
@@ -47,7 +47,7 @@ export default function StructuresSelector() {
4747
}
4848
).then((response) => response.json()),
4949
});
50-
const counties = (dataCounties?.aggregations?.by_county?.buckets ?? []).map((bucket) => bucket.key);
50+
const regions = (dataRegions?.aggregations?.by_region?.buckets ?? []).map((bucket) => bucket.key);
5151

5252
const bodyTypologies: any = {
5353
...getEsQuery({}),
@@ -60,11 +60,11 @@ export default function StructuresSelector() {
6060
},
6161
},
6262
};
63-
if (county && county !== '*') {
64-
bodyTypologies.query.bool.filter.push({ term: { "address.region.keyword": county } });
63+
if (region && region !== '*') {
64+
bodyTypologies.query.bool.filter.push({ term: { "address.region.keyword": region } });
6565
}
6666
const { data: dataTypologies, isLoading: isLoadingTypologies } = useQuery({
67-
queryKey: ["fundings-typologies", county],
67+
queryKey: ["fundings-typologies", region],
6868
queryFn: () =>
6969
fetch(
7070
`${VITE_APP_SERVER_URL}/elasticsearch?index=${VITE_APP_ES_INDEX_PARTICIPATIONS}`,
@@ -113,14 +113,14 @@ export default function StructuresSelector() {
113113
return structureInfo;
114114
}) || [];
115115

116-
if (county && county !== '*') {
117-
bodyStructures.query.bool.filter.push({ wildcard: { "address.region.keyword": county } });
116+
if (region && region !== '*') {
117+
bodyStructures.query.bool.filter.push({ wildcard: { "address.region.keyword": region } });
118118
}
119119
if (typology && typology !== '*') {
120120
bodyStructures.query.bool.filter.push({ term: { "participant_typologie_1.keyword": typology } });
121121
}
122122
const { data: dataStructures, isLoading: isLoadingStructures } = useQuery({
123-
queryKey: ["fundings-structures", county, typology],
123+
queryKey: ["fundings-structures", region, typology],
124124
queryFn: () =>
125125
fetch(
126126
`${VITE_APP_SERVER_URL}/elasticsearch?index=${VITE_APP_ES_INDEX_PARTICIPATIONS}`,
@@ -166,27 +166,27 @@ export default function StructuresSelector() {
166166
<>
167167
<Row gutters className="fr-grid-row--middle">
168168
<Col xs="12" sm="3">
169-
{isLoadingCounties ? <DefaultSkeleton height="40px" /> : (
169+
{isLoadingRegions ? <DefaultSkeleton height="40px" /> : (
170170
<Select
171-
label={county === "*" ? <>Région <Badge className="fr-ml-1v" size="sm" >{counties.length}</Badge></> : county}
171+
label={region === "*" ? <>Région <Badge className="fr-ml-1v" size="sm" >{regions.length}</Badge></> : region}
172172
icon="map-pin-2-line"
173173
size="sm"
174174
fullWidth
175175
aria-label="Filtrer par région"
176176
>
177177
<Select.Option
178178
value="*"
179-
selected={county === "*"}
180-
onClick={() => setCounty("*")}
179+
selected={region === "*"}
180+
onClick={() => setRegion("*")}
181181
>
182182
Toutes les régions
183183
</Select.Option>
184-
{counties.map((c: string) => (
184+
{regions.map((c: string) => (
185185
<Select.Option
186186
key={c}
187187
value={c}
188-
selected={county === c}
189-
onClick={() => setCounty(c)}
188+
selected={region === c}
189+
onClick={() => setRegion(c)}
190190
>
191191
{c}
192192
</Select.Option>

client/src/boards/financements-par-aap/pages/county/displayCounty.tsx renamed to client/src/boards/financements-par-aap/pages/region/displayRegion.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Breadcrumb from "../../components/breadcrumb";
77
import { years } from "../../utils";
88
// import ClassificationsByStructure from "./charts/classifications-by-structure";
99
// import Classifications2ByStructure from "./charts/classifications2-by-structure";
10-
// import CountiesByStructure from "./charts/counties-by-structure";
10+
// import RegionsByStructure from "./charts/regions-by-structure";
1111
// import FrenchPartnersByStructure from "./charts/french-partners-by-structure";
1212
// import InstrumentsForAnr from "./charts/instruments-for-anr";
1313
// import InstrumentsForEurope from "./charts/instruments-for-europe";
@@ -23,11 +23,11 @@ import Cards from "../../components/cards";
2323

2424
import "./styles.scss";
2525

26-
export default function DisplayCounty() {
26+
export default function DisplayRegion() {
2727
const [searchParams, setSearchParams] = useSearchParams();
2828
const navigate = useNavigate();
2929
const section = searchParams.get("section");
30-
const county = searchParams.get("region") ?? '';
30+
const region = searchParams.get("region") ?? '';
3131
const yearMax = searchParams.get("yearMax") ?? String(years[years.length - 2]);
3232
const yearMin = searchParams.get("yearMin") ?? String(years[years.length - 2]);
3333
const [isOpen, setIsOpen] = useState(false);
@@ -68,14 +68,14 @@ export default function DisplayCounty() {
6868
<Breadcrumb items={[
6969
{ href: "/financements-par-aap/accueil", label: "Financements par AAP" },
7070
{ href: "/financements-par-aap/region", label: "Vue par région" },
71-
{ label: county }
71+
{ label: region }
7272
]} />
7373
</Col>
7474
</Row>
7575
<Row gutters className="fr-grid-row--middle fr-mb-2w">
7676
<Col xs="12" md="6">
7777
<Title as="h1" className="fr-mb-1v" look="h4">
78-
{county}
78+
{region}
7979
</Title>
8080
</Col>
8181
<Col xs="12" md="6" style={{ display: "flex", flexDirection: "column", alignItems: "flex-end", gap: "0.5rem" }}>
@@ -182,12 +182,12 @@ export default function DisplayCounty() {
182182
<>
183183
<Row gutters style={{ clear: "both" }}>
184184
<Col>
185-
<ProjectsByFunder name={county} />
185+
<ProjectsByFunder name={region} />
186186
</Col>
187187
</Row>
188188
<Row gutters>
189189
<Col>
190-
<OverviewByStructure name={county} />
190+
<OverviewByStructure name={region} />
191191
</Col>
192192
</Row>
193193
</>
@@ -273,7 +273,7 @@ export default function DisplayCounty() {
273273
<>
274274
<Row gutters style={{ clear: "both" }}>
275275
<Col>
276-
<CountiesByStructure name={name} />
276+
<RegionsByStructure name={name} />
277277
</Col>
278278
</Row>
279279
</>

0 commit comments

Comments
 (0)