Skip to content

Commit f7b0c9d

Browse files
AzGasimgithub-actions[bot]
authored andcommitted
Fix styling
1 parent 3457fb4 commit f7b0c9d

File tree

1 file changed

+45
-45
lines changed

1 file changed

+45
-45
lines changed

packages/media/src/Resources/MediaResource.php

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static function form(Form $form): Form
6969
->schema([
7070
Placeholder::make('mime_type')
7171
->label(__('media::fields.mime_type'))
72-
->content(fn($record) => $record->getReadableMimeType()),
72+
->content(fn ($record) => $record->getReadableMimeType()),
7373

7474
Placeholder::make('size')
7575
->label(__('media::fields.size'))
@@ -83,37 +83,37 @@ public static function form(Form $form): Form
8383
$i++;
8484
}
8585

86-
return number_format($bytes, 2) . ' ' . $units[$i];
86+
return number_format($bytes, 2).' '.$units[$i];
8787
}),
8888

8989
Placeholder::make('file_name')
9090
->label(__('media::fields.file_name'))
91-
->content(fn($record) => $record->file_name),
91+
->content(fn ($record) => $record->file_name),
9292

9393
Placeholder::make('dimensions')
9494
->label(__('media::fields.dimensions'))
9595
->content(function ($record) {
9696
$dimensions = $record->getCustomProperty('dimensions');
97-
if (!$dimensions) {
97+
if (! $dimensions) {
9898
return '-';
9999
}
100100

101101
return "{$dimensions['width']} × {$dimensions['height']} Pixel";
102102
})
103-
->visible(fn($record) => str_starts_with($record->mime_type, 'image/')),
103+
->visible(fn ($record) => str_starts_with($record->mime_type, 'image/')),
104104

105105
Placeholder::make('created_at')
106106
->label(__('media::fields.created_at'))
107-
->content(fn($record) => $record->created_at?->format('d.m.Y H:i')),
107+
->content(fn ($record) => $record->created_at?->format('d.m.Y H:i')),
108108

109109
Placeholder::make('updated_at')
110110
->label(__('media::fields.updated_at'))
111-
->content(fn($record) => $record->updated_at?->format('d.m.Y H:i')),
111+
->content(fn ($record) => $record->updated_at?->format('d.m.Y H:i')),
112112

113113
Placeholder::make('uploaded_by')
114114
->label(__('media::fields.uploaded_by'))
115115
->content(function ($record) {
116-
if (!$record->uploader) {
116+
if (! $record->uploader) {
117117
return '-';
118118
}
119119

@@ -138,7 +138,7 @@ public static function form(Form $form): Form
138138

139139
$links = $items->map(function ($item) use ($typeName, $baseUrl) {
140140
$type = Str::plural(strtolower($typeName));
141-
$url = $baseUrl . '/' . $type . '/' . $item->media_usable_id;
141+
$url = $baseUrl.'/'.$type.'/'.$item->media_usable_id;
142142

143143
return "
144144
<div>
@@ -160,7 +160,7 @@ public static function form(Form $form): Form
160160
})->join("\n");
161161

162162
return Action::make('viewUsages')
163-
->label($usages->count() . ' ' . trans_choice('media::fields.link|links', $usages->count()))
163+
->label($usages->count().' '.trans_choice('media::fields.link|links', $usages->count()))
164164
->color('primary')
165165
->icon('heroicon-m-link')
166166
->modal()
@@ -184,25 +184,25 @@ public static function form(Form $form): Form
184184
->required()
185185
->live(onBlur: true)
186186
->afterStateUpdated($saveRecord)
187-
->disabled(fn($record) => $record?->getOriginal('write_protected')),
187+
->disabled(fn ($record) => $record?->getOriginal('write_protected')),
188188

189189
TextInput::make('title')
190190
->label(__('media::fields.title'))
191191
->live(onBlur: true)
192192
->afterStateUpdated($saveRecord)
193-
->disabled(fn($record) => $record?->getOriginal('write_protected')),
193+
->disabled(fn ($record) => $record?->getOriginal('write_protected')),
194194

195195
TextInput::make('alt')
196196
->label(__('media::fields.alt_text'))
197197
->live(onBlur: true)
198198
->afterStateUpdated($saveRecord)
199-
->disabled(fn($record) => $record?->getOriginal('write_protected')),
199+
->disabled(fn ($record) => $record?->getOriginal('write_protected')),
200200

201201
Textarea::make('description')
202202
->label(__('media::fields.description'))
203203
->live(onBlur: true)
204204
->afterStateUpdated($saveRecord)
205-
->disabled(fn($record) => $record?->getOriginal('write_protected')),
205+
->disabled(fn ($record) => $record?->getOriginal('write_protected')),
206206
])
207207
->columns(2)
208208
->collapsed(),
@@ -212,7 +212,7 @@ public static function form(Form $form): Form
212212
TextInput::make('internal_note')
213213
->live(onBlur: true)
214214
->afterStateUpdated($saveRecord)
215-
->disabled(fn($record) => $record?->getOriginal('write_protected')),
215+
->disabled(fn ($record) => $record?->getOriginal('write_protected')),
216216
])
217217
->collapsed(),
218218
]);
@@ -231,30 +231,30 @@ public static function table(Table $table): Table
231231
: 'width: 60px; height: auto; margin-top: 20px;';
232232

233233
if ($livewire->isSelecting) {
234-
$style = $baseStyle . 'opacity: 0.5;';
234+
$style = $baseStyle.'opacity: 0.5;';
235235

236236
if (in_array($record->id, $livewire->selected)) {
237-
$style = $baseStyle . 'outline: 4px solid rgb(59 130 246); opacity: 1;';
237+
$style = $baseStyle.'outline: 4px solid rgb(59 130 246); opacity: 1;';
238238
}
239239

240240
return [
241241
'class' => 'rounded-lg cursor-pointer',
242242
'style' => $style,
243-
'wire:click.stop' => "\$set('selected', " .
243+
'wire:click.stop' => "\$set('selected', ".
244244
(in_array($record->id, $livewire->selected)
245245
? json_encode(array_values(array_diff($livewire->selected, [$record->id])))
246246
: json_encode(array_merge($livewire->selected, [$record->id]))
247-
) . ')',
247+
).')',
248248
];
249249
}
250250

251251
return [
252252
'class' => 'rounded-lg cursor-pointer',
253253
'style' => $baseStyle,
254-
'x-on:click' => '$wire.call("mountAction", "edit", { record: ' . $record->id . ' })',
254+
'x-on:click' => '$wire.call("mountAction", "edit", { record: '.$record->id.' })',
255255
];
256256
})
257-
->tooltip(fn($record) => $record->title ?? __('media::fields.no_title'))
257+
->tooltip(fn ($record) => $record->title ?? __('media::fields.no_title'))
258258
->searchable(true, function (Builder $query, string $search) {
259259
$query->whereHas('translations', function (Builder $query) use ($search) {
260260
$query->where('locale', app()->getLocale())
@@ -274,8 +274,8 @@ public static function table(Table $table): Table
274274
->limit(50)
275275
->searchable()
276276
->sortable()
277-
->visible(fn($record) => $record && !str_starts_with($record->mime_type ?? '', 'image/'))
278-
->extraAttributes(fn() => ['style' => 'margin-top: 10px; word-break: break-all;']),
277+
->visible(fn ($record) => $record && ! str_starts_with($record->mime_type ?? '', 'image/'))
278+
->extraAttributes(fn () => ['style' => 'margin-top: 10px; word-break: break-all;']),
279279
]),
280280
])
281281
->headerActionsPosition(HeaderActionsPosition::Bottom)
@@ -286,10 +286,10 @@ public static function table(Table $table): Table
286286
? __('media::fields.end_selection')
287287
: __('media::fields.select_multiple');
288288
})
289-
->icon(fn($livewire) => $livewire->isSelecting ? 'heroicon-m-x-mark' : 'heroicon-m-squares-2x2')
290-
->color(fn($livewire) => $livewire->isSelecting ? 'gray' : 'primary')
289+
->icon(fn ($livewire) => $livewire->isSelecting ? 'heroicon-m-x-mark' : 'heroicon-m-squares-2x2')
290+
->color(fn ($livewire) => $livewire->isSelecting ? 'gray' : 'primary')
291291
->action(function ($livewire) {
292-
$livewire->isSelecting = !$livewire->isSelecting;
292+
$livewire->isSelecting = ! $livewire->isSelecting;
293293
$livewire->selected = [];
294294
}),
295295

@@ -298,7 +298,7 @@ public static function table(Table $table): Table
298298
$count = count($livewire->selected);
299299

300300
return $count > 0
301-
? __('media::fields.delete_selected') . " ({$count} " . trans_choice('media::fields.file|files', $count) . ')'
301+
? __('media::fields.delete_selected')." ({$count} ".trans_choice('media::fields.file|files', $count).')'
302302
: __('media::fields.delete_selected');
303303
})
304304
->icon('heroicon-m-trash')
@@ -307,12 +307,12 @@ public static function table(Table $table): Table
307307
->modalHeading(function ($livewire) {
308308
$count = count($livewire->selected);
309309

310-
return __('media::fields.delete_selected') . " ({$count} " . trans_choice('media::fields.file|files', $count) . ')';
310+
return __('media::fields.delete_selected')." ({$count} ".trans_choice('media::fields.file|files', $count).')';
311311
})
312312
->modalDescription(__('media::fields.delete_confirmation'))
313313
->modalSubmitActionLabel(__('media::fields.yes_delete'))
314314
->modalCancelActionLabel(__('media::fields.cancel'))
315-
->visible(fn($livewire) => $livewire->isSelecting && !empty($livewire->selected))
315+
->visible(fn ($livewire) => $livewire->isSelecting && ! empty($livewire->selected))
316316
->action(function ($livewire) {
317317
$successCount = 0;
318318
$errorCount = 0;
@@ -321,11 +321,11 @@ public static function table(Table $table): Table
321321
foreach ($livewire->selected as $id) {
322322
try {
323323
$media = Media::find($id);
324-
if (!$media) {
324+
if (! $media) {
325325
continue;
326326
}
327327

328-
if (!auth()->user()->can('delete', $media)) {
328+
if (! auth()->user()->can('delete', $media)) {
329329
$protectedCount++;
330330

331331
continue;
@@ -341,7 +341,7 @@ public static function table(Table $table): Table
341341
$media->delete();
342342
$successCount++;
343343
} catch (\Exception $e) {
344-
Log::error('Media deletion failed: ' . $e->getMessage(), [
344+
Log::error('Media deletion failed: '.$e->getMessage(), [
345345
'media_id' => $id,
346346
]);
347347
$errorCount++;
@@ -351,15 +351,15 @@ public static function table(Table $table): Table
351351
if ($successCount > 0) {
352352
Notification::make()
353353
->success()
354-
->title($successCount . ' ' . trans_choice('media::fields.file_deleted|files_deleted', $successCount))
354+
->title($successCount.' '.trans_choice('media::fields.file_deleted|files_deleted', $successCount))
355355
->send();
356356
}
357357

358358
if ($protectedCount > 0) {
359359
Notification::make()
360360
->warning()
361361
->title(__('media::fields.protected_skipped'))
362-
->body($protectedCount . ' ' . trans_choice('media::fields.protected_file_skipped|protected_files_skipped', $protectedCount))
362+
->body($protectedCount.' '.trans_choice('media::fields.protected_file_skipped|protected_files_skipped', $protectedCount))
363363
->persistent()
364364
->send();
365365
}
@@ -368,7 +368,7 @@ public static function table(Table $table): Table
368368
Notification::make()
369369
->danger()
370370
->title(__('media::fields.delete_error'))
371-
->body($errorCount . ' ' . trans_choice('media::fields.file_could_not_be_deleted|files_could_not_be_deleted', $errorCount))
371+
->body($errorCount.' '.trans_choice('media::fields.file_could_not_be_deleted|files_could_not_be_deleted', $errorCount))
372372
->persistent()
373373
->send();
374374
}
@@ -391,11 +391,11 @@ public static function table(Table $table): Table
391391
->color('danger')
392392
->icon('heroicon-m-trash')
393393
->requiresConfirmation()
394-
->modalHeading(fn($record) => __('media::fields.delete_file_heading', ['title' => $record->title ?: $record->name]))
394+
->modalHeading(fn ($record) => __('media::fields.delete_file_heading', ['title' => $record->title ?: $record->name]))
395395
->modalDescription(__('media::fields.delete_file_description'))
396396
->modalSubmitActionLabel(__('media::fields.yes_delete'))
397397
->modalCancelActionLabel(__('media::fields.cancel'))
398-
->hidden(fn(Media $record) => !auth()->user()->can('delete', $record) || $record->getOriginal('write_protected'))
398+
->hidden(fn (Media $record) => ! auth()->user()->can('delete', $record) || $record->getOriginal('write_protected'))
399399
->before(function ($record) {
400400
try {
401401
if ($record->getOriginal('write_protected')) {
@@ -432,7 +432,7 @@ public static function table(Table $table): Table
432432

433433
return redirect(static::getUrl('index'));
434434
} catch (\Exception $e) {
435-
Log::error('Media deletion failed: ' . $e->getMessage(), [
435+
Log::error('Media deletion failed: '.$e->getMessage(), [
436436
'media_id' => $record->id,
437437
'file_name' => $record->file_name,
438438
]);
@@ -468,7 +468,7 @@ public static function table(Table $table): Table
468468
'documents' => __('media::fields.documents'),
469469
])
470470
->query(function (Builder $query, array $data) {
471-
if (!$data['value']) {
471+
if (! $data['value']) {
472472
return $query;
473473
}
474474

@@ -563,25 +563,25 @@ public static function table(Table $table): Table
563563
$uploader = $media->uploader;
564564
if ($uploader && method_exists($uploader, 'getName')) {
565565
return [
566-
'id' => $media->uploader_type . '::' . $media->uploader_id,
566+
'id' => $media->uploader_type.'::'.$media->uploader_id,
567567
'name' => $uploader->getName(),
568568
];
569569
}
570570
if ($uploader && isset($uploader->name)) {
571571
return [
572-
'id' => $media->uploader_type . '::' . $media->uploader_id,
572+
'id' => $media->uploader_type.'::'.$media->uploader_id,
573573
'name' => $uploader->name,
574574
];
575575
}
576576

577577
return null;
578578
})
579579
->filter()
580-
->unique(fn(array $item): string => $item['id'])
580+
->unique(fn (array $item): string => $item['id'])
581581
->pluck('name', 'id')
582582
->toArray();
583583

584-
if (!empty($uploaders)) {
584+
if (! empty($uploaders)) {
585585
$typeName = class_basename($type);
586586
$options[$typeName] = $uploaders;
587587
}
@@ -590,7 +590,7 @@ public static function table(Table $table): Table
590590
return $options;
591591
})
592592
->query(function (Builder $query, array $data) {
593-
if (!$data['value']) {
593+
if (! $data['value']) {
594594
return $query;
595595
}
596596

@@ -615,7 +615,7 @@ public static function table(Table $table): Table
615615
'year' => __('media::fields.year'),
616616
])
617617
->query(function (Builder $query, array $data) {
618-
if (!$data['value']) {
618+
if (! $data['value']) {
619619
return $query;
620620
}
621621

0 commit comments

Comments
 (0)