Archived
feat: redo user flow
This commit is contained in:
1 parent
a61f6cae81
commit
19f07b0068
10 files changed
+212
-82
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
<a {{ $attributes }} class="
|
||||
{{ Route::is($route)
|
||||
? 'text-nexi-red bg-gray-50 dark:text-nexi-purple dark:bg-zinc-800'
|
||||
: 'text-nexi-black dark:text-nexi-grey hover:text-nexi-red dark:hover:text-nexi-red hover:bg-gray-100 dark:hover:bg-zinc-500' }}
|
||||
? 'text-nexi-red bg-gray-50 dark:text-nexi-purple dark:bg-zinc-800 transition-colors duration-300'
|
||||
: 'text-nexi-black dark:text-nexi-grey hover:text-nexi-red dark:hover:text-nexi-red hover:bg-gray-100 dark:hover:bg-zinc-500 transition-colors duration-300' }}
|
||||
group flex items-center px-2 py-2 text-base font-medium rounded-md"
|
||||
>{{ $slot }}</a>
|
||||
@@ -44,9 +44,15 @@ new class extends Component
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true">
|
||||
{{-- TODO: Add User Image URL here --}}
|
||||
<img class="h-8 w-8 rounded-full bg-gray-50" src="" alt="">
|
||||
<img class="h-8 w-8 rounded-full bg-gray-50" src="{{ auth()->user()->profile }}" alt="">
|
||||
<span class="hidden lg:flex lg:items-center">
|
||||
<span class="ml-4 text-base font-semibold leading-6 text-nexi-black dark:text-nexi-grey" aria-hidden="true" x-data="{ name: '{{ auth()->user()->name }}' }" x-text="name" x-on:profile-updated.window="name = $event.detail.name"></span>
|
||||
<span class="ml-4 text-base font-semibold leading-6 text-nexi-black dark:text-nexi-grey" aria-hidden="true"
|
||||
x-data="{ firstname: '{{ auth()->user()->firstname }}', lastname: '{{ auth()->user()->lastname }}' }"
|
||||
x-text="firstname + ' ' + lastname"
|
||||
x-on:profile-updated.window="
|
||||
firstname = $event.detail.firstname;
|
||||
lastname = $event.detail.lastname;
|
||||
"></span>
|
||||
<svg class="ml-2 h-5 w-5 text-gray-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
||||
<path fill-rule="evenodd" d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
|
||||
@@ -8,12 +8,14 @@ use Livewire\Volt\Component;
|
||||
|
||||
new class extends Component
|
||||
{
|
||||
public string $name = '';
|
||||
public string $firstname = '';
|
||||
public string $lastname = '';
|
||||
public string $email = '';
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->name = auth()->user()->name;
|
||||
$this->firstname = auth()->user()->firstname;
|
||||
$this->lastname = auth()->user()->lastname;
|
||||
$this->email = auth()->user()->email;
|
||||
}
|
||||
|
||||
@@ -22,7 +24,8 @@ new class extends Component
|
||||
$user = auth()->user();
|
||||
|
||||
$validated = $this->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'firstname' => ['required', 'string', 'max:255'],
|
||||
'lastname' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'email', 'max:255', Rule::unique(User::class)->ignore($user->id)],
|
||||
]);
|
||||
|
||||
@@ -36,23 +39,6 @@ new class extends Component
|
||||
|
||||
$this->dispatch('profile-updated', name: $user->name);
|
||||
}
|
||||
|
||||
public function sendVerification(): void
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
if ($user->hasVerifiedEmail()) {
|
||||
$path = session('url.intended', RouteServiceProvider::HOME);
|
||||
|
||||
$this->redirect($path);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$user->sendEmailVerificationNotification();
|
||||
|
||||
session()->flash('status', 'verification-link-sent');
|
||||
}
|
||||
}; ?>
|
||||
|
||||
<section>
|
||||
@@ -68,33 +54,21 @@ new class extends Component
|
||||
|
||||
<form wire:submit="updateProfileInformation" class="mt-6 space-y-6">
|
||||
<div>
|
||||
<x-input-label for="name" :value="__('Name')" />
|
||||
<x-text-input wire:model="name" id="name" name="name" type="text" class="mt-1 block w-full" required autofocus autocomplete="name" />
|
||||
<x-input-error class="mt-2" :messages="$errors->get('name')" />
|
||||
<x-input-label for="firstname" :value="__('FirstName')" />
|
||||
<x-text-input wire:model="firstname" id="firstname" name="firstname" type="text" class="mt-1 block w-full" required autofocus autocomplete="first" />
|
||||
<x-input-error class="mt-2" :messages="$errors->get('firstname')" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<x-input-label for="lastname" :value="__('lastname')" />
|
||||
<x-text-input wire:model="lastname" id="lastname" name="lastname" type="text" class="mt-1 block w-full" required autofocus autocomplete="last" />
|
||||
<x-input-error class="mt-2" :messages="$errors->get('lastname')" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<x-input-label for="email" :value="__('Email')" />
|
||||
<x-text-input wire:model="email" id="email" name="email" type="email" class="mt-1 block w-full" required autocomplete="username" />
|
||||
<x-input-error class="mt-2" :messages="$errors->get('email')" />
|
||||
|
||||
@if (auth()->user() instanceof MustVerifyEmail && ! auth()->user()->hasVerifiedEmail())
|
||||
<div>
|
||||
<p class="text-sm mt-2 text-nexi-black dark:text-gray-200">
|
||||
{{ __('Your email address is unverified.') }}
|
||||
|
||||
<button wire:click.prevent="sendVerification" class="underline text-sm text-gray-600 dark:text-gray-400 hover:text-nexi-black dark:hover:text-gray-100 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:focus:ring-offset-nexi-black">
|
||||
{{ __('Click here to re-send the verification email.') }}
|
||||
</button>
|
||||
</p>
|
||||
|
||||
@if (session('status') === 'verification-link-sent')
|
||||
<p class="mt-2 font-medium text-sm text-green-600 dark:text-green-400">
|
||||
{{ __('A new verification link has been sent to your email address.') }}
|
||||
</p>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-4">
|
||||
|
||||
Reference in new issue
Block a user