diff --git a/app/Livewire/Settings/Appearance.php b/app/Livewire/Settings/Appearance.php index 7550e32..f47cf83 100644 --- a/app/Livewire/Settings/Appearance.php +++ b/app/Livewire/Settings/Appearance.php @@ -2,9 +2,11 @@ namespace App\Livewire\Settings; +use Livewire\Attributes\Layout; use Livewire\Attributes\Title; use Livewire\Component; +#[Layout('layouts::settings')] #[Title('Appearance settings')] class Appearance extends Component { diff --git a/app/Livewire/Settings/Profile.php b/app/Livewire/Settings/Profile.php index db7bf31..adb9490 100644 --- a/app/Livewire/Settings/Profile.php +++ b/app/Livewire/Settings/Profile.php @@ -7,9 +7,11 @@ use Flux\Flux; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Support\Facades\Auth; use Livewire\Attributes\Computed; +use Livewire\Attributes\Layout; use Livewire\Attributes\Title; use Livewire\Component; +#[Layout('layouts::settings')] #[Title('Profile settings')] class Profile extends Component { diff --git a/app/Livewire/Settings/Security.php b/app/Livewire/Settings/Security.php index 7064d80..1b3f017 100644 --- a/app/Livewire/Settings/Security.php +++ b/app/Livewire/Settings/Security.php @@ -13,11 +13,13 @@ use Laravel\Fortify\Actions\EnableTwoFactorAuthentication; use Laravel\Fortify\Features; use Laravel\Fortify\Fortify; use Livewire\Attributes\Computed; +use Livewire\Attributes\Layout; use Livewire\Attributes\Locked; use Livewire\Attributes\Title; use Livewire\Attributes\Validate; use Livewire\Component; +#[Layout('layouts::settings')] #[Title('Security settings')] class Security extends Component { diff --git a/resources/views/components/settings/layout.blade.php b/resources/views/components/settings/layout.blade.php index 3a65247..d23143e 100644 --- a/resources/views/components/settings/layout.blade.php +++ b/resources/views/components/settings/layout.blade.php @@ -1,20 +1,12 @@ -
-
- - {{ __('Profile') }} - {{ __('Security') }} - {{ __('Appearance') }} - -
- - - -
- {{ $heading ?? '' }} - {{ $subheading ?? '' }} - -
- {{ $slot }} +
+
+
+ {{ $heading ?? '' }} + {{ $subheading ?? '' }}
+ +
+ {{ $slot }} +
diff --git a/resources/views/layouts/settings.blade.php b/resources/views/layouts/settings.blade.php new file mode 100644 index 0000000..f679dca --- /dev/null +++ b/resources/views/layouts/settings.blade.php @@ -0,0 +1,97 @@ + + + + @include('partials.head') + + +
+ + +
+
+ {{ $slot }} +
+
+
+ + @persist('toast') + + + + @endpersist + + @fluxScripts + + diff --git a/resources/views/livewire/chat/conversation-list.blade.php b/resources/views/livewire/chat/conversation-list.blade.php index 6114ec9..6849b0c 100644 --- a/resources/views/livewire/chat/conversation-list.blade.php +++ b/resources/views/livewire/chat/conversation-list.blade.php @@ -8,7 +8,63 @@
- {{ __('Live') }} +
+ {{ __('Live') }} + + + + + +
+
+ + +
+
{{ auth()->user()->name }}
+
{{ auth()->user()->email }}
+
+
+
+ + + + + {{ __('Profile settings') }} + + + + {{ __('Password and 2FA') }} + + + + {{ __('Appearance') }} + + + + +
+ @csrf + + {{ __('Log out') }} + +
+
+
+
get(route('dashboard')) ->assertOk() ->assertSee('Inbox') + ->assertSee('Profile settings') + ->assertSee('Password and 2FA') ->assertDontSee('Repository') ->assertDontSee('Documentation'); }); diff --git a/tests/Feature/Settings/ProfileUpdateTest.php b/tests/Feature/Settings/ProfileUpdateTest.php index 6d30fee..4c8f7c1 100644 --- a/tests/Feature/Settings/ProfileUpdateTest.php +++ b/tests/Feature/Settings/ProfileUpdateTest.php @@ -2,12 +2,21 @@ use App\Livewire\Settings\Profile; use App\Models\User; +use Illuminate\Foundation\Testing\LazilyRefreshDatabase; use Livewire\Livewire; +uses(LazilyRefreshDatabase::class); + test('profile page is displayed', function () { $this->actingAs($user = User::factory()->create()); - $this->get('/settings/profile')->assertOk(); + $this->get('/settings/profile') + ->assertOk() + ->assertSee('Profile') + ->assertSee('Name') + ->assertSee('Email') + ->assertDontSee('Repository') + ->assertDontSee('Documentation'); }); test('profile information can be updated', function () { @@ -73,4 +82,4 @@ test('correct password must be provided to delete account', function () { $response->assertHasErrors(['password']); expect($user->fresh())->not->toBeNull(); -}); \ No newline at end of file +}); diff --git a/tests/Feature/Settings/SecurityTest.php b/tests/Feature/Settings/SecurityTest.php index f320884..dc4f230 100644 --- a/tests/Feature/Settings/SecurityTest.php +++ b/tests/Feature/Settings/SecurityTest.php @@ -2,10 +2,13 @@ use App\Livewire\Settings\Security; use App\Models\User; +use Illuminate\Foundation\Testing\LazilyRefreshDatabase; use Illuminate\Support\Facades\Hash; use Laravel\Fortify\Features; use Livewire\Livewire; +uses(LazilyRefreshDatabase::class); + beforeEach(function () { $this->skipUnlessFortifyHas(Features::twoFactorAuthentication()); @@ -102,4 +105,4 @@ test('correct password must be provided to update password', function () { ->call('updatePassword'); $response->assertHasErrors(['current_password']); -}); \ No newline at end of file +});