Analytics overview
A store dashboard with a date range header, four KPI cards with deltas and trends, a revenue chart compared with the previous period, a channel breakdown, top products, and recent activity.
bunx --bun @getweini/cli@latest add avatar button card empty-state link skeleton tabsCustomize
- The header carries the reporting period and the page actions. The block emits `dateRange`, `share`, `export` and `rangeChange` (the chart tab); all actions are disabled while `loading`.
- Pass `kpis` as `{ label, value, previous, change, direction, tone, series }`. `tone` sets the meaning of the change (a falling conversion rate is negative), `previous` fills the "from" context, and the trend under each value is inline SVG from `series`.
- Pass one entry per range in `data`: a tab `label`, a `caption`, the `change`, `points` of `{ label, value }`, an optional `previous` series drawn dashed, and an optional `event` marker such as a sale. The total, axis, labels and readout all derive from it.
- The chart is hand-written SVG with no chart package. Only the hovered or latest day shows a marker. Hovering anywhere on the plot picks the nearest day; for the keyboard, Tab reaches one day stop and Left, Right, Home and End move between days. Time keeps left-to-right order in RTL.
- `channels` drive the stacked share bar and list (colors are `chart-1` to `chart-4`), and product shares are computed against the channel total, so every figure on the page agrees.
- Use `loading` for skeletons and empty `kpis`, `points`, `channels`, `products` or `activity` for the empty messages. Money is formatted with `locale` and `currency`; all other text is in `copy`.