discourse/spec/system/admin_dashboard_redesign
Alan Guo Xiang Tan 87e695fc53
FEATURE: Add site traffic dashboard section (#40023)
Makes the redesigned dashboard Site traffic section real for the core
traffic summary.

- In scope: live pageview headline, comparison trend, logged-in share
KPI, and stacked traffic chart.
- Out of scope: top referrers, top countries, and narrative traffic
insights. Those remain placeholder UI for a follow-up.
- Reuses the existing report stacked chart for both the dashboard
section and `/admin/reports/site_traffic`.
- Extends the existing site traffic report data contract instead of
introducing a dashboard-only chart shape.
- Keeps traffic aggregation, KPI calculation, and trend eligibility on
the backend.
- Supports dashboard preset and custom date ranges with inclusive date
windows.
- Ships traffic data in this section payload shape:

```json
{
  "id": "traffic",
  "data": {
    "kpis": {
      "browser_pageviews": {
        "value": 30,
        "percent_change": 900,
        "comparison_period": {
          "start_date": "2026-04-28",
          "end_date": "2026-04-30"
        }
      },
      "logged_in_share": {
        "value": 33
      }
    },
    "pageview_series": [
      {
        "req": "page_view_logged_in_browser",
        "label": "Logged in",
        "color": "#4B3CE0",
        "data": [
          { "x": "2026-05-01", "y": 10 }
        ]
      }
    ]
  }
}
```
2026-05-19 14:08:21 +08:00
..
site_traffic_section_spec.rb