From 6e83baa8f1a8a4e66d458117c816ba6d09b908a0 Mon Sep 17 00:00:00 2001 From: Baspa Date: Fri, 30 Aug 2024 12:26:16 +0000 Subject: [PATCH] Fix styling --- src/FilamentMailsPlugin.php | 17 ++++++----- src/Resources/EventResource.php | 6 ++-- .../EventResource/Pages/ListEvents.php | 3 -- src/Resources/MailResource.php | 28 +++++++++---------- src/Widgets/BouncerateWidget.php | 4 +-- 5 files changed, 25 insertions(+), 33 deletions(-) diff --git a/src/FilamentMailsPlugin.php b/src/FilamentMailsPlugin.php index c2af818..cfaf287 100644 --- a/src/FilamentMailsPlugin.php +++ b/src/FilamentMailsPlugin.php @@ -2,14 +2,13 @@ namespace Vormkracht10\FilamentMails; -use Filament\Panel; use Filament\Contracts\Plugin; use Filament\Facades\Filament; -use Filament\Support\Colors\Color; use Filament\Navigation\NavigationItem; -use Vormkracht10\FilamentMails\Resources\MailResource; +use Filament\Panel; +use Filament\Support\Colors\Color; use Vormkracht10\FilamentMails\Resources\EventResource; -use Vormkracht10\FilamentMails\Widgets\BouncerateWidget; +use Vormkracht10\FilamentMails\Resources\MailResource; class FilamentMailsPlugin implements Plugin { @@ -35,16 +34,16 @@ public function boot(Panel $panel): void NavigationItem::make() ->group(__('Mails')) ->label('Mails') - ->url(fn(): string => MailResource::getUrl('index')) + ->url(fn (): string => MailResource::getUrl('index')) ->icon('heroicon-o-envelope') - ->isActiveWhen(fn(): bool => request()->routeIs('filament.' . $panel->getId() . '.resources.mails.*')) + ->isActiveWhen(fn (): bool => request()->routeIs('filament.' . $panel->getId() . '.resources.mails.*')) ->childItems([ NavigationItem::make() ->label('Events') - ->url(fn(): string => EventResource::getUrl('index')) + ->url(fn (): string => EventResource::getUrl('index')) ->icon('heroicon-o-calendar') - ->isActiveWhen(fn(): bool => request()->routeIs('filament.' . $panel->getId() . '.resources.events.*')) - ]) + ->isActiveWhen(fn (): bool => request()->routeIs('filament.' . $panel->getId() . '.resources.events.*')), + ]), ]); }); } diff --git a/src/Resources/EventResource.php b/src/Resources/EventResource.php index 3eeb820..ad7bf95 100644 --- a/src/Resources/EventResource.php +++ b/src/Resources/EventResource.php @@ -2,12 +2,10 @@ namespace Vormkracht10\FilamentMails\Resources; -use Filament\Tables; -use Filament\Tables\Table; use Filament\Infolists\Infolist; use Filament\Resources\Resource; -use Filament\Resources\Pages\Page; -use Vormkracht10\FilamentMails\Resources\MailResource\Pages\ListMails; +use Filament\Tables; +use Filament\Tables\Table; use Vormkracht10\FilamentMails\Resources\EventResource\Pages\ListEvents; use Vormkracht10\Mails\Models\MailEvent; diff --git a/src/Resources/EventResource/Pages/ListEvents.php b/src/Resources/EventResource/Pages/ListEvents.php index b9f67ad..29d9f3a 100644 --- a/src/Resources/EventResource/Pages/ListEvents.php +++ b/src/Resources/EventResource/Pages/ListEvents.php @@ -4,10 +4,7 @@ use Filament\Resources\Components\Tab; use Filament\Resources\Pages\ListRecords; -use Illuminate\Database\Eloquent\Builder; -use Vormkracht10\FilamentMails\Models\Mail; use Vormkracht10\FilamentMails\Resources\EventResource; -use Vormkracht10\FilamentMails\Widgets\BouncerateWidget; use Vormkracht10\Mails\Models\MailEvent; class ListEvents extends ListRecords diff --git a/src/Resources/MailResource.php b/src/Resources/MailResource.php index b77bf09..ce9eb45 100644 --- a/src/Resources/MailResource.php +++ b/src/Resources/MailResource.php @@ -2,19 +2,17 @@ namespace Vormkracht10\FilamentMails\Resources; -use Filament\Tables; -use Filament\Tables\Table; -use Filament\Infolists\Infolist; -use Filament\Resources\Resource; -use Filament\Resources\Pages\Page; use Filament\Infolists\Components\Grid; -use Filament\Infolists\Components\Tabs; use Filament\Infolists\Components\Section; +use Filament\Infolists\Components\Tabs; use Filament\Infolists\Components\Tabs\Tab; -use Vormkracht10\FilamentMails\Models\Mail; use Filament\Infolists\Components\TextEntry; +use Filament\Infolists\Infolist; +use Filament\Resources\Resource; +use Filament\Tables; +use Filament\Tables\Table; +use Vormkracht10\FilamentMails\Models\Mail; use Vormkracht10\FilamentMails\Resources\MailResource\Pages\ListMails; -use Vormkracht10\FilamentMails\Resources\MailResource\Pages\ListEvents; class MailResource extends Resource { @@ -62,22 +60,22 @@ public static function infolist(Infolist $infolist): Infolist ->label(__('Subject')), TextEntry::make('from') ->label(__('From')) - ->formatStateUsing(fn($state) => self::formatEmailAddress($state)), + ->formatStateUsing(fn ($state) => self::formatEmailAddress($state)), TextEntry::make('to') ->label(__('Recipient')) - ->formatStateUsing(fn($state) => self::formatEmailAddress($state)), + ->formatStateUsing(fn ($state) => self::formatEmailAddress($state)), TextEntry::make('cc') ->label(__('CC')) ->default('-') - ->formatStateUsing(fn($state) => self::formatEmailAddress($state)), + ->formatStateUsing(fn ($state) => self::formatEmailAddress($state)), TextEntry::make('bcc') ->label(__('BCC')) ->default('-') - ->formatStateUsing(fn($state) => self::formatEmailAddress($state)), + ->formatStateUsing(fn ($state) => self::formatEmailAddress($state)), TextEntry::make('reply_to') ->default('-') ->label(__('Reply To')) - ->formatStateUsing(fn($state) => self::formatEmailAddress($state)), + ->formatStateUsing(fn ($state) => self::formatEmailAddress($state)), ]), ]), Section::make('Content') @@ -167,7 +165,7 @@ public static function table(Table $table): Table ->label(__('Status')) ->sortable() ->badge() - ->color(fn(string $state): string => match ($state) { + ->color(fn (string $state): string => match ($state) { 'Hard Bounced' => 'danger', 'Soft Bounced' => 'warning', 'Complained' => 'danger', @@ -186,7 +184,7 @@ public static function table(Table $table): Table ->searchable(), Tables\Columns\TextColumn::make('to') ->label(__('Recipient')) - ->formatStateUsing(fn($state) => self::formatEmailAddressForTable($state)) + ->formatStateUsing(fn ($state) => self::formatEmailAddressForTable($state)) ->sortable() ->searchable(), Tables\Columns\TextColumn::make('sent_at') diff --git a/src/Widgets/BouncerateWidget.php b/src/Widgets/BouncerateWidget.php index ba4134d..ea7b306 100644 --- a/src/Widgets/BouncerateWidget.php +++ b/src/Widgets/BouncerateWidget.php @@ -12,7 +12,7 @@ class BouncerateWidget extends BaseWidget protected function getStats(): array { - $bouncedMails = Mail::where(fn($query) => $query->softBounced()->orWhere(fn($query) => $query->hardBounced()))->count(); + $bouncedMails = Mail::where(fn ($query) => $query->softBounced()->orWhere(fn ($query) => $query->hardBounced()))->count(); $openedMails = Mail::opened()->count(); $deliveredMails = Mail::delivered()->count(); $clickedMails = Mail::clicked()->count(); @@ -43,4 +43,4 @@ protected function getStats(): array return $widgets; } -} \ No newline at end of file +}