mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2026-01-28 07:43:18 +00:00
🚀 Replace fully-qualified class names with imports in Blade and Livewire components, refactor conditionals and formatting for improved readability.
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
<?php
|
||||
|
||||
use App\Models\EinundzwanzigPleb;
|
||||
use App\Models\ProjectProposal;
|
||||
use App\Support\NostrAuth;
|
||||
use Flux\Flux;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Livewire\Component;
|
||||
|
||||
new class extends Component {
|
||||
@@ -12,13 +14,13 @@ new class extends Component {
|
||||
|
||||
public string $search = '';
|
||||
|
||||
public \Illuminate\Database\Eloquent\Collection $projects;
|
||||
public Collection $projects;
|
||||
|
||||
public bool $isAllowed = false;
|
||||
|
||||
public ?string $currentPubkey = null;
|
||||
|
||||
public ?\App\Models\EinundzwanzigPleb $currentPleb = null;
|
||||
public ?EinundzwanzigPleb $currentPleb = null;
|
||||
|
||||
protected $listeners = [
|
||||
'nostrLoggedIn' => 'handleNostrLoggedIn',
|
||||
@@ -30,7 +32,7 @@ new class extends Component {
|
||||
$this->loadProjects();
|
||||
if (NostrAuth::check()) {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
@@ -63,7 +65,7 @@ new class extends Component {
|
||||
{
|
||||
NostrAuth::login($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;
|
||||
}
|
||||
|
||||
@@ -97,94 +99,91 @@ new class extends Component {
|
||||
?>
|
||||
|
||||
<div>
|
||||
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
|
||||
|
||||
<!-- Page header -->
|
||||
<div class="sm:flex sm:justify-between sm:items-center mb-5">
|
||||
|
||||
<!-- Left: Title -->
|
||||
<div class="mb-4 sm:mb-0">
|
||||
<h1 class="text-2xl md:text-3xl text-gray-800 dark:text-gray-100 font-bold">
|
||||
Einundzwanzig Projektunterstützungen
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<!-- Right: Actions -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 justify-start sm:justify-end gap-2">
|
||||
|
||||
<!-- Search form -->
|
||||
<form class="relative">
|
||||
<flux:input type="search" wire:model.live.debounce="search"
|
||||
placeholder="Suche" icon="magnifying-glass"/>
|
||||
</form>
|
||||
|
||||
<!-- Add meetup button -->
|
||||
@if($currentPleb && $currentPleb->association_status->value > 1 && $currentPleb->paymentEvents()->where('year', date('Y'))->where('paid', true)->exists())
|
||||
<flux:button :href="route('association.projectSupport.create')" icon="plus" variant="primary">
|
||||
Projekt einreichen
|
||||
</flux:button>
|
||||
@endif
|
||||
</div>
|
||||
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
|
||||
<!-- Page header -->
|
||||
<div class="sm:flex sm:justify-between sm:items-center mb-5">
|
||||
|
||||
<!-- Left: Title -->
|
||||
<div class="mb-4 sm:mb-0">
|
||||
<h1 class="text-2xl md:text-3xl text-gray-800 dark:text-gray-100 font-bold">
|
||||
Einundzwanzig Projektunterstützungen
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<!-- Filters -->
|
||||
<div class="mb-5">
|
||||
<ul class="flex flex-wrap -m-1">
|
||||
<li class="m-1">
|
||||
<button wire:click="setFilter('all')"
|
||||
class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border @if($activeFilter === 'all') border-transparent shadow-sm bg-gray-900 dark:bg-gray-100 text-white dark:text-gray-800 @else border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 @endif transition">
|
||||
Alle
|
||||
</button>
|
||||
</li>
|
||||
<li class="m-1">
|
||||
<button wire:click="setFilter('new')"
|
||||
class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border @if($activeFilter === 'new') border-transparent shadow-sm bg-gray-900 dark:bg-gray-100 text-white dark:text-gray-800 @else border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 @endif transition">
|
||||
Neu
|
||||
</button>
|
||||
</li>
|
||||
<li class="m-1">
|
||||
<button wire:click="setFilter('supported')"
|
||||
class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border @if($activeFilter === 'supported') border-transparent shadow-sm bg-gray-900 dark:bg-gray-100 text-white dark:text-gray-800 @else border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 @endif transition">
|
||||
Unterstützt
|
||||
</button>
|
||||
</li>
|
||||
<li class="m-1">
|
||||
<button wire:click="setFilter('rejected')"
|
||||
class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border @if($activeFilter === 'rejected') border-transparent shadow-sm bg-gray-900 dark:bg-gray-100 text-white dark:text-gray-800 @else border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 @endif transition">
|
||||
Abgelehnt
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="text-sm text-gray-500 dark:text-gray-400 italic mb-4">{{ $projects->count() }} Projekte</div>
|
||||
<!-- Right: Actions -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 justify-start sm:justify-end gap-2">
|
||||
|
||||
<!-- Content -->
|
||||
<div class="grid xl:grid-cols-2 gap-6 mb-8">
|
||||
@foreach($this->projects as $project)
|
||||
<x-project-card :project="$project" :currentPleb="$currentPleb" :section="$activeFilter"/>
|
||||
@endforeach
|
||||
</div>
|
||||
<!-- Search form -->
|
||||
<form class="relative">
|
||||
<flux:input type="search" wire:model.live.debounce="search"
|
||||
placeholder="Suche" icon="magnifying-glass"/>
|
||||
</form>
|
||||
|
||||
<!-- Confirmation modal -->
|
||||
<flux:modal name="delete-project" class="min-w-[22rem]">
|
||||
<div class="space-y-6">
|
||||
<div>
|
||||
<flux:heading size="lg">Projektunterstützung löschen</flux:heading>
|
||||
<flux:text class="mt-2">
|
||||
<p>Bist du sicher, dass du diese Projektunterstützung löschen möchtest?</p>
|
||||
<p>Diese Aktion kann nicht rückgängig gemacht werden.</p>
|
||||
</flux:text>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<flux:spacer />
|
||||
<flux:modal.close>
|
||||
<flux:button variant="ghost">Abbrechen</flux:button>
|
||||
</flux:modal.close>
|
||||
<flux:button type="submit" wire:click="delete" variant="danger">Ja, löschen</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
</flux:modal>
|
||||
<!-- Add meetup button -->
|
||||
@if($currentPleb && $currentPleb->association_status->value > 1 && $currentPleb->paymentEvents()->where('year', date('Y'))->where('paid', true)->exists())
|
||||
<flux:button :href="route('association.projectSupport.create')" icon="plus" variant="primary">
|
||||
Projekt einreichen
|
||||
</flux:button>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Filters -->
|
||||
<div class="mb-5">
|
||||
<ul class="flex flex-wrap -m-1">
|
||||
<li class="m-1">
|
||||
<button wire:click="setFilter('all')"
|
||||
class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border @if($activeFilter === 'all') border-transparent shadow-sm bg-gray-900 dark:bg-gray-100 text-white dark:text-gray-800 @else border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 @endif transition">
|
||||
Alle
|
||||
</button>
|
||||
</li>
|
||||
<li class="m-1">
|
||||
<button wire:click="setFilter('new')"
|
||||
class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border @if($activeFilter === 'new') border-transparent shadow-sm bg-gray-900 dark:bg-gray-100 text-white dark:text-gray-800 @else border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 @endif transition">
|
||||
Neu
|
||||
</button>
|
||||
</li>
|
||||
<li class="m-1">
|
||||
<button wire:click="setFilter('supported')"
|
||||
class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border @if($activeFilter === 'supported') border-transparent shadow-sm bg-gray-900 dark:bg-gray-100 text-white dark:text-gray-800 @else border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 @endif transition">
|
||||
Unterstützt
|
||||
</button>
|
||||
</li>
|
||||
<li class="m-1">
|
||||
<button wire:click="setFilter('rejected')"
|
||||
class="inline-flex items-center justify-center text-sm font-medium leading-5 rounded-full px-3 py-1 border @if($activeFilter === 'rejected') border-transparent shadow-sm bg-gray-900 dark:bg-gray-100 text-white dark:text-gray-800 @else border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 shadow-sm bg-white dark:bg-gray-800 text-gray-500 dark:text-gray-400 @endif transition">
|
||||
Abgelehnt
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="text-sm text-gray-500 dark:text-gray-400 italic mb-4">{{ $projects->count() }} Projekte</div>
|
||||
|
||||
<!-- Content -->
|
||||
<div class="grid xl:grid-cols-2 gap-6 mb-8">
|
||||
@foreach($this->projects as $project)
|
||||
<x-project-card :project="$project" :currentPleb="$currentPleb" :section="$activeFilter"/>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
<!-- Confirmation modal -->
|
||||
<flux:modal name="delete-project" class="min-w-88">
|
||||
<div class="space-y-6">
|
||||
<div>
|
||||
<flux:heading size="lg">Projektunterstützung löschen</flux:heading>
|
||||
<flux:text class="mt-2">
|
||||
<p>Bist du sicher, dass du diese Projektunterstützung löschen möchtest?</p>
|
||||
<p>Diese Aktion kann nicht rückgängig gemacht werden.</p>
|
||||
</flux:text>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<flux:spacer/>
|
||||
<flux:modal.close>
|
||||
<flux:button variant="ghost">Abbrechen</flux:button>
|
||||
</flux:modal.close>
|
||||
<flux:button type="submit" wire:click="delete" variant="danger">Ja, löschen</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
</flux:modal>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user