mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-19 22:14:45 +02:00

* add alert banner * replace old server conflict banner with alert banner * improve color and icon size * add alert for websocket errors * update file loading error to alert banner * remove old events * add back `console-status` event * move @php block under @isset * remove phpstan ignore so I'm not getting force choked
42 lines
889 B
PHP
42 lines
889 B
PHP
<?php
|
|
|
|
namespace App\Livewire;
|
|
|
|
use Filament\Notifications\Concerns;
|
|
use Filament\Support\Concerns\EvaluatesClosures;
|
|
use Illuminate\Contracts\Support\Arrayable;
|
|
|
|
final class AlertBanner implements Arrayable
|
|
{
|
|
use Concerns\HasBody;
|
|
use Concerns\HasIcon;
|
|
use Concerns\HasStatus;
|
|
use Concerns\HasTitle;
|
|
use EvaluatesClosures;
|
|
|
|
public static function make(): static
|
|
{
|
|
return new self();
|
|
}
|
|
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'title' => $this->getTitle(),
|
|
'body' => $this->getBody(),
|
|
'status' => $this->getStatus(),
|
|
'icon' => $this->getIcon(),
|
|
];
|
|
}
|
|
|
|
public function send(): static
|
|
{
|
|
$alerts = session()->get('alert-banners', []);
|
|
$alerts[] = $this->toArray();
|
|
|
|
session()->flash('alert-banners', $alerts);
|
|
|
|
return $this;
|
|
}
|
|
}
|