diff --git a/app/Config/App.php b/app/Config/App.php index 6aaeccae..d574e3b6 100644 --- a/app/Config/App.php +++ b/app/Config/App.php @@ -457,5 +457,10 @@ class App extends BaseConfig */ public ?int $storageLimit = null; + /** + * Bandwidth limit (per month) in Gigabytes + */ + public ?int $bandwidthLimit = null; + public ?string $legalNoticeURL = null; } diff --git a/app/Views/Components/Charts/ChartsComponent.php b/app/Views/Components/Charts/ChartsComponent.php index 8dbd5bfc..a4c4a575 100644 --- a/app/Views/Components/Charts/ChartsComponent.php +++ b/app/Views/Components/Charts/ChartsComponent.php @@ -10,15 +10,23 @@ class ChartsComponent extends Component { protected string $title = ''; + protected string $subtitle = ''; + protected string $dataUrl = ''; protected string $type = ''; public function render(): string { + $subtitleBlock = ''; + if ($this->subtitle !== '') { + $subtitleBlock = '

' . $this->subtitle . '

'; + } + return <<

{$this->title}

+ {$subtitleBlock}
HTML; diff --git a/modules/Admin/Controllers/DashboardController.php b/modules/Admin/Controllers/DashboardController.php index 94cb7e8b..ffef90d9 100644 --- a/modules/Admin/Controllers/DashboardController.php +++ b/modules/Admin/Controllers/DashboardController.php @@ -70,10 +70,14 @@ class DashboardController extends BaseController ->id; } + $bandwidthLimit = config('App') + ->bandwidthLimit; + $data = [ 'podcastsData' => $podcastsData, 'episodesData' => $episodesData, 'storageData' => $storageData, + 'bandwidthLimit' => $bandwidthLimit === null ? null : formatBytes($bandwidthLimit * 1000000000), 'onlyPodcastId' => $onlyPodcastId, ]; diff --git a/modules/Admin/Language/en/Charts.php b/modules/Admin/Language/en/Charts.php index 4b33530e..6ede2510 100644 --- a/modules/Admin/Language/en/Charts.php +++ b/modules/Admin/Language/en/Charts.php @@ -37,4 +37,5 @@ return [ 'podcast_by_bandwidth' => 'Daily used bandwidth (in MB)', 'total_storage_by_month' => 'Monthly storage (in MB)', 'total_bandwidth_by_month' => 'Monthly used bandwidth (in MB)', + 'total_bandwidth_by_month_limit' => 'Limited to {totalBandwidth} per month', ]; diff --git a/themes/cp_admin/dashboard.php b/themes/cp_admin/dashboard.php index c47fa597..6de5d9ce 100644 --- a/themes/cp_admin/dashboard.php +++ b/themes/cp_admin/dashboard.php @@ -30,7 +30,9 @@ 'Podcast', 'TotalStorageByMonth', ) ?>" /> -