From b8b3de2b704d79a4353ab58860ca7e69a6bc3f09 Mon Sep 17 00:00:00 2001 From: Dusan Vojacek Date: Fri, 10 Apr 2026 20:56:42 +0200 Subject: [PATCH] fix materialized view --- frontend/src/hooks/useDashboardData.ts | 6 ++++++ frontend/src/pages/Dashboard.tsx | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/frontend/src/hooks/useDashboardData.ts b/frontend/src/hooks/useDashboardData.ts index cb33d1b..25c0cf6 100644 --- a/frontend/src/hooks/useDashboardData.ts +++ b/frontend/src/hooks/useDashboardData.ts @@ -505,6 +505,11 @@ export function useDashboardData(siteId: number | null) { ? slots[liveNowIndex]!.buy_price : null + const sellNow = + slots.length && liveNowIndex >= 0 && liveNowIndex < slots.length + ? slots[liveNowIndex]!.sell_price + : null + return { slots, nowIndex: liveNowIndex, @@ -515,5 +520,6 @@ export function useDashboardData(siteId: number | null) { reload: load, liveMetrics, buyNow, + sellNow, } } diff --git a/frontend/src/pages/Dashboard.tsx b/frontend/src/pages/Dashboard.tsx index aea2b11..85e14fd 100644 --- a/frontend/src/pages/Dashboard.tsx +++ b/frontend/src/pages/Dashboard.tsx @@ -99,7 +99,7 @@ export function Dashboard() { const monitoringHasError = monitoringAlerts.some((a) => a.level === 'error') const hbOnline = site?.ems_heartbeat_status === 'ok' - /** Horní karty (FVE, síť, SoC, cena): liveMetrics z useDashboardData (5s poll / WS), ne siteRow. */ + /** Horní karty (FVE, spotřeba, síť, SoC, ceny): liveMetrics + buyNow/sellNow z useDashboardData (5s poll / WS). */ const lm = data.liveMetrics const modeName = site?.active_mode ?? fullStatus?.operating_mode.mode_code ?? 'AUTO' @@ -190,7 +190,7 @@ export function Dashboard() { ) : null}
-
+
{metricsLoading ? ( <> @@ -198,6 +198,7 @@ export function Dashboard() { + ) : site == null ? (

Žádná aktivní lokalita ve vw_site_status.

@@ -233,6 +234,17 @@ export function Dashboard() {

Aktuální 15min slot

+
+

Cena prodej

+

+ {fmtMoney3(data.sellNow)} +

+

Aktuální 15min slot

+
)}