From 7098aac259661b58162f8e01848afbc525d81af4 Mon Sep 17 00:00:00 2001 From: braddf Date: Wed, 4 Sep 2024 16:51:16 +0100 Subject: [PATCH] Refactor all 4hr refs to N Hour --- .../components/charts/ChartLegend.tsx | 14 +++---- .../charts/DataLoadingChartStatus.tsx | 12 +++--- .../charts/delta-view/delta-view-chart.tsx | 19 ++++------ .../charts/gsp-pv-remix-chart/index.tsx | 7 ++-- .../gsp-pv-remix-chart/use-get-gsp-data.ts | 13 +++---- .../components/charts/pv-remix-chart.tsx | 8 ++-- .../components/charts/remix-line.tsx | 38 +++++++++---------- .../solar-site-view/solar-site-chart.tsx | 18 --------- .../charts/use-format-chart-data-sites.tsx | 8 ++-- .../charts/use-format-chart-data.tsx | 8 ++-- .../components/helpers/globalState.tsx | 11 +++--- .../components/helpers/utils.ts | 14 +++---- .../components/hooks/useLoadDataFromApi.tsx | 4 +- .../layout/header/profile-dropdown.tsx | 6 +-- .../components/map/deltaMap.tsx | 2 +- apps/nowcasting-app/components/types.d.ts | 10 ++--- apps/nowcasting-app/constant.ts | 2 +- .../nowcasting-app/cypress/e2e/pvLatest.cy.js | 6 +-- apps/nowcasting-app/package.json | 2 +- apps/nowcasting-app/pages/index.tsx | 33 ++++++++-------- 20 files changed, 103 insertions(+), 132 deletions(-) diff --git a/apps/nowcasting-app/components/charts/ChartLegend.tsx b/apps/nowcasting-app/components/charts/ChartLegend.tsx index 81756c11..aad4cad8 100644 --- a/apps/nowcasting-app/components/charts/ChartLegend.tsx +++ b/apps/nowcasting-app/components/charts/ChartLegend.tsx @@ -3,18 +3,16 @@ import { ChartInfo } from "../../ChartInfo"; import { InfoIcon, LegendLineGraphIcon } from "../icons/icons"; import { FC, useEffect } from "react"; import useGlobalState from "../helpers/globalState"; -import { getRounded4HoursAgoString } from "../helpers/utils"; import LegendItem from "./LegendItem"; -import { NHR_FORECAST_OPTIONS } from "../../constant"; +import { N_HOUR_FORECAST_OPTIONS } from "../../constant"; type ChartLegendProps = { className?: string; }; export const ChartLegend: FC = ({ className }) => { - const [showNhrView] = useGlobalState("show4hView"); + const [showNHourView] = useGlobalState("showNHourView"); const [nHourForecast, setNHourForecast] = useGlobalState("nHourForecast"); - const fourHoursAgo = getRounded4HoursAgoString(); const legendItemContainerClasses = `flex flex-initial flex-col @sm:gap-1 @6xl:gap-6 @6xl:flex-row ${ className ? ` ${className}` : "" }`; @@ -49,12 +47,12 @@ export const ChartLegend: FC = ({ className }) => { {/* label={"OCF Final Forecast"}*/} {/* dataKey={`PAST_FORECAST`}*/} {/*/>*/} - {showNhrView && ( + {showNHourView && ( )} @@ -67,9 +65,9 @@ export const ChartLegend: FC = ({ className }) => { onChange={(e) => setNHourForecast(Number(e.target.value))} className="text-sm px-2 py-0 rounded-md" > - {NHR_FORECAST_OPTIONS.map((option) => ( + {N_HOUR_FORECAST_OPTIONS.map((option) => (