Skip to content

Commit

Permalink
Merge branch 'main' of github.com:vormkracht10/filament-mails
Browse files Browse the repository at this point in the history
  • Loading branch information
Baspa committed Sep 6, 2024
2 parents 7d5e2fa + a93f597 commit 0a4d600
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 34 deletions.
13 changes: 6 additions & 7 deletions src/Resources/EventResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Vormkracht10\FilamentMails\Resources;

use Filament\Infolists\Components\Grid;
use Filament\Infolists\Components\KeyValueEntry;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Components\TextEntry;
use Filament\Infolists\Infolist;
Expand Down Expand Up @@ -64,7 +63,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 => 'info',
WebhookEventType::OPEN => 'success',
Expand Down Expand Up @@ -106,7 +105,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'))
Expand All @@ -132,7 +131,7 @@ public static function infolist(Infolist $infolist): Infolist
TextEntry::make('link')
->default(__('Unknown'))
->label(__('Link'))
->url(fn($state) => $state)
->url(fn ($state) => $state)
->openUrlInNewTab(),
TextEntry::make('tag')
->default(__('Unknown'))
Expand All @@ -145,7 +144,7 @@ public static function infolist(Infolist $infolist): Infolist
->columnSpanFull()
->copyable()
->copyMessage(__('Copied'))
->copyMessageDuration(1500)
->copyMessageDuration(1500),
]),
]),
]);
Expand All @@ -161,7 +160,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',
Expand Down Expand Up @@ -207,4 +206,4 @@ public static function getPages(): array
'index' => ListEvents::route('/'),
];
}
}
}
52 changes: 26 additions & 26 deletions src/Resources/MailResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

namespace Vormkracht10\FilamentMails\Resources;

use Filament\Tables;
use Filament\Tables\Table;
use Filament\Infolists\Infolist;
use Filament\Resources\Resource;
use Illuminate\Support\Collection;
use Filament\Tables\Actions\Action;
use Filament\Infolists\Components\Grid;
use Filament\Infolists\Components\Tabs;
use Filament\Forms\Components\TextInput;
use Filament\Notifications\Notification;
use Filament\Infolists\Components\Grid;
use Filament\Infolists\Components\RepeatableEntry;
use Filament\Infolists\Components\Section;
use Vormkracht10\Mails\Jobs\ResendMailJob;
use Filament\Infolists\Components\Tabs;
use Filament\Infolists\Components\Tabs\Tab;
use Vormkracht10\FilamentMails\Models\Mail;
use Filament\Infolists\Components\TextEntry;
use Vormkracht10\Mails\Enums\WebhookEventType;
use Filament\Infolists\Components\RepeatableEntry;
use Filament\Infolists\Infolist;
use Filament\Notifications\Notification;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\Action;
use Filament\Tables\Table;
use Illuminate\Support\Collection;
use Vormkracht10\FilamentMails\Models\Mail;
use Vormkracht10\FilamentMails\Resources\MailResource\Pages\ListMails;
use Vormkracht10\Mails\Enums\WebhookEventType;
use Vormkracht10\Mails\Jobs\ResendMailJob;

class MailResource extends Resource
{
Expand Down Expand Up @@ -72,22 +72,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'))
Expand Down Expand Up @@ -140,7 +140,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 => 'info',
WebhookEventType::OPEN => 'success',
Expand All @@ -153,9 +153,9 @@ public static function infolist(Infolist $infolist): Infolist
->dateTimeTooltip('d-m-Y H:i')
->label(__('Occurred At')),
])
->columns(2)
->columns(2),
]),
])
]),

]),
Section::make('Content')
Expand Down Expand Up @@ -209,7 +209,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',
Expand All @@ -227,16 +227,16 @@ 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('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'))
Expand Down Expand Up @@ -359,4 +359,4 @@ private static function formatEmailAddressForTable($state): string

return implode(', ', array_keys($data));
}
}
}
2 changes: 1 addition & 1 deletion src/Resources/MailResource/Pages/ListMails.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ protected function getHeaderWidgets(): array
MailStatsWidget::class,
];
}
}
}

0 comments on commit 0a4d600

Please sign in to comment.