From 89c79d818326bd4e1e4bc7f73882e97153a5d29e Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Fri, 18 Aug 2023 11:53:17 +0300 Subject: [PATCH 1/2] Update TipTapEditor.php --- src/Classes/TipTapEditor.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Classes/TipTapEditor.php b/src/Classes/TipTapEditor.php index 0586add..0e3b078 100644 --- a/src/Classes/TipTapEditor.php +++ b/src/Classes/TipTapEditor.php @@ -15,6 +15,7 @@ public static function component(): Component return \FilamentTiptapEditor\TiptapEditor::make('content') ->profile('default') ->output(TiptapOutput::Html) + ->extraInputAttributes(['style' => 'min-height: 24rem;']) ->required(); } From 435d78a7fd00f40c82aebdec7576b947ba8ad0ea Mon Sep 17 00:00:00 2001 From: atmonshi Date: Fri, 18 Aug 2023 08:53:47 +0000 Subject: [PATCH 2/2] Fix styling --- src/Filament/Resources/LibraryResource.php | 14 +++++++------- src/Filament/Resources/PageResource.php | 1 - src/Filament/Resources/PostResource.php | 1 - src/Filament/Resources/TagResource.php | 4 ++-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Filament/Resources/LibraryResource.php b/src/Filament/Resources/LibraryResource.php index 5035dd6..4dc0434 100644 --- a/src/Filament/Resources/LibraryResource.php +++ b/src/Filament/Resources/LibraryResource.php @@ -59,7 +59,7 @@ public static function form(Form $form): Form }), TextInput::make('slug') - ->unique(ignorable: fn(?Library $record): ?Library => $record) + ->unique(ignorable: fn (?Library $record): ?Library => $record) ->required() ->maxLength(255) ->label(__('Library Slug')), @@ -99,12 +99,12 @@ public static function form(Form $form): Form ->collection('library') ->multiple() ->reorderable() - ->visible(fn(Get $get) => $get('upload_or_url') === 'upload') + ->visible(fn (Get $get) => $get('upload_or_url') === 'upload') ->label(''), TextInput::make('file_path') ->label(__('file url')) - ->visible(fn(Get $get) => $get('upload_or_url') === 'url') + ->visible(fn (Get $get) => $get('upload_or_url') === 'url') ->url(), ]), ]); @@ -122,15 +122,15 @@ public static function table(Table $table): Table ->searchable() ->sortable() ->visible(SkyPlugin::get()->getLibraryTypes() !== null) - ->formatStateUsing(fn(string $state): string => str($state)->title()) + ->formatStateUsing(fn (string $state): string => str($state)->title()) ->color('') - ->color(fn(string $state) => match ($state) { + ->color(fn (string $state) => match ($state) { 'IMAGE' => 'primary', 'FILE' => 'success', 'VIDEO' => 'warning', default => '', }) - ->icon(fn(string $state) => match ($state) { + ->icon(fn (string $state) => match ($state) { 'IMAGE' => 'heroicon-o-photo', 'FILE' => 'heroicon-o-document', 'VIDEO' => 'heroicon-o-film', @@ -150,7 +150,7 @@ public static function table(Table $table): Table ->color('warning') ->icon('heroicon-o-arrow-top-right-on-square') ->label(__('Open')) - ->url(fn(Library $record): string => route('library.item', ['slug' => $record->slug])) + ->url(fn (Library $record): string => route('library.item', ['slug' => $record->slug])) ->openUrlInNewTab(), DeleteAction::make('delete') ->label(__('Delete')), diff --git a/src/Filament/Resources/PageResource.php b/src/Filament/Resources/PageResource.php index a59cff7..58ae85e 100644 --- a/src/Filament/Resources/PageResource.php +++ b/src/Filament/Resources/PageResource.php @@ -5,7 +5,6 @@ use Filament\Forms\Components\DateTimePicker; use Filament\Forms\Components\Hidden; use Filament\Forms\Components\Placeholder; -use Filament\Forms\Components\Radio; use Filament\Forms\Components\Select; use Filament\Forms\Components\SpatieMediaLibraryFileUpload; use Filament\Forms\Components\Tabs; diff --git a/src/Filament/Resources/PostResource.php b/src/Filament/Resources/PostResource.php index a4fd254..fb1d162 100644 --- a/src/Filament/Resources/PostResource.php +++ b/src/Filament/Resources/PostResource.php @@ -5,7 +5,6 @@ use Filament\Forms\Components\DateTimePicker; use Filament\Forms\Components\Hidden; use Filament\Forms\Components\Placeholder; -use Filament\Forms\Components\Radio; use Filament\Forms\Components\Select; use Filament\Forms\Components\SpatieMediaLibraryFileUpload; use Filament\Forms\Components\SpatieTagsInput; diff --git a/src/Filament/Resources/TagResource.php b/src/Filament/Resources/TagResource.php index 13340c8..094ec86 100644 --- a/src/Filament/Resources/TagResource.php +++ b/src/Filament/Resources/TagResource.php @@ -47,7 +47,7 @@ public static function form(Form $form): Form $set('slug', Str::slug($state)); }), TextInput::make('slug') - ->unique(ignorable: fn(?Model $record): ?Model => $record) + ->unique(ignorable: fn (?Model $record): ?Model => $record) ->required() ->maxLength(255), Select::make('type') @@ -67,7 +67,7 @@ public static function table(Table $table): Table TextColumn::make('items_count') ->toggleable() ->getStateUsing( - fn(Tag $record): int => method_exists($record, $record->type) + fn (Tag $record): int => method_exists($record, $record->type) ? $record->{$record->type}()->count() : 0 ),