Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Shout instead of custom alert component #1449

Merged
merged 5 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 0 additions & 54 deletions packages/admin/resources/views/components/alert.blade.php

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -25,7 +28,6 @@
use Lunar\Admin\Filament\Resources\OrderResource;
use Lunar\Admin\Filament\Resources\OrderResource\Pages\Components\OrderItemsTable;
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;
Expand Down Expand Up @@ -78,18 +80,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'),
Expand Down Expand Up @@ -780,7 +783,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;
Expand All @@ -789,10 +792,11 @@ protected function getCaptureAction(): Actions\Action
return null;
}

return view('lunarpanel::components.alert', [
'content' => $message,
'color' => 'danger',
]);
return Shout::make('aaa')
glennjacobs marked this conversation as resolved.
Show resolved Hide resolved
->container($component->getContainer())
->type('danger')
->icon(FilamentIcon::resolve('lunar::exclamation-circle'))
->content($message);
})
->numeric(),
Forms\Components\Toggle::make('confirm')
Expand Down
1 change: 1 addition & 0 deletions packages/admin/src/LunarPanelManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,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([
Expand Down
97 changes: 0 additions & 97 deletions packages/admin/src/Support/Infolists/Components/Alert.php

This file was deleted.

Loading