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:
@@ -1,84 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
use Laravel\Pulse\Support\PulseMigration;
|
|
||||||
|
|
||||||
return new class extends PulseMigration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
if (! $this->shouldRun()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Schema::create('pulse_values', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->unsignedInteger('timestamp');
|
|
||||||
$table->string('type');
|
|
||||||
$table->mediumText('key');
|
|
||||||
match ($this->driver()) {
|
|
||||||
'mariadb', 'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'),
|
|
||||||
'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'),
|
|
||||||
'sqlite' => $table->string('key_hash'),
|
|
||||||
};
|
|
||||||
$table->mediumText('value');
|
|
||||||
|
|
||||||
$table->index('timestamp'); // For trimming...
|
|
||||||
$table->index('type'); // For fast lookups and purging...
|
|
||||||
$table->unique(['type', 'key_hash']); // For data integrity and upserts...
|
|
||||||
});
|
|
||||||
|
|
||||||
Schema::create('pulse_entries', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->unsignedInteger('timestamp');
|
|
||||||
$table->string('type');
|
|
||||||
$table->mediumText('key');
|
|
||||||
match ($this->driver()) {
|
|
||||||
'mariadb', 'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'),
|
|
||||||
'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'),
|
|
||||||
'sqlite' => $table->string('key_hash'),
|
|
||||||
};
|
|
||||||
$table->bigInteger('value')->nullable();
|
|
||||||
|
|
||||||
$table->index('timestamp'); // For trimming...
|
|
||||||
$table->index('type'); // For purging...
|
|
||||||
$table->index('key_hash'); // For mapping...
|
|
||||||
$table->index(['timestamp', 'type', 'key_hash', 'value']); // For aggregate queries...
|
|
||||||
});
|
|
||||||
|
|
||||||
Schema::create('pulse_aggregates', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->unsignedInteger('bucket');
|
|
||||||
$table->unsignedMediumInteger('period');
|
|
||||||
$table->string('type');
|
|
||||||
$table->mediumText('key');
|
|
||||||
match ($this->driver()) {
|
|
||||||
'mariadb', 'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'),
|
|
||||||
'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'),
|
|
||||||
'sqlite' => $table->string('key_hash'),
|
|
||||||
};
|
|
||||||
$table->string('aggregate');
|
|
||||||
$table->decimal('value', 20, 2);
|
|
||||||
$table->unsignedInteger('count')->nullable();
|
|
||||||
|
|
||||||
$table->unique(['bucket', 'period', 'type', 'aggregate', 'key_hash']); // Force "on duplicate update"...
|
|
||||||
$table->index(['period', 'bucket']); // For trimming...
|
|
||||||
$table->index('type'); // For purging...
|
|
||||||
$table->index(['period', 'type', 'aggregate', 'bucket']); // For aggregate queries...
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('pulse_values');
|
|
||||||
Schema::dropIfExists('pulse_entries');
|
|
||||||
Schema::dropIfExists('pulse_aggregates');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -32,8 +32,9 @@ export default () => ({
|
|||||||
try {
|
try {
|
||||||
const data = JSON.parse(text);
|
const data = JSON.parse(text);
|
||||||
console.log('Profile fetched', data);
|
console.log('Profile fetched', data);
|
||||||
// store the profile in AlpineJS store
|
// store in AlpineJS store
|
||||||
Alpine.store('nostr', {user: data});
|
Alpine.store('nostr', {user: data});
|
||||||
|
// dispatch Livewire event
|
||||||
this.$dispatch('nostrLoggedIn', {pubkey: pubkey});
|
this.$dispatch('nostrLoggedIn', {pubkey: pubkey});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('JSON parse error:', e);
|
console.error('JSON parse error:', e);
|
||||||
|
|||||||
@@ -36,13 +36,16 @@
|
|||||||
<flux:navbar class="-mb-px max-lg:hidden">
|
<flux:navbar class="-mb-px max-lg:hidden">
|
||||||
@if(\App\Support\NostrAuth::check())
|
@if(\App\Support\NostrAuth::check())
|
||||||
<flux:navbar.item icon="rss" :href="route('association.news')"
|
<flux:navbar.item icon="rss" :href="route('association.news')"
|
||||||
:current="request()->routeIs('association.news')">News
|
:current="request()->routeIs('association.news')">
|
||||||
|
News
|
||||||
</flux:navbar.item>
|
</flux:navbar.item>
|
||||||
<flux:navbar.item icon="identification" :href="route('association.profile')"
|
<flux:navbar.item icon="identification" :href="route('association.profile')"
|
||||||
:current="request()->routeIs('association.profile')">Mitgliederstatus
|
:current="request()->routeIs('association.profile')">
|
||||||
|
Mitgliederstatus
|
||||||
</flux:navbar.item>
|
</flux:navbar.item>
|
||||||
<flux:navbar.item icon="heart" :href="route('association.projectSupport')"
|
<flux:navbar.item icon="heart" :href="route('association.projectSupport')"
|
||||||
:current="request()->routeIs('association.projectSupport')">Projekt-Unterstützungen
|
:current="request()->routeIs('association.projectSupport')">
|
||||||
|
Projekt-Unterstützungen
|
||||||
</flux:navbar.item>
|
</flux:navbar.item>
|
||||||
|
|
||||||
<flux:dropdown position="bottom">
|
<flux:dropdown position="bottom">
|
||||||
@@ -64,27 +67,11 @@
|
|||||||
<flux:navbar.item icon:trailing="information-circle">Info</flux:navbar.item>
|
<flux:navbar.item icon:trailing="information-circle">Info</flux:navbar.item>
|
||||||
|
|
||||||
<flux:menu>
|
<flux:menu>
|
||||||
<flux:menu.item
|
|
||||||
href="https://gitworkshop.dev/r/naddr1qvzqqqrhnypzqzklvar4enzu53t06vpzu3h465nwkzhk9p9ls4y5crwhs3lnu5pnqy88wumn8ghj7mn0wvhxcmmv9uqpxetfde6kuer6wasku7nfvukkummnw3eqdgsn8w/issues"
|
|
||||||
target="_blank">Issues/Feedback
|
|
||||||
</flux:menu.item>
|
|
||||||
<flux:menu.item :href="route('changelog')">Changelog</flux:menu.item>
|
|
||||||
<flux:menu.item href="https://github.com/HolgerHatGarkeineNode/einundzwanzig-nostr" target="_blank">
|
|
||||||
Github
|
|
||||||
</flux:menu.item>
|
|
||||||
<flux:menu.item href="https://einundzwanzig.space/kontakt/" target="_blank">Impressum</flux:menu.item>
|
<flux:menu.item href="https://einundzwanzig.space/kontakt/" target="_blank">Impressum</flux:menu.item>
|
||||||
</flux:menu>
|
</flux:menu>
|
||||||
</flux:dropdown>
|
</flux:dropdown>
|
||||||
|
|
||||||
@if(\App\Support\NostrAuth::check())
|
<livewire:auth-button location="navbar"/>
|
||||||
<form method="post" action="{{ route('logout') }}" @submit="$dispatch('nostrLoggedOut')">
|
|
||||||
@csrf
|
|
||||||
<flux:navbar.item type="submit" icon="arrow-right-start-on-rectangle">Logout</flux:navbar.item>
|
|
||||||
</form>
|
|
||||||
@else
|
|
||||||
<flux:navbar.item icon="user" wire:key="loginBtn" @click="openNostrLogin">Mit Nostr verbinden
|
|
||||||
</flux:navbar.item>
|
|
||||||
@endif
|
|
||||||
</flux:navbar>
|
</flux:navbar>
|
||||||
</flux:header>
|
</flux:header>
|
||||||
|
|
||||||
@@ -103,7 +90,11 @@
|
|||||||
</flux:sidebar.header>
|
</flux:sidebar.header>
|
||||||
|
|
||||||
<flux:sidebar.nav>
|
<flux:sidebar.nav>
|
||||||
@if(\App\Support\NostrAuth::check())
|
<flux:sidebar.group>
|
||||||
|
<livewire:auth-button location="sidebar"/>
|
||||||
|
</flux:sidebar.group>
|
||||||
|
|
||||||
|
<flux:sidebar.group heading="Mitgliedsbereich" class="grid">
|
||||||
<flux:sidebar.item icon="rss" :href="route('association.news')"
|
<flux:sidebar.item icon="rss" :href="route('association.news')"
|
||||||
:current="request()->routeIs('association.news')">News
|
:current="request()->routeIs('association.news')">News
|
||||||
</flux:sidebar.item>
|
</flux:sidebar.item>
|
||||||
@@ -121,28 +112,10 @@
|
|||||||
</flux:sidebar.group>
|
</flux:sidebar.group>
|
||||||
|
|
||||||
<flux:sidebar.group heading="Info" class="grid">
|
<flux:sidebar.group heading="Info" class="grid">
|
||||||
<flux:sidebar.item
|
|
||||||
href="https://gitworkshop.dev/r/naddr1qvzqqqrhnypzqzklvar4enzu53t06vpzu3h465nwkzhk9p9ls4y5crwhs3lnu5pnqy88wumn8ghj7mn0wvhxcmmv9uqpxetfde6kuer6wasku7nfvukkummnw3eqdgsn8w/issues"
|
|
||||||
target="_blank">Issues/Feedback
|
|
||||||
</flux:sidebar.item>
|
|
||||||
<flux:sidebar.item :href="route('changelog')">Changelog</flux:sidebar.item>
|
|
||||||
<flux:sidebar.item href="https://github.com/HolgerHatGarkeineNode/einundzwanzig-nostr" target="_blank">
|
|
||||||
Github
|
|
||||||
</flux:sidebar.item>
|
|
||||||
<flux:sidebar.item href="https://einundzwanzig.space/kontakt/" target="_blank">Impressum
|
<flux:sidebar.item href="https://einundzwanzig.space/kontakt/" target="_blank">Impressum
|
||||||
</flux:sidebar.item>
|
</flux:sidebar.item>
|
||||||
</flux:sidebar.group>
|
</flux:sidebar.group>
|
||||||
@endif
|
</flux:sidebar.group>
|
||||||
|
|
||||||
@if(\App\Support\NostrAuth::check())
|
|
||||||
<flux:sidebar.spacer/>
|
|
||||||
<form method="post" action="{{ route('logout') }}" @submit="$dispatch('nostrLoggedOut')">
|
|
||||||
@csrf
|
|
||||||
<flux:sidebar.item icon="arrow-right-start-on-rectangle" type="submit">Logout</flux:sidebar.item>
|
|
||||||
</form>
|
|
||||||
@else
|
|
||||||
<flux:sidebar.item icon="user" @click="openNostrLogin">Mit Nostr verbinden</flux:sidebar.item>
|
|
||||||
@endif
|
|
||||||
</flux:sidebar.nav>
|
</flux:sidebar.nav>
|
||||||
</flux:sidebar>
|
</flux:sidebar>
|
||||||
|
|
||||||
@@ -157,7 +130,9 @@
|
|||||||
@fluxScripts
|
@fluxScripts
|
||||||
@livewireScriptConfig
|
@livewireScriptConfig
|
||||||
<script>
|
<script>
|
||||||
|
if (!localStorage.getItem('flux.appearance')) {
|
||||||
|
localStorage.setItem('flux.appearance', 'dark');
|
||||||
|
}
|
||||||
window.wnjParams = {
|
window.wnjParams = {
|
||||||
position: 'bottom',
|
position: 'bottom',
|
||||||
accent: 'orange',
|
accent: 'orange',
|
||||||
|
|||||||
@@ -23,12 +23,14 @@ class extends Component {
|
|||||||
'description' => '',
|
'description' => '',
|
||||||
];
|
];
|
||||||
|
|
||||||
public mixed $file;
|
public $file;
|
||||||
|
|
||||||
public bool $isAllowed = false;
|
public bool $isAllowed = false;
|
||||||
|
|
||||||
public bool $canEdit = false;
|
public bool $canEdit = false;
|
||||||
|
|
||||||
|
public ?int $confirmDeleteId = null;
|
||||||
|
|
||||||
public function mount(): void
|
public function mount(): void
|
||||||
{
|
{
|
||||||
if (NostrAuth::check()) {
|
if (NostrAuth::check()) {
|
||||||
@@ -43,7 +45,7 @@ class extends Component {
|
|||||||
$this->isAllowed = true;
|
$this->isAllowed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($currentPleb && $currentPleb->association_status->value > 2) {
|
if ($currentPleb && in_array($currentPleb->npub, config('einundzwanzig.config.current_board'))) {
|
||||||
$this->canEdit = true;
|
$this->canEdit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,18 +88,27 @@ class extends Component {
|
|||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete(int $id): void
|
public function confirmDelete(int $id): void
|
||||||
{
|
{
|
||||||
$news = Notification::query()->find($id);
|
$this->confirmDeleteId = $id;
|
||||||
if ($news) {
|
}
|
||||||
$news->delete();
|
|
||||||
}
|
public function delete(): void
|
||||||
|
{
|
||||||
|
$news = Notification::query()->findOrFail($this->confirmDeleteId);
|
||||||
|
$news->delete();
|
||||||
|
|
||||||
$this->news = \App\Models\Notification::query()
|
$this->news = \App\Models\Notification::query()
|
||||||
->with(['einundzwanzigPleb.profile'])
|
->with(['einundzwanzigPleb.profile'])
|
||||||
->latest()
|
->latest()
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function removeFile(): void
|
||||||
|
{
|
||||||
|
$this->file->delete();
|
||||||
|
$this->file = null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -161,46 +172,45 @@ class extends Component {
|
|||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
@forelse($news as $post)
|
@forelse($news as $post)
|
||||||
<flux:card wire:key="post_{{ $post->id }}">
|
<flux:card wire:key="post_{{ $post->id }}">
|
||||||
<!-- Avatar -->
|
<!-- Avatar -->
|
||||||
<div class="shrink-0 mt-1.5">
|
<div class="shrink-0 mt-1.5">
|
||||||
<img class="w-8 h-8 rounded-full"
|
<img class="w-8 h-8 rounded-full"
|
||||||
src="{{ $post->einundzwanzigPleb->profile?->picture ?? asset('einundzwanzig-alpha.jpg') }}"
|
src="{{ $post->einundzwanzigPleb->profile?->picture ?? asset('einundzwanzig-alpha.jpg') }}"
|
||||||
width="32" height="32"
|
width="32" height="32"
|
||||||
alt="{{ $post->einundzwanzigPleb->profile?->name }}">
|
alt="{{ $post->einundzwanzigPleb->profile?->name }}">
|
||||||
</div>
|
</div>
|
||||||
<!-- Content -->
|
<!-- Content -->
|
||||||
<div class="grow">
|
<div class="grow">
|
||||||
<!-- Title -->
|
<!-- Title -->
|
||||||
<h2 class="font-semibold text-gray-800 dark:text-gray-100 mb-2">
|
<h2 class="font-semibold text-gray-800 dark:text-gray-100 mb-2">
|
||||||
{{ $post->name }}
|
{{ $post->name }}
|
||||||
</h2>
|
</h2>
|
||||||
<p class="mb-6">
|
<p class="mb-6">
|
||||||
{{ $post->description }}
|
{{ $post->description }}
|
||||||
</p>
|
</p>
|
||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
<footer class="flex flex-wrap text-sm">
|
<footer class="flex flex-wrap text-sm">
|
||||||
|
<div
|
||||||
|
class="flex items-center after:block after:content-['·'] last:after:content-[''] after:text-sm after:text-gray-400 dark:after:text-gray-600 after:px-2">
|
||||||
<div
|
<div
|
||||||
class="flex items-center after:block after:content-['·'] last:after:content-[''] after:text-sm after:text-gray-400 dark:after:text-gray-600 after:px-2">
|
class="font-medium text-amber-500 hover:text-amber-600 dark:hover:text-amber-400">
|
||||||
<div
|
<div class="flex items-center">
|
||||||
class="font-medium text-amber-500 hover:text-amber-600 dark:hover:text-amber-400">
|
<svg class="mr-2 fill-current" width="16"
|
||||||
<div class="flex items-center">
|
height="16"
|
||||||
<svg class="mr-2 fill-current" width="16"
|
xmlns="http://www.w3.org/2000/svg">
|
||||||
height="16"
|
<path
|
||||||
xmlns="http://www.w3.org/2000/svg">
|
d="M15.686 5.708 10.291.313c-.4-.4-.999-.4-1.399 0s-.4 1 0 1.399l.6.6-6.794 3.696-1-1C1.299 4.61.7 4.61.3 5.009c-.4.4-.4 1 0 1.4l1.498 1.498 2.398 2.398L.6 14.001 2 15.4l3.696-3.697L9.692 15.7c.5.5 1.199.2 1.398 0 .4-.4.4-1 0-1.4l-.999-.998 3.697-6.695.6.6c.599.6 1.199.2 1.398 0 .3-.4.3-1.1-.1-1.499Zm-7.193 6.095L4.196 7.507l6.695-3.697 1.298 1.299-3.696 6.694Z"></path>
|
||||||
<path
|
</svg>
|
||||||
d="M15.686 5.708 10.291.313c-.4-.4-.999-.4-1.399 0s-.4 1 0 1.399l.6.6-6.794 3.696-1-1C1.299 4.61.7 4.61.3 5.009c-.4.4-.4 1 0 1.4l1.498 1.498 2.398 2.398L.6 14.001 2 15.4l3.696-3.697L9.692 15.7c.5.5 1.199.2 1.398 0 .4-.4.4-1 0-1.4l-.999-.998 3.697-6.695.6.6c.599.6 1.199.2 1.398 0 .3-.4.3-1.1-.1-1.499Zm-7.193 6.095L4.196 7.507l6.695-3.697 1.298 1.299-3.696 6.694Z"></path>
|
{{ $post->einundzwanzigPleb->profile->name }}
|
||||||
</svg>
|
|
||||||
{{ $post->einundzwanzigPleb->profile->name }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
</div>
|
||||||
class="flex items-center after:block after:content-['·'] last:after:content-[''] after:text-sm after:text-gray-400 dark:after:text-gray-600 after:px-2">
|
<div
|
||||||
|
class="flex items-center after:block after:content-['·'] last:after:content-[''] after:text-sm after:text-gray-400 dark:after:text-gray-600 after:px-2">
|
||||||
<span
|
<span
|
||||||
class="text-gray-500">{{ $post->created_at->format('d.m.Y') }}</span>
|
class="text-gray-500">{{ $post->created_at->format('d.m.Y') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-2 flex justify-end w-full space-x-2">
|
<div class="mt-2 flex justify-end w-full space-x-2">
|
||||||
<flux:button
|
<flux:button
|
||||||
@@ -211,14 +221,34 @@ class extends Component {
|
|||||||
Öffnen
|
Öffnen
|
||||||
</flux:button>
|
</flux:button>
|
||||||
@if($canEdit)
|
@if($canEdit)
|
||||||
<flux:button
|
<flux:modal.trigger name="delete-news-{{ $post->id }}">
|
||||||
xs
|
<flux:button
|
||||||
negative
|
xs
|
||||||
wire:click="delete({{ $post->id }})"
|
variant="danger"
|
||||||
wire:loading.attr="disabled"
|
icon="trash"
|
||||||
icon="trash">
|
wire:click="confirmDelete({{ $post->id }})">
|
||||||
Löschen
|
Löschen
|
||||||
</flux:button>
|
</flux:button>
|
||||||
|
</flux:modal.trigger>
|
||||||
|
|
||||||
|
<flux:modal name="delete-news-{{ $post->id }}" class="min-w-88">
|
||||||
|
<div class="space-y-6">
|
||||||
|
<div>
|
||||||
|
<flux:heading size="lg">News löschen?</flux:heading>
|
||||||
|
<flux:text class="mt-2">
|
||||||
|
Du bist dabei, diese News zu löschen.<br>
|
||||||
|
Diese Aktion kann nicht rückgängig gemacht werden.
|
||||||
|
</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 wire:click="delete" variant="danger">Löschen</flux:button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</flux:modal>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</flux:card>
|
</flux:card>
|
||||||
@@ -246,17 +276,29 @@ class extends Component {
|
|||||||
@if($canEdit)
|
@if($canEdit)
|
||||||
<flux:card>
|
<flux:card>
|
||||||
<div
|
<div
|
||||||
class="text-xs font-semibold text-gray-400 dark:text-gray-500 uppercase mb-4">
|
class="text-xs font-semibold text-gray-400 dark:text-gray-200 uppercase mb-4">
|
||||||
News anlegen
|
News anlegen
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-4 flex flex-col space-y-2">
|
<div class="mt-4 flex flex-col space-y-2">
|
||||||
<div wire:dirty>
|
<flux:file-upload wire:model="file" label="PDF hochladen">
|
||||||
<input class="text-gray-200" type="file" wire:model="file">
|
<flux:file-upload.dropzone heading="Drop file here or click to browse" text="PDF bis 10MB" />
|
||||||
@error('file')
|
</flux:file-upload>
|
||||||
<span class="text-red-500">{{ $message }}</span>
|
@error('file')
|
||||||
@enderror
|
<span class="text-red-500">{{ $message }}</span>
|
||||||
|
@enderror
|
||||||
|
<div class="mt-3 flex flex-col gap-2">
|
||||||
|
@if ($file)
|
||||||
|
<flux:file-item
|
||||||
|
:heading="$file->getClientOriginalName()"
|
||||||
|
:size="$file->getSize()"
|
||||||
|
>
|
||||||
|
<x-slot name="actions">
|
||||||
|
<flux:file-item.remove wire:click="removeFile" aria-label="{{ 'Remove file: ' . $file->getClientOriginalName() }}" />
|
||||||
|
</x-slot>
|
||||||
|
</flux:file-item>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<div wire:dirty>
|
<div>
|
||||||
<flux:field>
|
<flux:field>
|
||||||
<flux:label>Kategorie</flux:label>
|
<flux:label>Kategorie</flux:label>
|
||||||
<flux:select
|
<flux:select
|
||||||
@@ -273,14 +315,14 @@ class extends Component {
|
|||||||
<flux:error name="form.category"/>
|
<flux:error name="form.category"/>
|
||||||
</flux:field>
|
</flux:field>
|
||||||
</div>
|
</div>
|
||||||
<div wire:dirty>
|
<div>
|
||||||
<flux:field>
|
<flux:field>
|
||||||
<flux:label>Titel</flux:label>
|
<flux:label>Titel</flux:label>
|
||||||
<flux:input wire:model="form.name" placeholder="News-Titel"/>
|
<flux:input wire:model="form.name" placeholder="News-Titel"/>
|
||||||
<flux:error name="form.name"/>
|
<flux:error name="form.name"/>
|
||||||
</flux:field>
|
</flux:field>
|
||||||
</div>
|
</div>
|
||||||
<div wire:dirty>
|
<div>
|
||||||
<flux:field>
|
<flux:field>
|
||||||
<flux:label>Beschreibung</flux:label>
|
<flux:label>Beschreibung</flux:label>
|
||||||
<flux:description>optional</flux:description>
|
<flux:description>optional</flux:description>
|
||||||
|
|||||||
@@ -135,14 +135,14 @@ new class extends Component {
|
|||||||
Flux::toast('E-Mail Adresse gespeichert.');
|
Flux::toast('E-Mail Adresse gespeichert.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pay($comment): \Illuminate\Http\RedirectResponse
|
public function pay($comment): mixed
|
||||||
{
|
{
|
||||||
$paymentEvent = $this->currentPleb
|
$paymentEvent = $this->currentPleb
|
||||||
->paymentEvents()
|
->paymentEvents()
|
||||||
->where('year', date('Y'))
|
->where('year', date('Y'))
|
||||||
->first();
|
->first();
|
||||||
if ($paymentEvent->btc_pay_invoice) {
|
if ($paymentEvent->btc_pay_invoice) {
|
||||||
return redirect('https://pay.einundzwanzig.space/i/'.$paymentEvent->btc_pay_invoice);
|
return redirect()->away('https://pay.einundzwanzig.space/i/'.$paymentEvent->btc_pay_invoice);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$response = \Illuminate\Support\Facades\Http::withHeaders([
|
$response = \Illuminate\Support\Facades\Http::withHeaders([
|
||||||
@@ -172,7 +172,7 @@ new class extends Component {
|
|||||||
$paymentEvent->btc_pay_invoice = $response->json()['id'];
|
$paymentEvent->btc_pay_invoice = $response->json()['id'];
|
||||||
$paymentEvent->save();
|
$paymentEvent->save();
|
||||||
|
|
||||||
return redirect($response->json()['checkoutLink']);
|
return redirect()->away($response->json()['checkoutLink']);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Flux::toast(
|
Flux::toast(
|
||||||
'Fehler beim Erstellen der Rechnung. Bitte versuche es später erneut: '.$e->getMessage(),
|
'Fehler beim Erstellen der Rechnung. Bitte versuche es später erneut: '.$e->getMessage(),
|
||||||
@@ -343,9 +343,7 @@ new class extends Component {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="shrink-0">
|
<div class="shrink-0">
|
||||||
<div class="text-xs inline-flex font-medium bg-green-500/20 text-green-700 rounded-full px-2.5 py-1">
|
<flux:badge color="success">Android</flux:badge>
|
||||||
Android
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</flux:card>
|
</flux:card>
|
||||||
@@ -362,9 +360,7 @@ new class extends Component {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="shrink-0">
|
<div class="shrink-0">
|
||||||
<div class="text-xs inline-flex font-medium bg-yellow-500/20 text-yellow-700 rounded-full px-2.5 py-1">
|
<flux:badge color="warning">Browser Chrome/Firefox</flux:badge>
|
||||||
Browser Chrome/Firefox
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</flux:card>
|
</flux:card>
|
||||||
@@ -381,9 +377,7 @@ new class extends Component {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="shrink-0">
|
<div class="shrink-0">
|
||||||
<div class="text-xs inline-flex font-medium bg-red-500/20 text-red-700 rounded-full px-2.5 py-1">
|
<flux:badge color="danger">Browser Chrome</flux:badge>
|
||||||
Browser Chrome
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</flux:card>
|
</flux:card>
|
||||||
@@ -400,9 +394,7 @@ new class extends Component {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="shrink-0">
|
<div class="shrink-0">
|
||||||
<div class="text-xs inline-flex font-medium bg-amber-500/20 text-amber-700 rounded-full px-2.5 py-1">
|
<flux:badge color="amber">Browser Firefox</flux:badge>
|
||||||
Browser Firefox
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</flux:card>
|
</flux:card>
|
||||||
@@ -440,7 +432,7 @@ new class extends Component {
|
|||||||
|
|
||||||
@if($currentPubkey && !$currentPleb->application_for && $currentPleb->association_status->value < 2)
|
@if($currentPubkey && !$currentPleb->application_for && $currentPleb->association_status->value < 2)
|
||||||
<!-- Membership Registration Section -->
|
<!-- Membership Registration Section -->
|
||||||
<div class="space-y-4 py-6 border-t border-gray-200 dark:border-gray-700">
|
<div class="space-y-4 py-6 border-t border-gray-200 dark:border-gray-600">
|
||||||
<div>
|
<div>
|
||||||
<h3 class="text-xl md:text-2xl text-[#1B1B1B] dark:text-gray-100 font-bold mb-2">
|
<h3 class="text-xl md:text-2xl text-[#1B1B1B] dark:text-gray-100 font-bold mb-2">
|
||||||
Einundzwanzig Mitglied werden
|
Einundzwanzig Mitglied werden
|
||||||
@@ -472,7 +464,7 @@ new class extends Component {
|
|||||||
|
|
||||||
@if($currentPubkey)
|
@if($currentPubkey)
|
||||||
<!-- Email Settings Section -->
|
<!-- Email Settings Section -->
|
||||||
<div class="py-6 border-t border-gray-200 dark:border-gray-700">
|
<div class="py-6 border-t border-gray-200 dark:border-gray-600">
|
||||||
<flux:callout variant="warning" class="mb-6">
|
<flux:callout variant="warning" class="mb-6">
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<p class="font-medium text-gray-800 dark:text-gray-100">
|
<p class="font-medium text-gray-800 dark:text-gray-100">
|
||||||
@@ -590,7 +582,7 @@ new class extends Component {
|
|||||||
|
|
||||||
<!-- Payment History -->
|
<!-- Payment History -->
|
||||||
@if($payments && count($payments) > 0)
|
@if($payments && count($payments) > 0)
|
||||||
<div class="pt-6 border-t border-gray-200 dark:border-gray-700">
|
<div class="pt-6 border-t border-gray-200 dark:border-gray-600">
|
||||||
<h4 class="text-lg md:text-xl text-gray-800 dark:text-gray-100 font-bold mb-4">
|
<h4 class="text-lg md:text-xl text-gray-800 dark:text-gray-100 font-bold mb-4">
|
||||||
Bisherige Zahlungen
|
Bisherige Zahlungen
|
||||||
</h4>
|
</h4>
|
||||||
@@ -598,7 +590,7 @@ new class extends Component {
|
|||||||
<!-- Desktop Table -->
|
<!-- Desktop Table -->
|
||||||
<div class="hidden md:block overflow-x-auto">
|
<div class="hidden md:block overflow-x-auto">
|
||||||
<table class="table-auto w-full">
|
<table class="table-auto w-full">
|
||||||
<thead class="text-xs font-semibold uppercase text-gray-500 dark:text-gray-400 border-b border-gray-200 dark:border-gray-700">
|
<thead class="text-xs font-semibold uppercase text-gray-500 dark:text-gray-400 border-b border-gray-200 dark:border-gray-600">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="px-2 first:pl-5 last:pr-5 py-3 whitespace-nowrap text-left">
|
<th class="px-2 first:pl-5 last:pr-5 py-3 whitespace-nowrap text-left">
|
||||||
<div class="font-semibold">Satoshis</div>
|
<div class="font-semibold">Satoshis</div>
|
||||||
@@ -614,7 +606,7 @@ new class extends Component {
|
|||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="text-sm divide-y divide-gray-200 dark:divide-gray-700">
|
<tbody class="text-sm divide-y divide-gray-200 dark:divide-gray-600">
|
||||||
@foreach($payments as $payment)
|
@foreach($payments as $payment)
|
||||||
<tr>
|
<tr>
|
||||||
<td class="px-2 first:pl-5 last:pr-5 py-3 whitespace-nowrap">
|
<td class="px-2 first:pl-5 last:pr-5 py-3 whitespace-nowrap">
|
||||||
@@ -646,7 +638,7 @@ new class extends Component {
|
|||||||
<!-- Mobile Cards -->
|
<!-- Mobile Cards -->
|
||||||
<div class="md:hidden space-y-4">
|
<div class="md:hidden space-y-4">
|
||||||
@foreach($payments as $payment)
|
@foreach($payments as $payment)
|
||||||
<div class="bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-4">
|
<div class="bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-600 p-4">
|
||||||
<div class="space-y-3">
|
<div class="space-y-3">
|
||||||
<div class="flex justify-between items-center">
|
<div class="flex justify-between items-center">
|
||||||
<span class="text-sm font-medium text-gray-500 dark:text-gray-400">Satoshis</span>
|
<span class="text-sm font-medium text-gray-500 dark:text-gray-400">Satoshis</span>
|
||||||
|
|||||||
@@ -68,14 +68,14 @@ class extends Component {
|
|||||||
Formular
|
Formular
|
||||||
</h2>
|
</h2>
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<div wire:dirty>
|
<div>
|
||||||
<flux:field>
|
<flux:field>
|
||||||
<flux:label>Name</flux:label>
|
<flux:label>Name</flux:label>
|
||||||
<flux:input wire:model="form.name" placeholder="Projektname" />
|
<flux:input wire:model="form.name" placeholder="Projektname" />
|
||||||
<flux:error name="form.name" />
|
<flux:error name="form.name" />
|
||||||
</flux:field>
|
</flux:field>
|
||||||
</div>
|
</div>
|
||||||
<div wire:dirty>
|
<div>
|
||||||
<flux:field>
|
<flux:field>
|
||||||
<flux:label>Beschreibung</flux:label>
|
<flux:label>Beschreibung</flux:label>
|
||||||
<flux:textarea wire:model="form.description" rows="6" placeholder="Projektbeschreibung..." />
|
<flux:textarea wire:model="form.description" rows="6" placeholder="Projektbeschreibung..." />
|
||||||
|
|||||||
@@ -81,14 +81,14 @@ class extends Component {
|
|||||||
Formular
|
Formular
|
||||||
</h2>
|
</h2>
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<div wire:dirty>
|
<div>
|
||||||
<flux:field>
|
<flux:field>
|
||||||
<flux:label>Name</flux:label>
|
<flux:label>Name</flux:label>
|
||||||
<flux:input wire:model="form.name" placeholder="Projektname" />
|
<flux:input wire:model="form.name" placeholder="Projektname" />
|
||||||
<flux:error name="form.name" />
|
<flux:error name="form.name" />
|
||||||
</flux:field>
|
</flux:field>
|
||||||
</div>
|
</div>
|
||||||
<div wire:dirty>
|
<div>
|
||||||
<flux:field>
|
<flux:field>
|
||||||
<flux:label>Beschreibung</flux:label>
|
<flux:label>Beschreibung</flux:label>
|
||||||
<flux:textarea wire:model="form.description" rows="6" placeholder="Projektbeschreibung..." />
|
<flux:textarea wire:model="form.description" rows="6" placeholder="Projektbeschreibung..." />
|
||||||
|
|||||||
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