diff --git a/packages/admin/resources/views/components/alert.blade.php b/packages/admin/resources/views/components/alert.blade.php deleted file mode 100644 index 3f89e5760c..0000000000 --- a/packages/admin/resources/views/components/alert.blade.php +++ /dev/null @@ -1,54 +0,0 @@ -@props([ - 'content' => null, - 'icon' => null, - 'color' => 'primary', -]) - -
merge(['class' => 'p-2']) - ->class([ - 'rounded-md ring-1', - match ($color) { - 'gray' => 'bg-gray-50 text-gray-600 ring-gray-600/10 dark:bg-gray-400/10 dark:text-gray-400 dark:ring-gray-400/20', - default => 'bg-custom-50 text-custom-600 ring-custom-600/10 dark:bg-custom-400/10 dark:text-custom-400 dark:ring-custom-400/30', - }, - ]) - ->style([ - \Filament\Support\get_color_css_variables( - $color, - shades: [ - 50, - 400, - 600, - ...($icon) ? [500] : [], - ], - ) => $color !== 'gray', - ]) - }} -> -
-
- - @if($icon) - 'text-gray-400 dark:text-gray-500', - default => 'text-custom-500', - }, - ]) - /> - @endif - -
-
-
- {{ $content }} -
-
-
-
diff --git a/packages/admin/resources/views/infolists/components/alert.blade.php b/packages/admin/resources/views/infolists/components/alert.blade.php deleted file mode 100644 index 5588c6a4c2..0000000000 --- a/packages/admin/resources/views/infolists/components/alert.blade.php +++ /dev/null @@ -1,13 +0,0 @@ -@php - $content = $getContent(); - $state = $getState() ?? $content; - $icon = $getIcon($state) ?? $getDefaultIcon(); - $color = $getColor($state) ?? 'primary'; -@endphp - - diff --git a/packages/admin/src/Filament/Resources/OrderResource/Pages/ManageOrder.php b/packages/admin/src/Filament/Resources/OrderResource/Pages/ManageOrder.php index 26bc12ff5b..9e22ba114e 100644 --- a/packages/admin/src/Filament/Resources/OrderResource/Pages/ManageOrder.php +++ b/packages/admin/src/Filament/Resources/OrderResource/Pages/ManageOrder.php @@ -2,6 +2,8 @@ namespace Lunar\Admin\Filament\Resources\OrderResource\Pages; +use Awcodes\Shout\Components\Shout; +use Awcodes\Shout\Components\ShoutEntry; use Barryvdh\DomPDF\Facade\Pdf; use Closure; use Filament\Actions; @@ -17,6 +19,7 @@ use Filament\Support\Enums\ActionSize; use Filament\Support\Enums\FontWeight; use Filament\Support\Enums\IconPosition; +use Filament\Support\Facades\FilamentIcon; use Illuminate\Contracts\Support\Htmlable; use Illuminate\Support\Arr; use Illuminate\Support\HtmlString; @@ -26,7 +29,6 @@ use Lunar\Admin\Filament\Resources\OrderResource\Pages\Components\OrderItemsTable; use Lunar\Admin\Support\Actions\Orders\UpdateStatusAction; use Lunar\Admin\Support\ActivityLog\Concerns\CanDispatchActivityUpdated; -use Lunar\Admin\Support\Infolists\Components\Alert; use Lunar\Admin\Support\Infolists\Components\Livewire; use Lunar\Admin\Support\Infolists\Components\Tags; use Lunar\Admin\Support\Infolists\Components\Timeline; @@ -79,18 +81,19 @@ public function infolist(Infolist $infolist): Infolist ->schema([ Infolists\Components\Group::make() ->schema([ - Alert::make('requires_capture') - ->danger() + ShoutEntry::make('requires_capture') + ->type('danger') ->content(__('lunarpanel::order.infolist.alert.requires_capture')) ->visible(fn () => $this->requiresCapture), - Alert::make('requires_capture') + ShoutEntry::make('requires_capture') ->state(fn () => $this->paymentStatus) - ->icons(fn ($state) => [ - 'heroicon-o-exclamation-circle' => 'refunded', - ]) - ->configureColor(fn (Alert $component, $state) => match ($state) { - 'partial-refund' => $component->info(), - 'refunded' => $component->danger(), + ->icon(fn ($state) => match ($state) { + 'refunded' => FilamentIcon::resolve('lunar::exclamation-circle'), + default => null + }) + ->color(fn (ShoutEntry $component, $state) => match ($state) { + 'partial-refund' => 'info', + 'refunded' => 'danger', default => null })->content(fn ($state) => match ($state) { 'partial-refund' => __('lunarpanel::order.infolist.alert.partially_refunded'), @@ -770,7 +773,7 @@ protected function getCaptureAction(): Actions\Action ->live() ->autocomplete(false) ->minValue(1) - ->helperText(function ($get, $state) { + ->helperText(function (Forms\Components\TextInput $component, $get, $state) { $transaction = Transaction::findOrFail($get('transaction')); $message = $transaction->amount->decimal > $state ? __('lunarpanel::order.form.amount.hint.less_than_total') : null; @@ -779,10 +782,11 @@ protected function getCaptureAction(): Actions\Action return null; } - return view('lunarpanel::components.alert', [ - 'content' => $message, - 'color' => 'danger', - ]); + return Shout::make('alert') + ->container($component->getContainer()) + ->type('danger') + ->icon(FilamentIcon::resolve('lunar::exclamation-circle')) + ->content($message); }) ->numeric(), Forms\Components\Toggle::make('confirm') diff --git a/packages/admin/src/LunarPanelManager.php b/packages/admin/src/LunarPanelManager.php index 673a74bb2a..a383ae5636 100644 --- a/packages/admin/src/LunarPanelManager.php +++ b/packages/admin/src/LunarPanelManager.php @@ -131,6 +131,7 @@ public function register(): self 'lunar::image-placeholder' => 'lucide-image', 'lunar::trending-up' => 'lucide-trending-up', 'lunar::trending-down' => 'lucide-trending-down', + 'lunar::exclamation-circle' => 'lucide-alert-circle', ]); FilamentColor::register([ diff --git a/packages/admin/src/Support/Infolists/Components/Alert.php b/packages/admin/src/Support/Infolists/Components/Alert.php deleted file mode 100644 index c554b76b03..0000000000 --- a/packages/admin/src/Support/Infolists/Components/Alert.php +++ /dev/null @@ -1,97 +0,0 @@ -content = $content; - - return $this; - } - - public function getColor(mixed $state): string|array|null - { - if (filled($this->configureColorUsing)) { - $this->evaluate($this->configureColorUsing); - } - - return $this->baseGetColor($state); - } - - /** - * @return string | Htmlable | null - */ - public function getContent() - { - return $this->evaluate($this->content); - } - - public function configureColor($configureColorUsing = null): static - { - $this->configureColorUsing = $configureColorUsing; - - return $this; - } - - public function danger(): static - { - $this->color('danger'); - - return $this; - } - - public function info(): static - { - $this->color(Color::Sky); - - return $this; - } - - public function success(): static - { - $this->color('success'); - - return $this; - } - - public function warning(): static - { - $this->color(Color::Amber); - - return $this; - } - - public function defaultIcon(string $icon): static - { - $this->defaultIcon = $icon; - - return $this; - } - - public function getDefaultIcon(): string - { - return $this->defaultIcon; - } -}