diff --git a/frontend/src/components/Dashboard/ForecastWidget.tsx b/frontend/src/components/Dashboard/ForecastWidget.tsx index 62b8baa..c58fa5a 100644 --- a/frontend/src/components/Dashboard/ForecastWidget.tsx +++ b/frontend/src/components/Dashboard/ForecastWidget.tsx @@ -1,6 +1,80 @@ +import { useLiveValue } from "@/components/Flow/liveStore" +import { cn } from "@/lib/utils" +import { ICON_COLORS, ICONS } from "./icons" import type { WidgetProps } from "./widgets" -/** A forecast — a stub until the forecast widget is written. */ -export function ForecastWidget(_props: WidgetProps) { - return
—
+/** One column of a forecast, as the `list` message declares it. */ +type ForecastItem = { + label?: string + icon?: string + value?: string | number + color?: string +} + +const config = (widget: WidgetProps["widget"]) => + (widget.config ?? {}) as RecordPick a message.
+ } + + const count = Number(cfg.count) + const items: ForecastItem[] = (Array.isArray(live?.value) ? live.value : []) + .filter((item): item is ForecastItem => !!item && typeof item === "object") + .slice(0, Number.isFinite(count) ? count : 5) + + if (items.length === 0) { + returnNothing forecast.
+ } + + return ( +