Skip to content

Commit cc2f337

Browse files
AzGasimgithub-actions[bot]
authored andcommitted
Fix styling
1 parent dfa2ccc commit cc2f337

File tree

6 files changed

+60
-68
lines changed

6 files changed

+60
-68
lines changed

packages/media/src/Forms/Components/ImageDisplay.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function getState(): ?string
1919
{
2020
$record = $this->getRecord();
2121

22-
if (!$record) {
22+
if (! $record) {
2323
return null;
2424
}
2525

packages/media/src/MediaServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function boot()
3030
{
3131
parent::boot();
3232

33-
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'media');
33+
$this->loadViewsFrom(__DIR__.'/../resources/views', 'media');
3434
Livewire::component('media-picker-modal', MediaPickerModal::class);
3535
Livewire::component('media-uploader', MediaUploader::class);
3636

packages/media/src/Resources/MediaResource.php

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,33 @@
22

33
namespace Moox\Media\Resources;
44

5-
use Filament\Forms\Form;
6-
use Filament\Tables\Table;
7-
use Filament\Support\RawJs;
8-
use Illuminate\Support\Str;
9-
use Moox\Media\Models\Media;
105
use Filament\Facades\Filament;
11-
use Filament\Resources\Resource;
12-
use Filament\Actions\StaticAction;
13-
use Filament\Tables\Filters\Filter;
14-
use Illuminate\Support\Facades\Blade;
15-
use Filament\Forms\Components\Actions;
6+
use Filament\Forms\Components\Placeholder;
167
use Filament\Forms\Components\Section;
178
use Filament\Forms\Components\Textarea;
18-
use Filament\Tables\Actions\EditAction;
19-
use Filament\Tables\Filters\DatePicker;
209
use Filament\Forms\Components\TextInput;
21-
use Filament\Notifications\Notification;
10+
use Filament\Forms\Form;
11+
use Filament\Resources\Resource;
12+
use Filament\Support\RawJs;
13+
use Filament\Tables\Actions\EditAction;
2214
use Filament\Tables\Columns\Layout\Stack;
2315
use Filament\Tables\Filters\SelectFilter;
16+
use Filament\Tables\Table;
2417
use Illuminate\Database\Eloquent\Builder;
18+
use Illuminate\Support\Facades\Blade;
19+
use Illuminate\Support\Str;
2520
use Moox\Core\Traits\Base\BaseInResource;
26-
use Filament\Forms\Components\Placeholder;
27-
use Filament\Forms\Components\Actions\Action;
2821
use Moox\Media\Forms\Components\ImageDisplay;
22+
use Moox\Media\Models\Media;
2923
use Moox\Media\Resources\MediaResource\Pages;
30-
use Filament\Forms\Components\Actions\Alignment;
3124
use Moox\Media\Tables\Columns\CustomImageColumn;
3225

3326
class MediaResource extends Resource
3427
{
3528
use BaseInResource;
3629

3730
protected static ?string $model = Media::class;
31+
3832
protected static ?string $navigationIcon = 'gmdi-view-timeline-o';
3933

4034
protected static ?string $recordTitleAttribute = 'name';
@@ -61,36 +55,35 @@ public static function form(Form $form): Form
6155
->schema([
6256
Placeholder::make('mime_type')
6357
->label('Dateityp')
64-
->content(fn($record) => $record->mime_type),
58+
->content(fn ($record) => $record->mime_type),
6559

6660
Placeholder::make('size')
6761
->label('Dateigröße')
68-
->content(fn($record) => number_format($record->size / 1024, 2) . ' KB'),
62+
->content(fn ($record) => number_format($record->size / 1024, 2).' KB'),
6963

7064
Placeholder::make('file_name')
7165
->label('Originaldateiname')
72-
->content(fn($record) => $record->file_name),
66+
->content(fn ($record) => $record->file_name),
7367

7468
Placeholder::make('dimensions')
7569
->label('Abmessungen')
7670
->content(function ($record) {
7771
$dimensions = $record->getCustomProperty('dimensions');
78-
if (!$dimensions) {
72+
if (! $dimensions) {
7973
return '-';
8074
}
8175

8276
return "{$dimensions['width']} × {$dimensions['height']} Pixel";
8377
})
84-
->visible(fn($record) => str_starts_with($record->mime_type, 'image/')),
78+
->visible(fn ($record) => str_starts_with($record->mime_type, 'image/')),
8579

8680
Placeholder::make('created_at')
8781
->label('Hochgeladen am')
88-
->content(fn($record) => $record->created_at?->format('d.m.Y H:i')),
82+
->content(fn ($record) => $record->created_at?->format('d.m.Y H:i')),
8983

9084
Placeholder::make('updated_at')
9185
->label('Zuletzt bearbeitet')
92-
->content(fn($record) => $record->updated_at?->format('d.m.Y H:i')),
93-
86+
->content(fn ($record) => $record->updated_at?->format('d.m.Y H:i')),
9487

9588
Placeholder::make('usage')
9689
->label('Verwendet in')
@@ -105,7 +98,7 @@ public static function form(Form $form): Form
10598

10699
$links = $usages->map(function ($usage) {
107100
$type = Str::plural(strtolower(class_basename($usage->media_usable_type)));
108-
$url = Filament::getCurrentPanel()->getUrl() . '/' . $type . '/' . $usage->media_usable_id;
101+
$url = Filament::getCurrentPanel()->getUrl().'/'.$type.'/'.$usage->media_usable_id;
109102

110103
return Blade::render('<a href="{{ $url }}" target="_blank" class="text-primary underline">{{ $url }}</a>', [
111104
'url' => $url,
@@ -160,7 +153,7 @@ public static function table(Table $table): Table
160153
'class' => 'rounded-lg',
161154
'style' => 'width: 150px; height: 150px ; object-fit: cover;',
162155
])
163-
->tooltip(fn($record) => $record->title ?? 'Kein Titel')
156+
->tooltip(fn ($record) => $record->title ?? 'Kein Titel')
164157
->searchable(['name', 'title', 'description', 'alt', 'internal_note']),
165158
]),
166159
])
@@ -177,12 +170,13 @@ public static function table(Table $table): Table
177170
->color('danger')
178171
->icon('heroicon-m-trash')
179172
->requiresConfirmation()
180-
->modalHeading(fn($record) => 'Bild "' . ($record->title ?: $record->name) . '" löschen')
173+
->modalHeading(fn ($record) => 'Bild "'.($record->title ?: $record->name).'" löschen')
181174
->modalDescription('Sind Sie sicher, dass Sie dieses Bild löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.')
182175
->modalSubmitActionLabel('Ja, löschen')
183176
->modalCancelActionLabel('Abbrechen')
184177
->action(function ($record, $livewire) {
185178
Media::where('id', $record->id)->delete();
179+
186180
return redirect(static::getUrl('index'));
187181
}),
188182
]),
@@ -197,7 +191,7 @@ public static function table(Table $table): Table
197191
'documents' => 'Dokumente',
198192
])
199193
->query(function (Builder $query, array $data) {
200-
if (!$data['value']) {
194+
if (! $data['value']) {
201195
return $query;
202196
}
203197

@@ -242,7 +236,7 @@ public static function table(Table $table): Table
242236
'year' => 'Dieses Jahr',
243237
])
244238
->query(function (Builder $query, array $data) {
245-
if (!$data['value']) {
239+
if (! $data['value']) {
246240
return $query;
247241
}
248242

@@ -262,7 +256,7 @@ public static function table(Table $table): Table
262256
}
263257

264258
return $query;
265-
})
259+
}),
266260
])
267261
->defaultSort('created_at', 'desc')
268262
->paginationPageOptions([24, 48, 96])
@@ -283,4 +277,4 @@ public static function getPages(): array
283277
'index' => Pages\ListMedia::route('/'),
284278
];
285279
}
286-
}
280+
}

packages/media/src/Resources/MediaResource/Pages/ListMedia.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Filament\Actions\Action;
66
use Filament\Forms\Components\FileUpload;
7-
use Filament\Forms\Components\SpatieMediaLibraryFileUpload;
87
use Filament\Resources\Pages\ListRecords;
98
use Moox\Media\Models\Media;
109
use Moox\Media\Resources\MediaResource;
@@ -33,7 +32,7 @@ public function getHeaderActions(): array
3332
->maxSize(10240)
3433
->required()
3534
->afterStateUpdated(function ($state) {
36-
if (!$state) {
35+
if (! $state) {
3736
return;
3837
}
3938

packages/tag/src/Resources/TagResource.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public static function form(Form $form): Form
7373
->label(__('core::core.title'))
7474
->required()
7575
->afterStateUpdated(
76-
fn(Set $set, ?string $state) => $set('slug', Str::slug($state))
76+
fn (Set $set, ?string $state) => $set('slug', Str::slug($state))
7777
),
7878
TextInput::make('slug')
7979
->label(__('core::core.slug'))
@@ -87,7 +87,7 @@ public static function form(Form $form): Form
8787
table: 'tag_translations',
8888
column: 'slug',
8989
ignoreRecord: true,
90-
ignorable: fn($record) => $record?->translations()
90+
ignorable: fn ($record) => $record?->translations()
9191
->where('locale', request()->query('lang', app()->getLocale()))
9292
->first()
9393
),
@@ -107,8 +107,8 @@ public static function form(Form $form): Form
107107
->color('success')
108108
->button()
109109
->extraAttributes(['class' => 'w-full'])
110-
->action(fn($record) => $record->restore())
111-
->visible(fn($livewire, $record): bool => $record && $record->trashed() && $livewire instanceof ViewTag),
110+
->action(fn ($record) => $record->restore())
111+
->visible(fn ($livewire, $record): bool => $record && $record->trashed() && $livewire instanceof ViewTag),
112112
Action::make('save')
113113
->label(__('core::core.save'))
114114
->color('primary')
@@ -117,7 +117,7 @@ public static function form(Form $form): Form
117117
->action(function ($livewire): void {
118118
$livewire instanceof CreateTag ? $livewire->create() : $livewire->save();
119119
})
120-
->visible(fn($livewire): bool => $livewire instanceof CreateTag || $livewire instanceof EditTag),
120+
->visible(fn ($livewire): bool => $livewire instanceof CreateTag || $livewire instanceof EditTag),
121121
Action::make('saveAndCreateAnother')
122122
->label(__('core::core.save_and_create_another'))
123123
->color('secondary')
@@ -126,50 +126,50 @@ public static function form(Form $form): Form
126126
->action(function ($livewire): void {
127127
$livewire->saveAndCreateAnother();
128128
})
129-
->visible(fn($livewire): bool => $livewire instanceof CreateTag),
129+
->visible(fn ($livewire): bool => $livewire instanceof CreateTag),
130130
Action::make('cancel')
131131
->label(__('core::core.cancel'))
132132
->color('secondary')
133133
->outlined()
134134
->extraAttributes(['class' => 'w-full'])
135-
->url(fn(): string => static::getUrl('index'))
136-
->visible(fn($livewire): bool => $livewire instanceof CreateTag),
135+
->url(fn (): string => static::getUrl('index'))
136+
->visible(fn ($livewire): bool => $livewire instanceof CreateTag),
137137
Action::make('edit')
138138
->label(__('core::core.edit'))
139139
->color('primary')
140140
->button()
141141
->extraAttributes(['class' => 'w-full'])
142-
->url(fn($record): string => static::getUrl('edit', ['record' => $record, 'lang' => request()->get('lang')]))
143-
->visible(fn($livewire, $record): bool => $livewire instanceof ViewTag && !$record->trashed()),
142+
->url(fn ($record): string => static::getUrl('edit', ['record' => $record, 'lang' => request()->get('lang')]))
143+
->visible(fn ($livewire, $record): bool => $livewire instanceof ViewTag && ! $record->trashed()),
144144
Action::make('restore')
145145
->label(__('core::core.restore'))
146146
->color('success')
147147
->button()
148148
->extraAttributes(['class' => 'w-full'])
149-
->action(fn($record) => $record->restore())
150-
->visible(fn($livewire, $record): bool => $record && $record->trashed() && $livewire instanceof EditTag),
149+
->action(fn ($record) => $record->restore())
150+
->visible(fn ($livewire, $record): bool => $record && $record->trashed() && $livewire instanceof EditTag),
151151
Action::make('delete')
152152
->label(__('core::core.delete'))
153153
->color('danger')
154154
->link()
155155
->extraAttributes(['class' => 'w-full'])
156-
->action(fn($record) => $record->delete())
157-
->visible(fn($livewire, $record): bool => $record && !$record->trashed() && $livewire instanceof EditTag),
156+
->action(fn ($record) => $record->delete())
157+
->visible(fn ($livewire, $record): bool => $record && ! $record->trashed() && $livewire instanceof EditTag),
158158
]),
159159
ColorPicker::make('color'),
160160
TextInput::make('weight'),
161161
TextInput::make('count')
162162
->disabled()
163-
->visible(fn($livewire, $record): bool => ($record && $livewire instanceof EditTag) || ($record && $livewire instanceof ViewTag)),
163+
->visible(fn ($livewire, $record): bool => ($record && $livewire instanceof EditTag) || ($record && $livewire instanceof ViewTag)),
164164
DateTimePicker::make('created_at')
165165
->disabled()
166-
->visible(fn($livewire, $record): bool => ($record && $livewire instanceof EditTag) || ($record && $livewire instanceof ViewTag)),
166+
->visible(fn ($livewire, $record): bool => ($record && $livewire instanceof EditTag) || ($record && $livewire instanceof ViewTag)),
167167
DateTimePicker::make('updated_at')
168168
->disabled()
169-
->visible(fn($livewire, $record): bool => ($record && $livewire instanceof EditTag) || ($record && $livewire instanceof ViewTag)),
169+
->visible(fn ($livewire, $record): bool => ($record && $livewire instanceof EditTag) || ($record && $livewire instanceof ViewTag)),
170170
DateTimePicker::make('deleted_at')
171171
->disabled()
172-
->visible(fn($livewire, $record): bool => $record && $record->trashed() && $livewire instanceof ViewTag),
172+
->visible(fn ($livewire, $record): bool => $record && $record->trashed() && $livewire instanceof ViewTag),
173173
]),
174174
])
175175
->columnSpan(['lg' => 1]),
@@ -248,21 +248,21 @@ public static function table(Table $table): Table
248248
])
249249
->actions([
250250
ViewAction::make()->url(
251-
fn($record) => request()->has('lang')
251+
fn ($record) => request()->has('lang')
252252
? static::getUrl('view', ['record' => $record, 'lang' => request()->get('lang')])
253253
: static::getUrl('view', ['record' => $record])
254254
),
255255
EditAction::make()
256256
->url(
257-
fn($record) => request()->has('lang')
257+
fn ($record) => request()->has('lang')
258258
? static::getUrl('edit', ['record' => $record, 'lang' => request()->get('lang')])
259259
: static::getUrl('edit', ['record' => $record])
260260
)
261-
->hidden(fn(): bool => in_array(static::getCurrentTab(), ['trash', 'deleted'])),
261+
->hidden(fn (): bool => in_array(static::getCurrentTab(), ['trash', 'deleted'])),
262262
])
263263
->bulkActions([
264-
DeleteBulkAction::make()->hidden(fn(): bool => in_array($currentTab, ['trash', 'deleted'])),
265-
RestoreBulkAction::make()->visible(fn(): bool => in_array($currentTab, ['trash', 'deleted'])),
264+
DeleteBulkAction::make()->hidden(fn (): bool => in_array($currentTab, ['trash', 'deleted'])),
265+
RestoreBulkAction::make()->visible(fn (): bool => in_array($currentTab, ['trash', 'deleted'])),
266266
]);
267267
}
268268

@@ -371,4 +371,4 @@ public static function setCurrentTab(?string $tab): void
371371
{
372372
static::$currentTab = $tab;
373373
}
374-
}
374+
}

0 commit comments

Comments
 (0)