Let a dashboard be read against runs instead of the live engine
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { useState } from "react"
|
||||
|
||||
import type { WidgetDef } from "@/client"
|
||||
import { useLiveValue } from "@/components/Flow/liveStore"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { BarWidget } from "./BarWidget"
|
||||
import { ChartWidget } from "./ChartWidget"
|
||||
import { ClockWidget } from "./ClockWidget"
|
||||
import { ColorWidget } from "./ColorWidget"
|
||||
import { useBoundValue } from "./dataContext"
|
||||
// The grid's own rules live beside the components that use them; CSS is
|
||||
// chunked per entry, so the sheet is pulled in wherever a widget is drawn.
|
||||
import "./dashboard.css"
|
||||
@@ -197,7 +197,7 @@ function StatWidget({ widget }: WidgetProps) {
|
||||
const { Readout } = useUi()
|
||||
const cfg = config(widget)
|
||||
const message = text(cfg.message)
|
||||
const live = useLiveValue(message || undefined)
|
||||
const live = useBoundValue(message || undefined)
|
||||
if (!message) return <Unbound />
|
||||
|
||||
return (
|
||||
@@ -219,7 +219,7 @@ function GaugeWidget({ widget }: WidgetProps) {
|
||||
const { Gauge } = useUi()
|
||||
const cfg = config(widget)
|
||||
const message = text(cfg.message)
|
||||
const live = useLiveValue(message || undefined)
|
||||
const live = useBoundValue(message || undefined)
|
||||
if (!message) return <Unbound />
|
||||
|
||||
return (
|
||||
@@ -304,7 +304,7 @@ function dayLabel(when: Date, now: Date): string {
|
||||
function AgendaWidget({ widget }: WidgetProps) {
|
||||
const cfg = config(widget)
|
||||
const message = text(cfg.message)
|
||||
const live = useLiveValue(message || undefined)
|
||||
const live = useBoundValue(message || undefined)
|
||||
if (!message) return <Unbound />
|
||||
|
||||
const now = new Date()
|
||||
@@ -360,7 +360,7 @@ function AgendaWidget({ widget }: WidgetProps) {
|
||||
function NotificationWidget({ widget }: WidgetProps) {
|
||||
const cfg = config(widget)
|
||||
const message = text(cfg.message)
|
||||
const live = useLiveValue(message || undefined)
|
||||
const live = useBoundValue(message || undefined)
|
||||
if (!message) return <Unbound />
|
||||
|
||||
const record = (live?.value ?? null) as Record<string, unknown> | null
|
||||
|
||||
Reference in New Issue
Block a user