From d22db76a8364a75d7d92258f604d106698bbeead Mon Sep 17 00:00:00 2001 From: wdog Date: Thu, 4 Apr 2024 18:41:38 +0200 Subject: [PATCH] Feature/result hascolor (#1347) Co-authored-by: Alex Justesen --- app/Enums/ResultStatus.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/Enums/ResultStatus.php b/app/Enums/ResultStatus.php index 448dd7237..9deb24443 100644 --- a/app/Enums/ResultStatus.php +++ b/app/Enums/ResultStatus.php @@ -2,9 +2,10 @@ namespace App\Enums; +use Filament\Support\Contracts\HasColor; use Filament\Support\Contracts\HasLabel; -enum ResultStatus: string implements HasLabel +enum ResultStatus: string implements HasColor, HasLabel { case Completed = 'completed'; // a speedtest that ran successfully. case Failed = 'failed'; // a speedtest that failed to run successfully. @@ -14,4 +15,13 @@ public function getLabel(): ?string { return $this->name; } + + public function getColor(): ?string + { + return match ($this) { + self::Completed => 'success', + self::Failed => 'danger', + self::Started => 'warning', + }; + } }