mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2025-12-18 13:04:24 +00:00
✨ Enhance timezone support across application
- Introduced a `SetTimezone` middleware to dynamically apply user-specific timezones. - Added a `timezone chooser` component for users to select their timezone. - Enhanced date and time display in views with `asDate`, `asTime`, and `asDateTime` methods. - Updated `AppServiceProvider` to leverage `preventLazyLoading` in local environments and set custom `Carbon` instance for dates. - Expanded configuration with `user-timezone`. - Integrated timezone support into meetups and events for consistent scheduling.
This commit is contained in:
@@ -96,7 +96,7 @@ class extends Component {
|
||||
{{ $event->meetup->city->name }}, {{ $event->meetup->city->country->name }}
|
||||
</div>
|
||||
<flux:badge color="green" size="sm" class="mt-1">
|
||||
{{ $event->start->format('d.m.Y H:i') }}
|
||||
{{ $event->start->asDateTime() }}
|
||||
</flux:badge>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -100,16 +100,18 @@ class extends Component {
|
||||
|
||||
<flux:table.cell>
|
||||
@if($meetup->nextEvent && $meetup->nextEvent['start']->isFuture())
|
||||
<div class="flex flex-col gap-1">
|
||||
<flux:badge color="green" size="sm">
|
||||
{{ $meetup->nextEvent['start']->format('d.m.Y H:i') }}
|
||||
</flux:badge>
|
||||
<div class="text-xs text-zinc-500 flex items-center gap-2">
|
||||
<span>{{ $meetup->nextEvent['attendees'] }} {{ __('Zusagen') }}</span>
|
||||
<flux:separator vertical/>
|
||||
<span>{{ $meetup->nextEvent['might_attendees'] }} {{ __('Vielleicht') }}</span>
|
||||
<a href="{{ route('meetups.landingpage-event', ['meetup' => $meetup, 'event' => $meetup->nextEvent['id'], 'country' => $country]) }}">
|
||||
<div class="flex flex-col gap-1">
|
||||
<flux:badge color="green" size="sm">
|
||||
{{ $meetup->nextEvent['start']->asDateTime() }}
|
||||
</flux:badge>
|
||||
<div class="text-xs text-zinc-500 flex items-center gap-2">
|
||||
<span>{{ $meetup->nextEvent['attendees'] }} {{ __('Zusagen') }}</span>
|
||||
<flux:separator vertical/>
|
||||
<span>{{ $meetup->nextEvent['might_attendees'] }} {{ __('Vielleicht') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
@endif
|
||||
</flux:table.cell>
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ class extends Component {
|
||||
<flux:card class="max-w-3xl">
|
||||
<flux:heading size="xl" class="mb-4">
|
||||
<flux:icon.calendar class="inline w-6 h-6 mr-2"/>
|
||||
{{ $event->start->format('d.m.Y') }}
|
||||
{{ $event->start->asDateTime() }}
|
||||
</flux:heading>
|
||||
|
||||
<div class="space-y-4">
|
||||
@@ -171,9 +171,9 @@ class extends Component {
|
||||
<div class="flex items-center text-zinc-700 dark:text-zinc-300">
|
||||
<flux:icon.clock class="w-5 h-5 mr-3"/>
|
||||
<div>
|
||||
<div class="font-semibold">{{ $event->start->format('H:i') }} Uhr</div>
|
||||
<div class="font-semibold">{{ $event->start->asTime() }} Uhr</div>
|
||||
<div
|
||||
class="text-sm text-zinc-600 dark:text-zinc-400">{{ $event->start->isoFormat('dddd, D. MMMM YYYY') }}</div>
|
||||
class="text-sm text-zinc-600 dark:text-zinc-400">{{ $event->start->asDate() }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -215,12 +215,12 @@ class extends Component {
|
||||
@foreach($events as $event)
|
||||
<flux:card size="sm" class="h-full flex flex-col">
|
||||
<flux:heading class="flex items-center gap-2">
|
||||
{{ $event->start->format('d.m.Y') }}
|
||||
{{ $event->start->asDate() }}
|
||||
</flux:heading>
|
||||
|
||||
<flux:text class="mt-2 text-sm text-zinc-600 dark:text-zinc-400">
|
||||
<flux:icon.clock class="inline w-4 h-4"/>
|
||||
{{ $event->start->format('H:i') }} Uhr
|
||||
{{ $event->start->asTime() }} Uhr
|
||||
</flux:text>
|
||||
|
||||
@if($event->location)
|
||||
|
||||
@@ -115,6 +115,12 @@ class extends Component {
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div>
|
||||
<flux:heading size="lg" class="mb-4">{{ __('Zeitzone') }}</flux:heading>
|
||||
<flux:subheading class="mb-6">{{ __('Wähle deine Zeitzone aus...') }}</flux:subheading>
|
||||
<livewire:timezone.chooser :withRedirect="false"/>
|
||||
</div>
|
||||
|
||||
<div class="my-8">
|
||||
<flux:heading size="lg" class="mb-4">{{ __('Spracheinstellungen') }}</flux:heading>
|
||||
<flux:subheading class="mb-6">{{ __('Wähle deine Sprache aus...') }}</flux:subheading>
|
||||
|
||||
52
resources/views/livewire/timezone/chooser.blade.php
Normal file
52
resources/views/livewire/timezone/chooser.blade.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use Livewire\Volt\Component;
|
||||
use Flux\Flux;
|
||||
|
||||
new class extends Component {
|
||||
public bool $withRedirect = true;
|
||||
public $currentRouteName;
|
||||
public $currentRouteParams;
|
||||
public string $selectedTimezone = 'UTC';
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->currentRouteName = request()->route()->getName();
|
||||
$this->currentRouteParams = request()->route()->parameters();
|
||||
$this->selectedTimezone = config('app.timezone', 'UTC');
|
||||
}
|
||||
|
||||
public function updatedSelectedTimezone()
|
||||
{
|
||||
// Handle timezone change here
|
||||
// You can emit an event or update user settings
|
||||
auth()->user()->update([
|
||||
'timezone' => $this->selectedTimezone,
|
||||
]);
|
||||
Flux::toast(text: __('Zeitzone erfolgreich aktualisiert'), heading: __('Zeitzone'), variant: 'success');
|
||||
if ($this->withRedirect) {
|
||||
$this->redirectRoute($this->currentRouteName, $this->currentRouteParams, navigate: true);
|
||||
}
|
||||
}
|
||||
|
||||
public function with(): array
|
||||
{
|
||||
return [
|
||||
'timezones' => \DateTimeZone::listIdentifiers(),
|
||||
];
|
||||
}
|
||||
}; ?>
|
||||
|
||||
<div>
|
||||
<flux:select variant="listbox" searchable placeholder="{{ __('Wähle deine Zeitzone...') }}"
|
||||
wire:model.live.debounce="selectedTimezone">
|
||||
<x-slot name="search">
|
||||
<flux:select.search class="px-4" placeholder="{{ __('Suche Zeitzone...') }}"/>
|
||||
</x-slot>
|
||||
@foreach($timezones as $timezone)
|
||||
<flux:select.option value="{{ $timezone }}">
|
||||
{{ $timezone }}
|
||||
</flux:select.option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
</div>
|
||||
Reference in New Issue
Block a user