mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-01-24 12:03:17 +00:00
🛠️ Refactor Blade views for Livewire component consistency, streamline login view, and improve key usage across components
- Replaced `state` and `computed` with `Livewire\Component` implementations in `language/selector.blade.php` for enhanced maintainability. - Adjusted `login.blade.php` syntax for dynamic href generation and removed commented-out sign-up link. - Added unique `wire:key` attributes to iterable elements for enhanced performance and reactivity. - Simplified controller routing and corrected indentation in `web.php`, improving clarity.
This commit is contained in:
@@ -18,11 +18,8 @@ use Livewire\Attributes\Validate;
|
|||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
||||||
|
|
||||||
new
|
new #[Layout('components.layouts.auth')]
|
||||||
#[Layout('components.layouts.auth')]
|
class extends Component {
|
||||||
#[SeoDataAttribute(key: 'login')]
|
|
||||||
class extends Component
|
|
||||||
{
|
|
||||||
use SeoTrait;
|
use SeoTrait;
|
||||||
|
|
||||||
#[Validate('required|string|email')]
|
#[Validate('required|string|email')]
|
||||||
@@ -208,7 +205,8 @@ class extends Component
|
|||||||
$this->authError = null;
|
$this->authError = null;
|
||||||
$this->mount();
|
$this->mount();
|
||||||
}
|
}
|
||||||
}; ?>
|
};
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="flex min-h-screen" x-data="nostrLogin"
|
<div class="flex min-h-screen" x-data="nostrLogin"
|
||||||
x-init="initErrorPolling"
|
x-init="initErrorPolling"
|
||||||
@@ -258,7 +256,7 @@ class extends Component
|
|||||||
<div>
|
<div>
|
||||||
<flux:button
|
<flux:button
|
||||||
primary
|
primary
|
||||||
:href="'lightning:'.$this->lnurl"
|
href="lightning:{{ $this->lnurl }}"
|
||||||
>
|
>
|
||||||
{{ __('Click to connect') }}
|
{{ __('Click to connect') }}
|
||||||
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 512 512"
|
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 512 512"
|
||||||
@@ -273,12 +271,6 @@ class extends Component
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Sign up Link -->
|
|
||||||
{{--@if (Route::has('register'))
|
|
||||||
<flux:subheading class="text-center">
|
|
||||||
First time around here? <flux:link href="{{ route('register') }}" wire:navigate>Sign up for free</flux:link>
|
|
||||||
</flux:subheading>
|
|
||||||
@endif--}}
|
|
||||||
<!-- Language Selection Accordion -->
|
<!-- Language Selection Accordion -->
|
||||||
<livewire:language.selector/>
|
<livewire:language.selector/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ class extends Component {
|
|||||||
{
|
{
|
||||||
if (!auth()->check()) {
|
if (!auth()->check()) {
|
||||||
$this->redirectRoute('login');
|
$this->redirectRoute('login');
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
$this->country = request()->route('country', config('app.domain_country'));
|
$this->country = request()->route('country', config('app.domain_country'));
|
||||||
}
|
}
|
||||||
@@ -90,7 +92,7 @@ class extends Component {
|
|||||||
<flux:separator class="my-4"/>
|
<flux:separator class="my-4"/>
|
||||||
<div class="space-y-3">
|
<div class="space-y-3">
|
||||||
@foreach($myUpcomingEvents as $event)
|
@foreach($myUpcomingEvents as $event)
|
||||||
<a href="{{ route('meetups.landingpage-event', ['meetup' => $event->meetup->slug, 'event' => $event->id, 'country' => $event->meetup->city->country->code]) }}"
|
<a wire:key="event-{{ $event->id }}" href="{{ route('meetups.landingpage-event', ['meetup' => $event->meetup->slug, 'event' => $event->id, 'country' => $event->meetup->city->country->code]) }}"
|
||||||
class="block hover:bg-zinc-50 dark:hover:bg-zinc-800 rounded-lg p-3 -m-3 transition-colors">
|
class="block hover:bg-zinc-50 dark:hover:bg-zinc-800 rounded-lg p-3 -m-3 transition-colors">
|
||||||
<div class="flex items-start justify-between gap-3">
|
<div class="flex items-start justify-between gap-3">
|
||||||
<flux:avatar size="xl" :src="$event->meetup->getFirstMediaUrl('logo', 'thumb')"/>
|
<flux:avatar size="xl" :src="$event->meetup->getFirstMediaUrl('logo', 'thumb')"/>
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use function Livewire\Volt\{state, computed};
|
use Livewire\Component;
|
||||||
|
|
||||||
state(['langCountry' => fn() => session('lang_country', config('lang-country.fallback'))]);
|
new class extends Component {
|
||||||
|
public $langCountry;
|
||||||
|
|
||||||
$languages = computed(function () {
|
public function mount() {
|
||||||
|
$this->langCountry = session('lang_country', config('lang-country.fallback'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLanguagesProperty() {
|
||||||
// Scan lang folder for available languages
|
// Scan lang folder for available languages
|
||||||
$availableLanguages = collect(glob(base_path('lang/*.json')))
|
$availableLanguages = collect(glob(base_path('lang/*.json')))
|
||||||
->map(fn($file) => pathinfo($file, PATHINFO_FILENAME))
|
->map(fn($file) => pathinfo($file, PATHINFO_FILENAME))
|
||||||
@@ -39,10 +44,11 @@ $languages = computed(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $options;
|
return $options;
|
||||||
});
|
}
|
||||||
|
|
||||||
$updateLanguage = function () {
|
public function updateLanguage() {
|
||||||
return redirect()->route('lang_country.switch', ['lang_country' => $this->langCountry]);
|
return redirect()->route('lang_country.switch', ['lang_country' => $this->langCountry]);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -55,7 +61,7 @@ $updateLanguage = function () {
|
|||||||
:placeholder="__('Sprache wählen')"
|
:placeholder="__('Sprache wählen')"
|
||||||
>
|
>
|
||||||
@foreach($this->languages as $option)
|
@foreach($this->languages as $option)
|
||||||
<flux:select.option value="{{ $option['value'] }}">
|
<flux:select.option value="{{ $option['value'] }}" wire:key="language-option-{{ $loop->index }}">
|
||||||
<div class="flex items-center space-x-2">
|
<div class="flex items-center space-x-2">
|
||||||
<img alt="{{ str($option['value'])->after('-')->lower() }}"
|
<img alt="{{ str($option['value'])->after('-')->lower() }}"
|
||||||
src="{{ asset('vendor/blade-flags/country-'.str($option['value'])->after('-')->lower().'.svg') }}"
|
src="{{ asset('vendor/blade-flags/country-'.str($option['value'])->after('-')->lower().'.svg') }}"
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ new class extends Component {
|
|||||||
<flux:select.search class="px-4" placeholder="{{ __('Suche Zeitzone...') }}"/>
|
<flux:select.search class="px-4" placeholder="{{ __('Suche Zeitzone...') }}"/>
|
||||||
</x-slot>
|
</x-slot>
|
||||||
@foreach($timezones as $timezone)
|
@foreach($timezones as $timezone)
|
||||||
<flux:select.option value="{{ $timezone }}">
|
<flux:select.option wire:key="timezone-{{ $timezone }}" value="{{ $timezone }}">
|
||||||
{{ $timezone }}
|
{{ $timezone }}
|
||||||
</flux:select.option>
|
</flux:select.option>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use Laravel\Nightwatch\Http\Middleware\Sample;
|
use Laravel\Nightwatch\Http\Middleware\Sample;
|
||||||
use Livewire\Volt\Volt;
|
|
||||||
|
|
||||||
// Redirect root URL to 'welcome' page
|
// Redirect root URL to 'welcome' page
|
||||||
Route::redirect('/', 'welcome');
|
Route::redirect('/', 'welcome');
|
||||||
|
|||||||
Reference in New Issue
Block a user