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
Branches
Tags
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> =
const toggleOpenModal = useCallback(() => {
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(() => {
let subscribed = true
......@@ -160,18 +178,7 @@ const ElecHalfHourMonthlyAnalysis: React.FC<ElecHalfHourMonthlyAnalysisProps> =
</div>
{!isLoading ? (
<>
{monthDataloads ? (
<ElecHalfHourChart
dataLoad={
isWeekend ? monthDataloads.weekend : monthDataloads.week
}
isWeekend={isWeekend}
/>
) : (
<p className={`text-20-bold no_data`}>
{t('analysis.no_data')}
</p>
)}
{getPowerChart()}
{enedisAnalysisValues && (
<div className="min-max">
<div className="container">
......@@ -215,7 +222,7 @@ const ElecHalfHourMonthlyAnalysis: React.FC<ElecHalfHourMonthlyAnalysisProps> =
<span className="text-18-normal"> %</span>
</div>
<div className="text-18-bold">
{elecPrice
{elecPrice && elecPrice.price
? (
enedisAnalysisValues.minimumLoad *
elecPrice.price
......
......@@ -557,9 +557,11 @@ exports[`ElecHalfHourMonthlyAnalysis component should be rendered correctly when
</ForwardRef(IconButton)>
</WithStyles(ForwardRef(IconButton))>
</div>
<mock-elechalfhourchart
isWeekend={true}
/>
<p
className="text-20-bold no_data"
>
analysis.no_data
</p>
<div
className="min-max"
>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment