From 37f90ae08c49ba7d8e5f11de23f629278e7871b3 Mon Sep 17 00:00:00 2001 From: Tieme Alberts <52133032+sitenzo@users.noreply.github.com> Date: Mon, 6 May 2024 14:59:19 +0200 Subject: [PATCH 1/5] Update filament-email.php Added resource Icon to config --- config/filament-email.php | 1 + 1 file changed, 1 insertion(+) diff --git a/config/filament-email.php b/config/filament-email.php index 2d13d69..ececad8 100644 --- a/config/filament-email.php +++ b/config/filament-email.php @@ -20,6 +20,7 @@ 'cc', 'bcc', ], + 'navigation_icon' => 'heroicon-o-envelope', ], 'keep_email_for_days' => 60, From c92f00b49994bd86f6a579cd0a2947d85bc10ad3 Mon Sep 17 00:00:00 2001 From: Tieme Alberts <52133032+sitenzo@users.noreply.github.com> Date: Mon, 6 May 2024 15:02:14 +0200 Subject: [PATCH 2/5] Update EmailResource.php Added getNavigationIcon from config --- src/Filament/Resources/EmailResource.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Filament/Resources/EmailResource.php b/src/Filament/Resources/EmailResource.php index 8615ee3..4f306a9 100644 --- a/src/Filament/Resources/EmailResource.php +++ b/src/Filament/Resources/EmailResource.php @@ -32,8 +32,6 @@ class EmailResource extends Resource { - protected static ?string $navigationIcon = 'heroicon-o-envelope'; - protected static ?string $slug = 'emails'; public static function getBreadcrumb(): string @@ -46,6 +44,11 @@ public static function getNavigationLabel(): string return config('filament-email.label') ?? __('filament-email::filament-email.navigation_label'); } + public static function getNavigationIcon(): string | Htmlable | null + { + return config('filament-email.navigation_icon') ?? null; + } + public static function getNavigationGroup(): ?string { return config('filament-email.resource.group') ?? __('filament-email::filament-email.navigation_group'); From 109029e4880677baeeeb45689780aaace6488129 Mon Sep 17 00:00:00 2001 From: Tieme Alberts <52133032+sitenzo@users.noreply.github.com> Date: Mon, 6 May 2024 15:03:27 +0200 Subject: [PATCH 3/5] Update README.md added 'navigation_icon' => 'heroicon-o-envelope', to config --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 16fe25a..f389745 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ return [ 'cc', 'bcc', ], + 'navigation_icon' => 'heroicon-o-envelope', ], 'keep_email_for_days' => 60, From daa12af1086ce4bd60e44eb7d0544af1d4eda4c7 Mon Sep 17 00:00:00 2001 From: Tieme Alberts Date: Mon, 6 May 2024 17:04:53 +0200 Subject: [PATCH 4/5] Update default navigation icon configuration The configuration file 'filament-email.php' was updated to remove the hardcoded navigation icon. In 'EmailResource.php', implement a fallback to 'heroicon-o-envelope' if no icon is set. This solution provides flexibility to set the navigation icon from the configuration file while ensuring there's a default icon if none is specified. --- config/filament-email.php | 2 +- src/Filament/Resources/EmailResource.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/filament-email.php b/config/filament-email.php index ececad8..9259efe 100644 --- a/config/filament-email.php +++ b/config/filament-email.php @@ -20,7 +20,7 @@ 'cc', 'bcc', ], - 'navigation_icon' => 'heroicon-o-envelope', + 'navigation_icon' => null, ], 'keep_email_for_days' => 60, diff --git a/src/Filament/Resources/EmailResource.php b/src/Filament/Resources/EmailResource.php index 4f306a9..800f704 100644 --- a/src/Filament/Resources/EmailResource.php +++ b/src/Filament/Resources/EmailResource.php @@ -29,6 +29,7 @@ use RickDBCN\FilamentEmail\Filament\Resources\EmailResource\Pages\ViewEmail; use RickDBCN\FilamentEmail\Mail\ResendMail; use RickDBCN\FilamentEmail\Models\Email; +use Illuminate\Contracts\Support\Htmlable; class EmailResource extends Resource { @@ -46,9 +47,9 @@ public static function getNavigationLabel(): string public static function getNavigationIcon(): string | Htmlable | null { - return config('filament-email.navigation_icon') ?? null; + return config('filament-email.navigation_icon') ?? 'heroicon-o-envelope'; } - + public static function getNavigationGroup(): ?string { return config('filament-email.resource.group') ?? __('filament-email::filament-email.navigation_group'); From a5450a464ccdb90cc694f83ab22be06de0a71cac Mon Sep 17 00:00:00 2001 From: Tieme Alberts Date: Mon, 6 May 2024 21:58:00 +0200 Subject: [PATCH 5/5] Refactor icon configuration for email resource The 'icon' property was added to the 'filament-email' configuration while 'navigation_icon' was removed from the configuration and README file. The reference to 'navigation_icon' was also updated to 'resource.icon' in EmailResource class to reflect these changes. --- README.md | 2 +- config/filament-email.php | 2 +- src/Filament/Resources/EmailResource.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f389745..3cd377f 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ return [ 'model' => Email::class, 'group' => null, 'sort' => null, + 'icon' => null, 'default_sort_column' => 'created_at', 'default_sort_direction' => 'desc', 'datetime_format' => 'Y-m-d H:i:s', @@ -67,7 +68,6 @@ return [ 'cc', 'bcc', ], - 'navigation_icon' => 'heroicon-o-envelope', ], 'keep_email_for_days' => 60, diff --git a/config/filament-email.php b/config/filament-email.php index 9259efe..02af3d3 100644 --- a/config/filament-email.php +++ b/config/filament-email.php @@ -9,6 +9,7 @@ 'model' => Email::class, 'group' => null, 'sort' => null, + 'icon' => null, 'default_sort_column' => 'created_at', 'default_sort_direction' => 'desc', 'datetime_format' => 'Y-m-d H:i:s', @@ -20,7 +21,6 @@ 'cc', 'bcc', ], - 'navigation_icon' => null, ], 'keep_email_for_days' => 60, diff --git a/src/Filament/Resources/EmailResource.php b/src/Filament/Resources/EmailResource.php index 800f704..a11a61c 100644 --- a/src/Filament/Resources/EmailResource.php +++ b/src/Filament/Resources/EmailResource.php @@ -47,7 +47,7 @@ public static function getNavigationLabel(): string public static function getNavigationIcon(): string | Htmlable | null { - return config('filament-email.navigation_icon') ?? 'heroicon-o-envelope'; + return config('filament-email.resource.icon') ?? 'heroicon-o-envelope'; } public static function getNavigationGroup(): ?string