mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2026-01-28 07:43:18 +00:00
🗑️ Remove obsolete pulse migration file, clean up unused directives in Blade templates, and streamline delete confirmation logic with Flux modals for improved UX and maintainability.
This commit is contained in:
53
resources/views/livewire/auth-button.blade.php
Normal file
53
resources/views/livewire/auth-button.blade.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use App\Support\NostrAuth;
|
||||
use Livewire\Attributes\On;
|
||||
use Livewire\Component;
|
||||
|
||||
new class extends Component
|
||||
{
|
||||
public bool $isLoggedIn = false;
|
||||
|
||||
public string $location = 'sidebar'; // 'sidebar' or 'navbar'
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->isLoggedIn = NostrAuth::check();
|
||||
}
|
||||
|
||||
#[On('nostrLoggedIn')]
|
||||
public function handleNostrLoggedIn(string $pubkey): void
|
||||
{
|
||||
NostrAuth::login($pubkey);
|
||||
$this->js('window.location.reload(true);');
|
||||
}
|
||||
|
||||
#[On('nostrLoggedOut')]
|
||||
public function handleNostrLoggedOut(): void
|
||||
{
|
||||
$this->isLoggedIn = false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<div x-data="nostrLogin">
|
||||
@if($isLoggedIn)
|
||||
@if($location === 'sidebar')
|
||||
<form method="post" action="{{ route('logout') }}">
|
||||
@csrf
|
||||
<flux:sidebar.item icon="arrow-right-start-on-rectangle" type="submit" wire:click="$dispatch('nostrLoggedOut')">Logout</flux:sidebar.item>
|
||||
</form>
|
||||
@else
|
||||
<form method="post" action="{{ route('logout') }}">
|
||||
@csrf
|
||||
<flux:navbar.item type="submit" icon="arrow-right-start-on-rectangle" wire:click="$dispatch('nostrLoggedOut')">Logout</flux:navbar.item>
|
||||
</form>
|
||||
@endif
|
||||
@else
|
||||
@if($location === 'sidebar')
|
||||
<flux:sidebar.item icon="user" @click="openNostrLogin">Mit Nostr verbinden</flux:sidebar.item>
|
||||
@else
|
||||
<flux:navbar.item icon="user" @click="openNostrLogin">Mit Nostr verbinden</flux:navbar.item>
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
Reference in New Issue
Block a user