fix materialized view
This commit is contained in:
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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}
|
||||
|
||||
<section>
|
||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-5">
|
||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6">
|
||||
{metricsLoading ? (
|
||||
<>
|
||||
<MetricSkeleton />
|
||||
@@ -198,6 +198,7 @@ export function Dashboard() {
|
||||
<MetricSkeleton />
|
||||
<MetricSkeleton />
|
||||
<MetricSkeleton />
|
||||
<MetricSkeleton />
|
||||
</>
|
||||
) : site == null ? (
|
||||
<p className="col-span-full text-sm text-slate-500">Žádná aktivní lokalita ve vw_site_status.</p>
|
||||
@@ -233,6 +234,17 @@ export function Dashboard() {
|
||||
</p>
|
||||
<p className="mt-1 text-[10px] text-slate-500">Aktuální 15min slot</p>
|
||||
</div>
|
||||
<div className="rounded-xl border border-slate-800 border-l-4 border-l-teal-500/80 bg-slate-900/70 p-4 pl-3">
|
||||
<p className="text-[10px] font-semibold uppercase tracking-wide text-slate-500">Cena prodej</p>
|
||||
<p
|
||||
className={`mt-1 text-lg font-semibold tabular-nums ${
|
||||
data.sellNow != null && data.sellNow < 0 ? 'text-red-300' : 'text-teal-200'
|
||||
}`}
|
||||
>
|
||||
{fmtMoney3(data.sellNow)}
|
||||
</p>
|
||||
<p className="mt-1 text-[10px] text-slate-500">Aktuální 15min slot</p>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user