Files
einundzwanzig-verein/resources/views/livewire/auth-button.blade.php
HolgerHatGarKeineNode 0a9498676c Add Lightning Watchtower feature: introduce Watchtower details, usage instructions, and clipboard copying functionality in association profile.
♻️ Update authentication buttons: replace `flux:navbar.item` and `flux:sidebar.item` with `flux:button` for improved UX and consistency.
🗑️ Update `.gitignore`: include additional configuration files (`.opencode`, `.switch-omo-config*`).
2026-01-23 15:52:52 +01:00

54 lines
1.6 KiB
PHP

<?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:button variant="ghost" icon="arrow-right-start-on-rectangle" type="submit" wire:click="$dispatch('nostrLoggedOut')">Logout</flux:button>
</form>
@else
<form method="post" action="{{ route('logout') }}">
@csrf
<flux:button variant="ghost" icon="arrow-right-start-on-rectangle" type="submit" wire:click="$dispatch('nostrLoggedOut')">Logout</flux:button>
</form>
@endif
@else
@if($location === 'sidebar')
<flux:button variant="primary" icon="user" @click="openNostrLogin">Mit Nostr verbinden</flux:button>
@else
<flux:button variant="primary" icon="user" @click="openNostrLogin">Mit Nostr verbinden</flux:button>
@endif
@endif
</div>