mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-19 23:24:46 +02:00

* fix websocket error always displaying * use livewire component with polling for alert banner container * add id to alert banner * cleanup blade file and add "closeable" property
36 lines
778 B
PHP
36 lines
778 B
PHP
<?php
|
|
|
|
namespace App\Livewire;
|
|
|
|
use Illuminate\Contracts\View\View;
|
|
use Livewire\Component;
|
|
|
|
class AlertBannerContainer extends Component
|
|
{
|
|
public array $alertBanners;
|
|
|
|
public function mount(): void
|
|
{
|
|
$this->alertBanners = [];
|
|
$this->pullFromSession();
|
|
}
|
|
|
|
public function pullFromSession(): void
|
|
{
|
|
foreach (session()->pull('alert-banners', []) as $alertBanner) {
|
|
$alertBanner = AlertBanner::fromLivewire($alertBanner);
|
|
$this->alertBanners[$alertBanner->getId()] = $alertBanner;
|
|
}
|
|
}
|
|
|
|
public function remove(string $id): void
|
|
{
|
|
unset($this->alertBanners[$id]);
|
|
}
|
|
|
|
public function render(): View
|
|
{
|
|
return view('livewire.alerts.alert-banner-container');
|
|
}
|
|
}
|