| 1 |
/** |
| 2 |
* WPSubscription dashboard. |
| 3 |
* |
| 4 |
* A small React screen built on @wordpress/components, so it looks like |
| 5 |
* WordPress rather than like a second design system bolted into wp-admin. |
| 6 |
* |
| 7 |
* Everything shown is preloaded on `window.subscrptDashboard` by |
| 8 |
* Admin\Dashboard::enqueue() — none of these figures change while the page is |
| 9 |
* open, so there is nothing to fetch. |
| 10 |
* |
| 11 |
* The stylesheet lives in src/css/ because webpack.config.js prepends |
| 12 |
* `@import "colors"` to every .scss outside that directory, which fails to |
| 13 |
* resolve for anything that does not want the colour partial. |
| 14 |
* |
| 15 |
* TODO(refactor): migrate this dashboard off @wordpress/components and onto our |
| 16 |
* own admin components (the `wpsubs-*` system in assets/css/admin-components/ — |
| 17 |
* Card/CardHeader/CardBody -> `wpsubs-table-card`, Button -> `wpsubs-btn`, etc.) |
| 18 |
* so the whole admin uses one consistent design system instead of two. Applies |
| 19 |
* to every @wordpress/components import in this folder (App, HealthBanner, |
| 20 |
* SetupChecklist). |
| 21 |
*/ |
| 22 |
|
| 23 |
import { createRoot } from "@wordpress/element"; |
| 24 |
import App from "./App"; |
| 25 |
import "../css/dashboard.scss"; |
| 26 |
|
| 27 |
const node = document.getElementById("subscrpt-dashboard"); |
| 28 |
|
| 29 |
if (node && window.subscrptDashboard) { |
| 30 |
createRoot(node).render(<App data={window.subscrptDashboard} />); |
| 31 |
} |
| 32 |
|