Skip to content
Snippets Groups Projects
Commit d45e4f39 authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

fix(analysis): Fix navigation issue in monthly analysis

parent 9b4c8ec8
3 merge requests!683chore(release): 1.10.0,!681Draft: Dev,!604Resolve "[Analyse] La navigation dans le passé sur la page analyse fait crash l'app"
...@@ -63,6 +63,24 @@ const ElecHalfHourMonthlyAnalysis: React.FC<ElecHalfHourMonthlyAnalysisProps> = ...@@ -63,6 +63,24 @@ const ElecHalfHourMonthlyAnalysis: React.FC<ElecHalfHourMonthlyAnalysisProps> =
const toggleOpenModal = useCallback(() => { const toggleOpenModal = useCallback(() => {
setOpenInfoModal(prev => !prev) setOpenInfoModal(prev => !prev)
}, []) }, [])
const getPowerChart = useCallback((): JSX.Element => {
if (
monthDataloads &&
monthDataloads.weekend &&
monthDataloads.week &&
monthDataloads.weekend[0] !== null &&
monthDataloads.week[0] !== null
) {
return (
<ElecHalfHourChart
dataLoad={isWeekend ? monthDataloads.weekend : monthDataloads.week}
isWeekend={isWeekend}
/>
)
} else {
return <p className={`text-20-bold no_data`}>{t('analysis.no_data')}</p>
}
}, [isWeekend, monthDataloads, t])
useEffect(() => { useEffect(() => {
let subscribed = true let subscribed = true
...@@ -160,18 +178,7 @@ const ElecHalfHourMonthlyAnalysis: React.FC<ElecHalfHourMonthlyAnalysisProps> = ...@@ -160,18 +178,7 @@ const ElecHalfHourMonthlyAnalysis: React.FC<ElecHalfHourMonthlyAnalysisProps> =
</div> </div>
{!isLoading ? ( {!isLoading ? (
<> <>
{monthDataloads ? ( {getPowerChart()}
<ElecHalfHourChart
dataLoad={
isWeekend ? monthDataloads.weekend : monthDataloads.week
}
isWeekend={isWeekend}
/>
) : (
<p className={`text-20-bold no_data`}>
{t('analysis.no_data')}
</p>
)}
{enedisAnalysisValues && ( {enedisAnalysisValues && (
<div className="min-max"> <div className="min-max">
<div className="container"> <div className="container">
...@@ -215,7 +222,7 @@ const ElecHalfHourMonthlyAnalysis: React.FC<ElecHalfHourMonthlyAnalysisProps> = ...@@ -215,7 +222,7 @@ const ElecHalfHourMonthlyAnalysis: React.FC<ElecHalfHourMonthlyAnalysisProps> =
<span className="text-18-normal"> %</span> <span className="text-18-normal"> %</span>
</div> </div>
<div className="text-18-bold"> <div className="text-18-bold">
{elecPrice {elecPrice && elecPrice.price
? ( ? (
enedisAnalysisValues.minimumLoad * enedisAnalysisValues.minimumLoad *
elecPrice.price elecPrice.price
......
...@@ -557,9 +557,11 @@ exports[`ElecHalfHourMonthlyAnalysis component should be rendered correctly when ...@@ -557,9 +557,11 @@ exports[`ElecHalfHourMonthlyAnalysis component should be rendered correctly when
</ForwardRef(IconButton)> </ForwardRef(IconButton)>
</WithStyles(ForwardRef(IconButton))> </WithStyles(ForwardRef(IconButton))>
</div> </div>
<mock-elechalfhourchart <p
isWeekend={true} className="text-20-bold no_data"
/> >
analysis.no_data
</p>
<div <div
className="min-max" className="min-max"
> >
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment