# `MishkaDocumentWeb.Live.Admin.Dashboard.Home.StatsLive`
[🔗](https://github.com/mishka-group/mishka_document/blob/v0.0.1/lib/mishka_document_web/live/admin/dashboard/home/stats_live.ex#L5)

The row of figures across the top of the Documents dashboard, each read through Ash as the admin
looking at it — a master across every site, a site admin on their own:

  * **Total Documents** — the documents (`MishkaDocument.Workspace`), and how many were added in
    the last seven days;
  * **Contributors** — the accounts the event log (`MishkaDocument.EventLog`) has writing a
    document, a version, a page, a note or a draft of either, and how many did in the last day;
  * **Completion** — the share of pages (`MishkaDocument.Section`) both their reviews approve;
  * **Last Updated** — when a document or a page was last changed.

A figure is drawn only when its records are the admin's to read: Completion needs the section
area, and Last Updated reads the pages only for an admin holding it.

A live component of its own because it has its own reads: they run after the page is drawn
(`assign_async`), so a slow count never holds the dashboard, and each figure is a `card/1`.
Sending it `refresh: true` reads them again, keeping the figures shown until the new ones arrive.

    <.live_component module={StatsLive} id="document-stats" current_user={@current_user} />

# `card`

One figure: its icon and label, the figure, and a line under it.
## Attributes

* `id` (`:string`) (required)
* `label` (`:string`) (required)
* `icon` (`:string`) (required)
* `tone` (`:string`) (required)
* `value` (`:string`) (required)
* `note` (`:string`) (required)
* `note_tone` (`:string`) (required)

# `cards`

```elixir
@spec cards(MishkaCmsCore.Accounts.User.t()) :: [map()]
```

The figures `user` may read, in the order they are drawn, each as `card/1` takes it.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
