Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
markvaneijk authored and github-actions[bot] committed Oct 31, 2024
1 parent 145b8fc commit 5d58897
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
24 changes: 12 additions & 12 deletions src/Resources/RedirectResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,34 +54,34 @@ public static function form(Form $form): Form
->prefixIcon('heroicon-o-link')
->options(Site::orderBy('default', 'desc')->orderBy('name', 'asc')->pluck('name', 'ulid'))
->default(Site::where('default', true)->first()?->ulid)
->visible(fn() => Schema::hasColumn('redirects', 'content_ulid') && Site::count() > 0)
->hidden(fn() => Schema::hasColumn('redirects', 'content_ulid') && Site::count() === 1),
->visible(fn () => Schema::hasColumn('redirects', 'content_ulid') && Site::count() > 0)
->hidden(fn () => Schema::hasColumn('redirects', 'content_ulid') && Site::count() === 1),
Select::make('country_code')
->label(__('Country'))
->columnSpan(4)
->placeholder(__('Select Country'))
->prefixIcon('heroicon-o-globe-europe-africa')
->options(Language::whereNotNull('country_code')->distinct('country_code')->get()->mapWithKeys(fn($language) => [
$language->code => '<img src="data:image/svg+xml;base64,' . base64_encode(file_get_contents(base_path('vendor/vormkracht10/backstage/resources/img/flags/' . $language->code . '.svg'))) . '" class="w-5 inline-block relative" style="top: -1px; margin-right: 3px;"> ' . Locale::getDisplayLanguage($language->code, app()->getLocale())
->options(Language::whereNotNull('country_code')->distinct('country_code')->get()->mapWithKeys(fn ($language) => [
$language->code => '<img src="data:image/svg+xml;base64,' . base64_encode(file_get_contents(base_path('vendor/vormkracht10/backstage/resources/img/flags/' . $language->code . '.svg'))) . '" class="w-5 inline-block relative" style="top: -1px; margin-right: 3px;"> ' . Locale::getDisplayLanguage($language->code, app()->getLocale()),
])->sort())
->allowHtml()
->default(Language::whereNotNull('country_code')->distinct('country_code')->count() === 1 ? Language::whereNotNull('country_code')->first()->country_code : null)
->visible(fn() => Schema::hasColumn('redirects', 'content_ulid') && Language::whereNotNull('country_code')->distinct('country_code')->count() > 0)
->hidden(fn() => Schema::hasColumn('redirects', 'content_ulid') && Language::whereNotNull('country_code')->distinct('country_code')->count() === 1),
->visible(fn () => Schema::hasColumn('redirects', 'content_ulid') && Language::whereNotNull('country_code')->distinct('country_code')->count() > 0)
->hidden(fn () => Schema::hasColumn('redirects', 'content_ulid') && Language::whereNotNull('country_code')->distinct('country_code')->count() === 1),
Select::make('language_code')
->label(__('Language'))
->columnSpan(4)
->placeholder(__('Select Language'))
->prefixIcon('heroicon-o-language')
->options(
Language::get()->mapWithKeys(fn($language) => [
$language->code => '<img src="data:image/svg+xml;base64,' . base64_encode(file_get_contents(base_path('vendor/vormkracht10/backstage/resources/img/flags/' . $language->code . '.svg'))) . '" class="w-5 inline-block relative" style="top: -1px; margin-right: 3px;"> ' . Locale::getDisplayLanguage($language->code, app()->getLocale())
Language::get()->mapWithKeys(fn ($language) => [
$language->code => '<img src="data:image/svg+xml;base64,' . base64_encode(file_get_contents(base_path('vendor/vormkracht10/backstage/resources/img/flags/' . $language->code . '.svg'))) . '" class="w-5 inline-block relative" style="top: -1px; margin-right: 3px;"> ' . Locale::getDisplayLanguage($language->code, app()->getLocale()),
])->sort()
)
->allowHtml()
->default(Language::count() === 1 ? Language::first()->code : Language::where('default', true)->first()->code)
->visible(fn() => Schema::hasColumn('redirects', 'content_ulid') && Language::count() > 0)
->hidden(fn() => Schema::hasColumn('redirects', 'content_ulid') && Language::count() === 1),
->visible(fn () => Schema::hasColumn('redirects', 'content_ulid') && Language::count() > 0)
->hidden(fn () => Schema::hasColumn('redirects', 'content_ulid') && Language::count() === 1),
TextInput::make('source')
->label(__('Source'))
->columnSpan(12)
Expand All @@ -100,7 +100,7 @@ public static function form(Form $form): Form
->label(__('Type'))
->columnSpan(4)
->native(false)
->options(collect(config('redirects.status_codes'))->map(fn(string $type, int $code) => $type . ' (' . $code . ')'))
->options(collect(config('redirects.status_codes'))->map(fn (string $type, int $code) => $type . ' (' . $code . ')'))
->searchable()
->required()
->default(config('redirects.default_status_code'))
Expand All @@ -112,7 +112,7 @@ public static function form(Form $form): Form
->placeholder('Content')
->prefixIcon('heroicon-o-link')
->helperText(__('Select a content page to redirect to the current URL.'))
->visible(fn() => Schema::hasColumn('redirects', 'content_ulid')),
->visible(fn () => Schema::hasColumn('redirects', 'content_ulid')),
TextInput::make('destination')
->label(__('Destination'))
->columnSpan(12)
Expand Down
3 changes: 1 addition & 2 deletions src/Resources/RedirectResource/Pages/ListRedirects.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

use Filament\Actions;
use Filament\Actions\ActionGroup;
use Filament\Support\Colors\Color;
use Filament\Support\Enums\ActionSize;
use Filament\Resources\Pages\ListRecords;
use Filament\Support\Enums\ActionSize;
use Vormkracht10\FilamentRedirects\Imports\RedirectImporter;
use Vormkracht10\FilamentRedirects\Resources\RedirectResource;

Expand Down

0 comments on commit 5d58897

Please sign in to comment.