🚀 Replace fully-qualified class names with imports in Blade and Livewire components, refactor conditionals and formatting for improved readability.

This commit is contained in:
HolgerHatGarKeineNode
2026-01-18 21:07:28 +01:00
parent 18f8dd99e3
commit 42e7d7af8e
2 changed files with 348 additions and 355 deletions

View File

@@ -54,12 +54,12 @@ new class extends Component {
$this->currentPubkey = NostrAuth::pubkey(); $this->currentPubkey = NostrAuth::pubkey();
$this->currentPleb = EinundzwanzigPleb::query() $this->currentPleb = EinundzwanzigPleb::query()
->with([ ->with([
'paymentEvents' => fn ($query) => $query->where('year', date('Y')), 'paymentEvents' => fn($query) => $query->where('year', date('Y')),
]) ])
->where('pubkey', $this->currentPubkey)->first(); ->where('pubkey', $this->currentPubkey)->first();
if ($this->currentPleb) { if ($this->currentPleb) {
$this->email = $this->currentPleb->email; $this->email = $this->currentPleb->email;
$this->showEmail = ! $this->no; $this->showEmail = !$this->no;
if ($this->currentPleb->association_status === AssociationStatus::ACTIVE) { if ($this->currentPleb->association_status === AssociationStatus::ACTIVE) {
$this->amountToPay = config('app.env') === 'production' ? 21000 : 1; $this->amountToPay = config('app.env') === 'production' ? 21000 : 1;
} }
@@ -80,12 +80,12 @@ new class extends Component {
$this->currentPubkey = $pubkey; $this->currentPubkey = $pubkey;
$this->currentPleb = EinundzwanzigPleb::query() $this->currentPleb = EinundzwanzigPleb::query()
->with([ ->with([
'paymentEvents' => fn ($query) => $query->where('year', date('Y')), 'paymentEvents' => fn($query) => $query->where('year', date('Y')),
]) ])
->where('pubkey', $pubkey)->first(); ->where('pubkey', $pubkey)->first();
$this->email = $this->currentPleb->email; $this->email = $this->currentPleb->email;
$this->no = $this->currentPleb->no_email; $this->no = $this->currentPleb->no_email;
$this->showEmail = ! $this->no; $this->showEmail = !$this->no;
if ($this->currentPleb->association_status === AssociationStatus::ACTIVE) { if ($this->currentPleb->association_status === AssociationStatus::ACTIVE) {
$this->amountToPay = config('app.env') === 'production' ? 21000 : 1; $this->amountToPay = config('app.env') === 'production' ? 21000 : 1;
} }
@@ -113,7 +113,7 @@ new class extends Component {
public function updatedNo(): void public function updatedNo(): void
{ {
$this->showEmail = ! $this->no; $this->showEmail = !$this->no;
$this->currentPleb->update([ $this->currentPleb->update([
'no_email' => $this->no, 'no_email' => $this->no,
]); ]);
@@ -220,7 +220,7 @@ new class extends Component {
public function save($type): void public function save($type): void
{ {
$this->form->validate(); $this->form->validate();
if (! $this->form->check) { if (!$this->form->check) {
$this->js('alert("Du musst den Statuten zustimmen.")'); $this->js('alert("Du musst den Statuten zustimmen.")');
return; return;
@@ -285,7 +285,7 @@ new class extends Component {
$this->events = collect($response[config('services.relay')]) $this->events = collect($response[config('services.relay')])
->map(function ($event) { ->map(function ($event) {
if (! isset($event->event)) { if (!isset($event->event)) {
return false; return false;
} }
@@ -319,8 +319,6 @@ new class extends Component {
</div> </div>
<flux:card> <flux:card>
<div class="flex flex-col md:flex-row md:-mr-px">
<!-- Sidebar --> <!-- Sidebar -->
<div <div
class="flex flex-nowrap overflow-x-scroll no-scrollbar md:block md:overflow-auto px-3 py-6 border-b md:border-b-0 md:border-r border-gray-200 dark:border-gray-700/60 min-w-60 md:space-y-3"> class="flex flex-nowrap overflow-x-scroll no-scrollbar md:block md:overflow-auto px-3 py-6 border-b md:border-b-0 md:border-r border-gray-200 dark:border-gray-700/60 min-w-60 md:space-y-3">
@@ -346,15 +344,15 @@ new class extends Component {
<!-- Panel body --> <!-- Panel body -->
<div class="p-6 space-y-6"> <div class="p-6 space-y-6">
<h2 class="sm:text-2xl text-[#1B1B1B] dark:text-gray-100 font-bold mb-5">Aktueller Status</h2> <h2 class="sm:text-2xl text-[#1B1B1B] dark:text-gray-100 font-bold mb-5">
Aktueller Status
</h2>
<section> <section>
@if(!$currentPleb)
<div class="space-y-2 mb-12"> <div class="space-y-2 mb-12">
<div class="flex justify-between items-center mb-4"> <div class="flex justify-between items-center mb-4">
<div class="text-xl text-gray-500 dark:text-gray-400 italic">Empfohlene Nostr <div class="text-xl text-gray-500 dark:text-gray-400 italic">
Login und Signer-Apps Empfohlene Nostr Login und Signer-Apps
</div> </div>
</div> </div>
<flux:card> <flux:card>
@@ -367,7 +365,8 @@ new class extends Component {
href="https://github.com/greenart7c3/Amber"> href="https://github.com/greenart7c3/Amber">
Amber Amber
</a> </a>
<div class="text-sm">Perfekt für mobile Android Geräte. Eine App, in <div class="text-sm">Perfekt für mobile Android Geräte. Eine
App, in
der man alle Keys/nsecs verwalten kann. der man alle Keys/nsecs verwalten kann.
</div> </div>
</div> </div>
@@ -392,7 +391,8 @@ new class extends Component {
Alby - Bitcoin Lightning Wallet & Nostr Alby - Bitcoin Lightning Wallet & Nostr
</a> </a>
<div class="text-sm"> <div class="text-sm">
Browser-Erweiterung in die man seinen Key/nsec eingeben kann. Browser-Erweiterung in die man seinen Key/nsec eingeben
kann.
Pro Alby-Konto ein nsec. Pro Alby-Konto ein nsec.
</div> </div>
</div> </div>
@@ -451,7 +451,6 @@ new class extends Component {
</div> </div>
</div> </div>
</flux:card> </flux:card>
@endif
<div class="flex flex-wrap space-y-2 sm:space-y-0 items-center justify-between"> <div class="flex flex-wrap space-y-2 sm:space-y-0 items-center justify-between">
<template x-if="$store.nostr.user"> <template x-if="$store.nostr.user">
@@ -479,9 +478,9 @@ new class extends Component {
<div>Profil in der Datenbank vorhanden.</div> <div>Profil in der Datenbank vorhanden.</div>
</div> </div>
</flux:card> </flux:card>
</div>
@endif @endif
</div> </div>
</div>
</section> </section>
<section> <section>
@@ -490,16 +489,18 @@ new class extends Component {
</h3> </h3>
<h4 class="text-xs leading-snug text-[#1B1B1B] dark:text-gray-100 font-italic mb-1"> <h4 class="text-xs leading-snug text-[#1B1B1B] dark:text-gray-100 font-italic mb-1">
Nur Personen können Mitglied werden und zahlen 21.000 Satoshis im Jahr.<br> Nur Personen können Mitglied werden und zahlen 21.000 Satoshis im Jahr.<br>
<a href="https://einundzwanzig.space/verein/" class="text-amber-500">Firmen melden <a href="https://einundzwanzig.space/verein/" class="text-amber-500">
sich bitte direkt an den Vorstand.</a> Firmen melden sich bitte direkt an den Vorstand.
</a>
</h4> </h4>
<div class="sm:flex sm:items-center space-y-4 sm:space-y-0 sm:space-x-4 mt-5"> <div class="sm:flex sm:items-center space-y-4 sm:space-y-0 sm:space-x-4 mt-5">
<div class="sm:w-1/2 flex flex-col space-y-2"> <div class="sm:w-1/2 flex flex-col space-y-2">
<div class="flex items-center space-x-2"> <div class="flex items-center space-x-2">
<div wire:dirty> <div wire:dirty>
<flux:field variant="inline"> <flux:field variant="inline">
<flux:checkbox wire:model="form.check" label="Ich stimme den Vereins-Statuten zu"/> <flux:checkbox wire:model="form.check"
<flux:error name="form.check" /> label="Ich stimme den Vereins-Statuten zu"/>
<flux:error name="form.check"/>
</flux:field> </flux:field>
</div> </div>
<div> <div>
@@ -512,11 +513,10 @@ new class extends Component {
</flux:button> </flux:button>
</div> </div>
</div> </div>
@if($currentPubkey) <flux:card class="mt-6">
<flux:card class="mt-6"> <div class="flex w-full justify-between items-start">
<div class="flex w-full justify-between items-start">
<div class="flex w-full"> <div class="flex w-full">
<svg class="shrink-0 fill-current text-yellow-500 mt-[3px] mr-3" <svg class="shrink-0 fill-current text-yellow-500 mt-0.75 mr-3"
width="16" width="16"
height="16" viewBox="0 0 16 16"> height="16" viewBox="0 0 16 16">
<path <path
@@ -538,53 +538,54 @@ new class extends Component {
class="flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-2 text-amber-500"> class="flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-2 text-amber-500">
<flux:field variant="inline" xl> <flux:field variant="inline" xl>
<flux:label>NEIN</flux:label> <flux:label>NEIN</flux:label>
<flux:description>Ich informiere mich selbst in der News Sektion und gebe keine E-Mail Adresse raus.</flux:description> <flux:description>Ich informiere mich selbst in der News
Sektion und gebe keine E-Mail Adresse raus.
</flux:description>
<flux:switch <flux:switch
wire:model.live="no" wire:model.live="no"
wire:dirty wire:dirty
/> />
<flux:error name="no" /> <flux:error name="no"/>
</flux:field> </flux:field>
</div> </div>
@if($showEmail)
<div wire:key="showEmail" <div wire:key="showEmail"
class="flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-2"> class="flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-2">
<flux:field> <flux:field>
<flux:label>Fax-Nummer</flux:label> <flux:label>Fax-Nummer</flux:label>
<flux:input wire:model.live.debounce="fax" wire:dirty placeholder="Fax-Nummer"/> <flux:input wire:model.live.debounce="fax" wire:dirty
<flux:error name="fax" /> placeholder="Fax-Nummer"/>
<flux:error name="fax"/>
</flux:field> </flux:field>
<flux:field> <flux:field>
<flux:label>E-Mail Adresse</flux:label> <flux:label>E-Mail Adresse</flux:label>
<flux:input type="email" wire:model.live.debounce="email" wire:dirty placeholder="E-Mail Adresse"/> <flux:input type="email"
<flux:error name="email" /> wire:model.live.debounce="email" wire:dirty
placeholder="E-Mail Adresse"/>
<flux:error name="email"/>
</flux:field> </flux:field>
</div> </div>
<div wire:key="showSave" class="flex space-x-2 mt-2"> <div wire:key="showSave" class="flex space-x-2 mt-2">
<flux:button wire:click="saveEmail" wire:loading.attr="disabled"> <flux:button wire:click="saveEmail"
wire:loading.attr="disabled">
Speichern Speichern
</flux:button> </flux:button>
</div> </div>
@endif
</div> </div>
</div> </div>
</div> </div>
</div> </flux:card>
@endif
@endif
</div>
</div>
@endif
</section> </section>
</div>
</div>
</div>
<section> <section>
@if($currentPleb && $currentPleb->association_status->value > 1) @if($currentPleb && $currentPleb->association_status->value > 1)
<div class="flex flex-col space-y-4"> <div class="flex flex-col space-y-4">
<div <flux:card class="max-w-lg">
<flux:card class="max-w-lg"> <div class="flex w-full justify-between items-start">
<div class="flex w-full justify-between items-start">
<div class="flex"> <div class="flex">
<svg class="shrink-0 fill-current text-green-500 mt-[3px] mr-3" <svg class="shrink-0 fill-current text-green-500 mt-0.75 mr-3"
width="16" width="16"
height="16" viewBox="0 0 16 16"> height="16" viewBox="0 0 16 16">
<path <path
@@ -604,8 +605,8 @@ new class extends Component {
<section> <section>
@if($currentPleb && $currentPleb->association_status->value > 1) @if($currentPleb && $currentPleb->association_status->value > 1)
<flux:card> <flux:card>
<div class="flex w-full justify-between items-start"> <div class="flex w-full justify-between items-start">
<div class="flex"> <div class="flex">
<svg class="shrink-0 fill-current text-yellow-500 mt-[3px] mr-3" width="16" <svg class="shrink-0 fill-current text-yellow-500 mt-[3px] mr-3" width="16"
height="16" viewBox="0 0 16 16"> height="16" viewBox="0 0 16 16">
@@ -615,8 +616,8 @@ new class extends Component {
<div> <div>
<div <div
class="font-medium text-gray-800 dark:text-gray-100 mb-1 space-y-2"> class="font-medium text-gray-800 dark:text-gray-100 mb-1 space-y-2">
<p>Nostr Event für die Zahlung des <p>
Mitgliedsbeitrags: <span Nostr Event für die Zahlung des Mitgliedsbeitrags: <span
class="break-all">{{ $currentPleb->paymentEvents->last()->event_id }}</span> class="break-all">{{ $currentPleb->paymentEvents->last()->event_id }}</span>
</p> </p>
<div> <div>
@@ -625,13 +626,14 @@ new class extends Component {
<div class="mt-8"> <div class="mt-8">
@if(!$currentYearIsPaid) @if(!$currentYearIsPaid)
<div class="flex justify-center"> <div class="flex justify-center">
<flux:button wire:click="pay('{{ date('Y') }}:{{ $currentPubkey }}')" class="text-2xl"> <flux:button
wire:click="pay('{{ date('Y') }}:{{ $currentPubkey }}')"
class="text-2xl">
<i class="fa-sharp-duotone fa-solid fa-bolt-lightning mr-2"></i> <i class="fa-sharp-duotone fa-solid fa-bolt-lightning mr-2"></i>
Pay {{ $amountToPay }} Sats Pay {{ $amountToPay }} Sats
</flux:button> </flux:button>
</div> </div>
@else @elseif($currentYearIsPaid)
@if($currentYearIsPaid)
<div class="flex sm:justify-center"> <div class="flex sm:justify-center">
<flux:button disabled class="sm:text-2xl"> <flux:button disabled class="sm:text-2xl">
<i class="fa-sharp-duotone fa-solid fa-check-circle mr-2"></i> <i class="fa-sharp-duotone fa-solid fa-check-circle mr-2"></i>
@@ -639,7 +641,6 @@ new class extends Component {
</flux:button> </flux:button>
</div> </div>
@endif @endif
@endif
</div> </div>
@else @else
<div class="flex sm:justify-center"> <div class="flex sm:justify-center">
@@ -698,7 +699,8 @@ new class extends Component {
</td> </td>
<td class="w-full block md:w-auto md:table-cell py-0.5 md:py-2"> <td class="w-full block md:w-auto md:table-cell py-0.5 md:py-2">
@if($payment->btc_pay_invoice) @if($payment->btc_pay_invoice)
<flux:button href="https://pay.einundzwanzig.space/i/{{ $payment->btc_pay_invoice }}/receipt" <flux:button
href="https://pay.einundzwanzig.space/i/{{ $payment->btc_pay_invoice }}/receipt"
target="_blank" target="_blank"
size="xs" size="xs"
variant="subtle"> variant="subtle">
@@ -718,14 +720,6 @@ new class extends Component {
</flux:card> </flux:card>
@endif @endif
</section> </section>
</flux:card>
</div>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>

View File

@@ -1,8 +1,10 @@
<?php <?php
use App\Models\EinundzwanzigPleb;
use App\Models\ProjectProposal; use App\Models\ProjectProposal;
use App\Support\NostrAuth; use App\Support\NostrAuth;
use Flux\Flux; use Flux\Flux;
use Illuminate\Database\Eloquent\Collection;
use Livewire\Component; use Livewire\Component;
new class extends Component { new class extends Component {
@@ -12,13 +14,13 @@ new class extends Component {
public string $search = ''; public string $search = '';
public \Illuminate\Database\Eloquent\Collection $projects; public Collection $projects;
public bool $isAllowed = false; public bool $isAllowed = false;
public ?string $currentPubkey = null; public ?string $currentPubkey = null;
public ?\App\Models\EinundzwanzigPleb $currentPleb = null; public ?EinundzwanzigPleb $currentPleb = null;
protected $listeners = [ protected $listeners = [
'nostrLoggedIn' => 'handleNostrLoggedIn', 'nostrLoggedIn' => 'handleNostrLoggedIn',
@@ -30,7 +32,7 @@ new class extends Component {
$this->loadProjects(); $this->loadProjects();
if (NostrAuth::check()) { if (NostrAuth::check()) {
$this->currentPubkey = NostrAuth::pubkey(); $this->currentPubkey = NostrAuth::pubkey();
$this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $this->currentPubkey)->first(); $this->currentPleb = EinundzwanzigPleb::query()->where('pubkey', $this->currentPubkey)->first();
$this->isAllowed = true; $this->isAllowed = true;
} }
} }
@@ -63,7 +65,7 @@ new class extends Component {
{ {
NostrAuth::login($pubkey); NostrAuth::login($pubkey);
$this->currentPubkey = $pubkey; $this->currentPubkey = $pubkey;
$this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $pubkey)->first(); $this->currentPleb = EinundzwanzigPleb::query()->where('pubkey', $pubkey)->first();
$this->isAllowed = true; $this->isAllowed = true;
} }
@@ -98,7 +100,6 @@ new class extends Component {
<div> <div>
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto"> <div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
<!-- Page header --> <!-- Page header -->
<div class="sm:flex sm:justify-between sm:items-center mb-5"> <div class="sm:flex sm:justify-between sm:items-center mb-5">
@@ -165,9 +166,9 @@ new class extends Component {
<x-project-card :project="$project" :currentPleb="$currentPleb" :section="$activeFilter"/> <x-project-card :project="$project" :currentPleb="$currentPleb" :section="$activeFilter"/>
@endforeach @endforeach
</div> </div>
</div>
<!-- Confirmation modal --> <!-- Confirmation modal -->
<flux:modal name="delete-project" class="min-w-[22rem]"> <flux:modal name="delete-project" class="min-w-88">
<div class="space-y-6"> <div class="space-y-6">
<div> <div>
<flux:heading size="lg">Projektunterstützung löschen</flux:heading> <flux:heading size="lg">Projektunterstützung löschen</flux:heading>
@@ -177,7 +178,7 @@ new class extends Component {
</flux:text> </flux:text>
</div> </div>
<div class="flex gap-2"> <div class="flex gap-2">
<flux:spacer /> <flux:spacer/>
<flux:modal.close> <flux:modal.close>
<flux:button variant="ghost">Abbrechen</flux:button> <flux:button variant="ghost">Abbrechen</flux:button>
</flux:modal.close> </flux:modal.close>
@@ -185,6 +186,4 @@ new class extends Component {
</div> </div>
</div> </div>
</flux:modal> </flux:modal>
</div>
</div>
</div>