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 30, 2024
1 parent 59a40d6 commit 25e0b1b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/Imports/RedirectImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Vormkracht10\FilamentRedirects\Imports;

use Vormkracht10\Redirects\Models\Redirect;
use Filament\Actions\Imports\ImportColumn;
use Filament\Actions\Imports\Importer;
use Filament\Actions\Imports\Models\Import;
use Vormkracht10\Redirects\Models\Redirect;

class RedirectImporter extends Importer
{
Expand Down
38 changes: 19 additions & 19 deletions src/Resources/RedirectResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

namespace Vormkracht10\FilamentRedirects\Resources;

use Locale;
use Filament\Tables;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Tables\Table;
use Filament\Resources\Resource;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Section;
use Illuminate\Support\Facades\Schema;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Vormkracht10\Backstage\Models\Site;
use Filament\Forms\Components\TextInput;
use Filament\Tables\Table;
use Illuminate\Support\Facades\Schema;
use Locale;
use Vormkracht10\Backstage\Models\Language;
use Vormkracht10\Redirects\Models\Redirect;
use Vormkracht10\Backstage\Models\Site;
use Vormkracht10\FilamentRedirects\Resources\RedirectResource\Pages;
use Vormkracht10\Redirects\Models\Redirect;

class RedirectResource extends Resource
{
Expand Down Expand Up @@ -54,26 +54,26 @@ 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-flag')
->options(Language::whereNotNull('country_code')->distinct('country_code')->get()->mapWithKeys(fn($language) => [$language->country_code => Locale::getDisplayRegion('-' . $language->country_code, app()->getLocale())])->sort())
->options(Language::whereNotNull('country_code')->distinct('country_code')->get()->mapWithKeys(fn ($language) => [$language->country_code => Locale::getDisplayRegion('-' . $language->country_code, app()->getLocale())])->sort())
->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 => Locale::getDisplayLanguage($language->code, app()->getLocale())])->sort())
->options(Language::get()->mapWithKeys(fn ($language) => [$language->code => Locale::getDisplayLanguage($language->code, app()->getLocale())])->sort())
->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 @@ -92,7 +92,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 @@ -104,7 +104,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

0 comments on commit 25e0b1b

Please sign in to comment.