Skip to content

Commit

Permalink
#69
Browse files Browse the repository at this point in the history
  • Loading branch information
jerem1508 committed Dec 11, 2024
1 parent fd2b2e3 commit 74519ba
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 59 deletions.
11 changes: 10 additions & 1 deletion client/src/pages/atlas/charts/trend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export default function TrendGraph({
color = "#000",
data = [],
}: TrendGraphProps) {
console.log("TrendGraph", data);

const options = {
chart: {
backgroundColor: "transparent",
Expand Down Expand Up @@ -38,9 +40,16 @@ export default function TrendGraph({
label: {
connectorAllowed: false,
},
pointStart: 2010,
pointStart: 2001,
},
},
tooltip: {
formatter: function () {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
return `Année universitaire <b>${this.x}-${parseInt(this.x.toString().substring(2))+1}</b><br/>=> <b>${this.y.toLocaleString()}</b> étudiants`;
}
},
colors: [color],
series: [
{
Expand Down
62 changes: 26 additions & 36 deletions client/src/pages/atlas/components/main/tabs/genders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,48 +185,38 @@ export function Genders() {
<Row gutters>
<Col>
<StudentsCardWithTrend
descriptionNode={
<Badge color="yellow-tournesol">{currentYear}</Badge>
}
number={
dataByYear?.find(
(el: DataByYear) =>
el.annee_universitaire === data?.annee_universitaire
)?.effectif_feminin || 0
}
label="Etudiantes inscrites"
trendGraph={
<TrendCard
color="#e18b76"
data={dataByYear.map(
(item: DataByYear) => item.effectif_feminin
)}
/>
}
descriptionNode={
<Badge color="yellow-tournesol">{currentYear}</Badge>
}
number={effectifF}
label={`Etudiante${effectifF > 1 ? "s" : ""} inscrite${effectifF > 1 ? "s" : ""}`}
trendGraph={
<TrendCard
color="#e18b76"
data={dataByYear.map(
(item: DataByYear) => item.effectif_feminin
)}
/>
}
/>
</Col>
</Row>
<Row gutters>
<Col>
<StudentsCardWithTrend
descriptionNode={
<Badge color="yellow-tournesol">{currentYear}</Badge>
}
number={
dataByYear?.find(
(el: DataByYear) =>
el.annee_universitaire === data?.annee_universitaire
)?.effectif_masculin || 0
}
label="Etudiants inscrits"
trendGraph={
<TrendCard
color="#efcb3a"
data={dataByYear.map(
(item: DataByYear) => item.effectif_masculin
)}
/>
}
descriptionNode={
<Badge color="yellow-tournesol">{currentYear}</Badge>
}
number={effectifM}
label={`Etudiant${effectifM > 1 ? "s" : ""} inscrit${effectifM > 1 ? "s" : ""}`}
trendGraph={
<TrendCard
color="#efcb3a"
data={dataByYear.map(
(item: DataByYear) => item.effectif_masculin
)}
/>
}
/>
</Col>
</Row>
Expand Down
15 changes: 8 additions & 7 deletions client/src/pages/atlas/components/main/tabs/general.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ export function General() {
}
};

console.log("dataByYear", dataByYear);


function MapSelector() {
if (
isLoadingPolygons ||
Expand Down Expand Up @@ -401,6 +404,8 @@ export function General() {
}
}

const nbStudents = dataByYear?.find((el: DataByYear) => el.annee_universitaire === currentYear)?.effectif_total || 0;

return (
<Container as="section" fluid>
<Row gutters>
Expand All @@ -409,16 +414,12 @@ export function General() {
descriptionNode={
<Badge color="yellow-tournesol">{currentYear}</Badge>
}
number={
dataByYear?.find(
(el: DataByYear) => el.annee_universitaire === currentYear
)?.effectif_total || 0
}
label="Etudiants inscrits"
number={nbStudents}
label={`Étudiant${nbStudents > 1 ? 's' : ''} inscrit${nbStudents > 1 ? 's' : ''}`}
trendGraph={
<TrendCard
color="#e18b76"
data={dataByYear?.map((item) => item.effectif_feminin)}
data={dataByYear?.map((item) => item.effectif_total)}
/>
}
/>
Expand Down
27 changes: 12 additions & 15 deletions client/src/pages/atlas/components/main/tabs/sectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,20 +173,17 @@ export function Sectors() {
<Row gutters>
<Col>
<StudentsCardWithTrend
descriptionNode={
<Badge color="yellow-tournesol">{currentYear}</Badge>
}
number={effectifPU}
label="Etudiants inscrits dans le secteur public"
trendGraph={
<TrendCard
color="#748CC0"
data={
dataByYear?.map((item: DataByYear) => item.effectif_pu) ||
[]
}
/>
}
descriptionNode={
<Badge color="yellow-tournesol">{currentYear}</Badge>
}
number={effectifPU}
label={`Etudiant${effectifPU > 1 ? 's' : ''} inscrit${effectifPU > 1 ? 's' : ''} dans le secteur public`}
trendGraph={
<TrendCard
color="#748CC0"
data={dataByYear?.map((item: DataByYear) => item.effectif_pu)}
/>
}
/>
</Col>
</Row>
Expand All @@ -197,7 +194,7 @@ export function Sectors() {
<Badge color="yellow-tournesol">{currentYear}</Badge>
}
number={effectifPR}
label="Etudiants inscrits dans le secteur privé"
label={`Etudiant${effectifPR > 1 ? 's' : ''} inscrit${effectifPR > 1 ? 's' : ''} dans le secteur privé`}
trendGraph={
<TrendCard
color="#755F4D"
Expand Down

0 comments on commit 74519ba

Please sign in to comment.