-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(email-sender): fix url, add a graph, and tag for productions
- Loading branch information
Showing
10 changed files
with
107 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import Highcharts from "highcharts"; | ||
import HighchartsReact from "highcharts-react-official"; | ||
import useGetContributionData from "../../api/contribution-api/useGetObjectContributeData"; | ||
import { Contribute_Production } from "../../types"; | ||
import { productionUrl } from "../../config/api"; | ||
|
||
const ContributionsGraphByStatus = () => { | ||
const { data, isLoading, isError } = useGetContributionData(productionUrl, 0); | ||
const contributions = (data as { data: Contribute_Production[] })?.data; | ||
|
||
if (isLoading) { | ||
return <div>Chargement...</div>; | ||
} | ||
|
||
if (isError) { | ||
return <div>Une erreur s'est produite</div>; | ||
} | ||
|
||
if (!Array.isArray(contributions)) { | ||
return <div>Les données ne sont pas disponibles</div>; | ||
} | ||
|
||
const newCount = contributions.filter( | ||
(contribution) => contribution.status === "new" | ||
).length; | ||
const ongoingCount = contributions.filter( | ||
(contribution) => contribution.status === "ongoing" | ||
).length; | ||
const treatedCount = contributions.filter( | ||
(contribution) => contribution.status === "treated" | ||
).length; | ||
|
||
const chartData = [ | ||
{ name: "New", y: newCount }, | ||
{ name: "Ongoing", y: ongoingCount }, | ||
{ name: "Treated", y: treatedCount }, | ||
]; | ||
|
||
const options = { | ||
chart: { | ||
type: "column", | ||
}, | ||
title: { | ||
text: "Nombre de demande d'affiliation par statut", | ||
}, | ||
xAxis: { | ||
type: "category", | ||
}, | ||
yAxis: { | ||
title: { | ||
text: "Nombre de contributions", | ||
}, | ||
}, | ||
series: [ | ||
{ | ||
name: "Statut", | ||
data: chartData, | ||
}, | ||
], | ||
}; | ||
|
||
return <HighchartsReact highcharts={Highcharts} options={options} />; | ||
}; | ||
|
||
export default ContributionsGraphByStatus; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters