feat: admin dashboard widgets

This commit is contained in:
Björn Fromme
2026-08-25 16:31:45 +02:00
parent 578a21d327
commit 4e6aaba9ff
17 changed files with 808 additions and 6 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace App\Model;
/**
* One card on the admin dashboard, as its provider assembled it.
*
* Every widget has the same shape so the dashboard can render a list it knows nothing about.
* The action link is optional and lands in the card's header — typically "show the full list
* this widget is an excerpt of".
*/
final readonly class DashboardWidget
{
/**
* @param DashboardWidgetEntry[] $entries
*/
public function __construct(
public string $title,
public array $entries,
public string $emptyText = 'Keine Einträge vorhanden.',
public ?string $actionUrl = null,
public ?string $actionLabel = null,
) {
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace App\Model;
/**
* One line in a dashboard widget: a label, optionally where it leads, and an optional icon.
*
* The url is generated by the widget provider rather than built in the template, so a provider
* is free to link anywhere without the dashboard learning its routes. Leaving it out makes the
* line display-only — a widget that reports rather than navigates.
*/
final readonly class DashboardWidgetEntry
{
public function __construct(
public string $label,
public ?string $url = null,
public ?string $icon = null,
) {
}
}