mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2025-12-26 15:30:15 +00:00
✨ Improve conditional rendering and authentication logic in views
- Updated multiple views to conditionally render actions based on authentication state for a better user experience. - Added login links where actions require authentication.
This commit is contained in:
@@ -3,30 +3,36 @@
|
||||
use Livewire\Volt\Component;
|
||||
|
||||
new class extends Component {
|
||||
public $currentRoute = '';
|
||||
public $country = 'de';
|
||||
public $currentRouteName;
|
||||
public $currentRouteParams;
|
||||
public string $currentCountry = 'de';
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->currentRoute = request()->route()->getName();
|
||||
$this->country = request()->route('country');
|
||||
$this->currentCountry = request()->route('country', 'de');
|
||||
$this->currentRouteName = request()->route()->getName();
|
||||
$this->currentRouteParams = request()->route()->parameters();
|
||||
}
|
||||
|
||||
public function updatedCountry()
|
||||
public function updatedCurrentCountry()
|
||||
{
|
||||
$this->redirectRoute($this->currentRoute, ['country' => $this->country]);
|
||||
$this->currentRouteParams['country'] = $this->currentCountry;
|
||||
$this->redirectRoute($this->currentRouteName, $this->currentRouteParams);
|
||||
}
|
||||
}; ?>
|
||||
|
||||
<div>
|
||||
<flux:select variant="listbox" searchable placeholder="{{ __('Wähle dein Land...') }}" wire:model.live.debounce="country">
|
||||
<flux:select variant="listbox" searchable placeholder="{{ __('Wähle dein Land...') }}"
|
||||
wire:model.live.debounce="currentCountry">
|
||||
<x-slot name="search">
|
||||
<flux:select.search class="px-4" placeholder="{{ __('Suche dein Land...') }}"/>
|
||||
</x-slot>
|
||||
@foreach(\WW\Countries\Models\Country::all() as $country)
|
||||
<flux:select.option value="{{ str($country->iso_code)->lower() }}">
|
||||
<div class="flex items-center space-x-2">
|
||||
<img alt="{{ str($country->iso_code)->lower() }}" src="{{ asset('vendor/blade-flags/country-'.str($country->iso_code)->lower().'.svg') }}" width="24" height="12"/>
|
||||
<img alt="{{ str($country->iso_code)->lower() }}"
|
||||
src="{{ asset('vendor/blade-flags/country-'.str($country->iso_code)->lower().'.svg') }}"
|
||||
width="24" height="12"/>
|
||||
<span>{{ $country->name }}</span>
|
||||
</div>
|
||||
</flux:select.option>
|
||||
|
||||
Reference in New Issue
Block a user