fix materialized view
This commit is contained in:
@@ -505,6 +505,11 @@ export function useDashboardData(siteId: number | null) {
|
|||||||
? slots[liveNowIndex]!.buy_price
|
? slots[liveNowIndex]!.buy_price
|
||||||
: null
|
: null
|
||||||
|
|
||||||
|
const sellNow =
|
||||||
|
slots.length && liveNowIndex >= 0 && liveNowIndex < slots.length
|
||||||
|
? slots[liveNowIndex]!.sell_price
|
||||||
|
: null
|
||||||
|
|
||||||
return {
|
return {
|
||||||
slots,
|
slots,
|
||||||
nowIndex: liveNowIndex,
|
nowIndex: liveNowIndex,
|
||||||
@@ -515,5 +520,6 @@ export function useDashboardData(siteId: number | null) {
|
|||||||
reload: load,
|
reload: load,
|
||||||
liveMetrics,
|
liveMetrics,
|
||||||
buyNow,
|
buyNow,
|
||||||
|
sellNow,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ export function Dashboard() {
|
|||||||
const monitoringHasError = monitoringAlerts.some((a) => a.level === 'error')
|
const monitoringHasError = monitoringAlerts.some((a) => a.level === 'error')
|
||||||
const hbOnline = site?.ems_heartbeat_status === 'ok'
|
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 lm = data.liveMetrics
|
||||||
|
|
||||||
const modeName = site?.active_mode ?? fullStatus?.operating_mode.mode_code ?? 'AUTO'
|
const modeName = site?.active_mode ?? fullStatus?.operating_mode.mode_code ?? 'AUTO'
|
||||||
@@ -190,7 +190,7 @@ export function Dashboard() {
|
|||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<section>
|
<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 ? (
|
{metricsLoading ? (
|
||||||
<>
|
<>
|
||||||
<MetricSkeleton />
|
<MetricSkeleton />
|
||||||
@@ -198,6 +198,7 @@ export function Dashboard() {
|
|||||||
<MetricSkeleton />
|
<MetricSkeleton />
|
||||||
<MetricSkeleton />
|
<MetricSkeleton />
|
||||||
<MetricSkeleton />
|
<MetricSkeleton />
|
||||||
|
<MetricSkeleton />
|
||||||
</>
|
</>
|
||||||
) : site == null ? (
|
) : site == null ? (
|
||||||
<p className="col-span-full text-sm text-slate-500">Žádná aktivní lokalita ve vw_site_status.</p>
|
<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>
|
||||||
<p className="mt-1 text-[10px] text-slate-500">Aktuální 15min slot</p>
|
<p className="mt-1 text-[10px] text-slate-500">Aktuální 15min slot</p>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user