From 0feec19b6183a36d864cc02e9fe2413e5b768c3a Mon Sep 17 00:00:00 2001 From: Baspa Date: Fri, 6 Sep 2024 12:55:46 +0000 Subject: [PATCH] Fix styling --- src/Resources/EventResource.php | 16 +++++++------- src/Resources/MailResource.php | 38 ++++++++++++++++----------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/Resources/EventResource.php b/src/Resources/EventResource.php index ce8554d..b690717 100644 --- a/src/Resources/EventResource.php +++ b/src/Resources/EventResource.php @@ -69,7 +69,7 @@ public static function infolist(Infolist $infolist): Infolist TextEntry::make('type') ->label(__('Type')) ->badge() - ->color(fn(WebhookEventType $state): string => match ($state) { + ->color(fn (WebhookEventType $state): string => match ($state) { WebhookEventType::DELIVERY => 'success', WebhookEventType::CLICK => 'clicked', WebhookEventType::OPEN => 'success', @@ -114,7 +114,7 @@ public static function infolist(Infolist $infolist): Infolist ->default(__('Unknown')) ->label(__('User Agent')) ->limit(50) - ->tooltip(fn($state) => $state), + ->tooltip(fn ($state) => $state), ]), ]), Section::make(__('Location')) @@ -141,7 +141,7 @@ public static function infolist(Infolist $infolist): Infolist ->default(__('Unknown')) ->label(__('Link')) ->limit(50) - ->url(fn($state) => $state) + ->url(fn ($state) => $state) ->openUrlInNewTab(), TextEntry::make('tag') ->default(__('Unknown')) @@ -160,7 +160,7 @@ public static function infolist(Infolist $infolist): Infolist ->label(__('Metadata')) ->formatStateUsing(function ($state) { if ( - !is_object($state) || !property_exists($state, 'Metadata') || empty($state->Metadata) + ! is_object($state) || ! property_exists($state, 'Metadata') || empty($state->Metadata) ) { return __('No metadata available'); } @@ -190,7 +190,7 @@ public static function table(Table $table): Table ->label(__('Type')) ->sortable() ->badge() - ->color(fn(WebhookEventType $state): string => match ($state) { + ->color(fn (WebhookEventType $state): string => match ($state) { WebhookEventType::DELIVERY => 'success', WebhookEventType::CLICK => 'clicked', WebhookEventType::OPEN => 'success', @@ -203,14 +203,14 @@ public static function table(Table $table): Table }) ->searchable(), Tables\Columns\TextColumn::make('mail.subject') - ->url(fn(MailEvent $record) => route('filament.' . filament()->getCurrentPanel()?->getId() . '.resources.mails.view', $record->mail)) + ->url(fn (MailEvent $record) => route('filament.' . filament()->getCurrentPanel()?->getId() . '.resources.mails.view', $record->mail)) ->label(__('Subject')) ->searchable(), Tables\Columns\TextColumn::make('occurred_at') ->label(__('Occurred At')) ->dateTime('d-m-Y H:i') ->since() - ->tooltip(fn(MailEvent $record) => $record->occurred_at?->format('d-m-Y H:i')) + ->tooltip(fn (MailEvent $record) => $record->occurred_at?->format('d-m-Y H:i')) ->sortable() ->searchable(), ]) @@ -238,4 +238,4 @@ public static function getPages(): array 'view' => ViewEvent::route('/{record}/view'), ]; } -} \ No newline at end of file +} diff --git a/src/Resources/MailResource.php b/src/Resources/MailResource.php index 0d0b0e4..67c8356 100644 --- a/src/Resources/MailResource.php +++ b/src/Resources/MailResource.php @@ -81,22 +81,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)), ]), ]), Tab::make(__('Statistics')) @@ -149,8 +149,8 @@ public static function infolist(Infolist $infolist): Infolist TextEntry::make('type') ->label(__('Type')) ->badge() - ->url(fn(MailEvent $record) => route('filament.' . filament()->getCurrentPanel()?->getId() . '.resources.mails.events.view', $record)) - ->color(fn(WebhookEventType $state): string => match ($state) { + ->url(fn (MailEvent $record) => route('filament.' . filament()->getCurrentPanel()?->getId() . '.resources.mails.events.view', $record)) + ->color(fn (WebhookEventType $state): string => match ($state) { WebhookEventType::DELIVERY => 'success', WebhookEventType::CLICK => 'clicked', WebhookEventType::OPEN => 'success', @@ -162,7 +162,7 @@ public static function infolist(Infolist $infolist): Infolist return ucfirst($state->value); }), TextEntry::make('occurred_at') - ->url(fn(MailEvent $record) => route('filament.' . filament()->getCurrentPanel()?->getId() . '.resources.mails.events.view', $record)) + ->url(fn (MailEvent $record) => route('filament.' . filament()->getCurrentPanel()?->getId() . '.resources.mails.events.view', $record)) ->since() ->dateTimeTooltip('d-m-Y H:i') ->label(__('Occurred At')), @@ -188,7 +188,7 @@ public static function infolist(Infolist $infolist): Infolist ->hiddenLabel() ->label(__('HTML Content')) ->extraAttributes(['class' => 'overflow-x-auto']) - ->formatStateUsing(fn(string $state, Mail $record): View => view( + ->formatStateUsing(fn (string $state, Mail $record): View => view( 'filament-mails::mails.preview', ['html' => $state, 'mail' => $record], )), @@ -198,7 +198,7 @@ public static function infolist(Infolist $infolist): Infolist TextEntry::make('html') ->hiddenLabel() ->extraAttributes(['class' => 'overflow-x-auto']) - ->formatStateUsing(fn(string $state, Mail $record): View => view( + ->formatStateUsing(fn (string $state, Mail $record): View => view( 'filament-mails::mails.html', ['html' => $state, 'mail' => $record], )) @@ -239,7 +239,7 @@ public static function infolist(Infolist $infolist): Infolist ->label(__('Mime Type')), ViewEntry::make('uuid') ->label(__('Download')) - ->getStateUsing(fn($record) => $record) + ->getStateUsing(fn ($record) => $record) ->view('filament-mails::mails.download'), ]), ]), @@ -258,7 +258,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', @@ -278,27 +278,27 @@ public static function table(Table $table): Table Tables\Columns\IconColumn::make('attachments') ->label('') ->alignLeft() - ->getStateUsing(fn(Mail $record) => $record->attachments->count() > 0) - ->icon(fn(string $state): string => $state ? 'heroicon-o-paper-clip' : ''), + ->getStateUsing(fn (Mail $record) => $record->attachments->count() > 0) + ->icon(fn (string $state): string => $state ? 'heroicon-o-paper-clip' : ''), Tables\Columns\TextColumn::make('to') ->label(__('Recipient')) ->limit(50) - ->formatStateUsing(fn($state) => self::formatEmailAddressForTable($state)) + ->formatStateUsing(fn ($state) => self::formatEmailAddressForTable($state)) ->sortable() ->searchable(), Tables\Columns\TextColumn::make('opens') ->label(__('Opens')) - ->tooltip(fn(Mail $record) => __('Last opened at :date', ['date' => $record->last_opened_at?->format('d-m-Y H:i')])) + ->tooltip(fn (Mail $record) => __('Last opened at :date', ['date' => $record->last_opened_at?->format('d-m-Y H:i')])) ->sortable(), Tables\Columns\TextColumn::make('clicks') ->label(__('Clicks')) - ->tooltip(fn(Mail $record) => __('Last clicked at :date', ['date' => $record->last_clicked_at?->format('d-m-Y H:i')])) + ->tooltip(fn (Mail $record) => __('Last clicked at :date', ['date' => $record->last_clicked_at?->format('d-m-Y H:i')])) ->sortable(), Tables\Columns\TextColumn::make('sent_at') ->label(__('Sent At')) ->dateTime('d-m-Y H:i') ->since() - ->tooltip(fn(Mail $record) => $record->sent_at?->format('d-m-Y H:i')) + ->tooltip(fn (Mail $record) => $record->sent_at?->format('d-m-Y H:i')) ->sortable() ->searchable(), ]) @@ -416,4 +416,4 @@ private static function formatEmailAddressForTable($state): string return implode(', ', array_keys($data)); } -} \ No newline at end of file +}