mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2025-12-13 05:26:47 +00:00
🚀 feat(profile): update video visibility based on user login state in profile page
🎨 style(app): reorder script includes for better organization in app layout ✨ feat(plebTable): implement confirmation dialogs for accepting and deleting entries in Pleb table
This commit is contained in:
@@ -16,9 +16,11 @@ use PowerComponents\LivewirePowerGrid\PowerGrid;
|
||||
use PowerComponents\LivewirePowerGrid\PowerGridFields;
|
||||
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
|
||||
use PowerComponents\LivewirePowerGrid\Traits\WithExport;
|
||||
use WireUi\Traits\WireUiActions;
|
||||
|
||||
final class EinundzwanzigPlebTable extends PowerGridComponent
|
||||
{
|
||||
use WireUiActions;
|
||||
use WithExport;
|
||||
|
||||
public string $sortField = 'application_for';
|
||||
@@ -139,8 +141,37 @@ final class EinundzwanzigPlebTable extends PowerGridComponent
|
||||
return [];
|
||||
}
|
||||
|
||||
#[\Livewire\Attributes\On('edit')]
|
||||
public function edit($rowId): void
|
||||
#[\Livewire\Attributes\On('accept')]
|
||||
public function accept($rowId): void
|
||||
{
|
||||
$pleb = EinundzwanzigPleb::query()
|
||||
->with('profile')
|
||||
->findOrFail($rowId);
|
||||
$this->dialog()->confirm([
|
||||
'title' => 'Bist du sicher?',
|
||||
'description' => 'Möchtest du ' . $pleb->profile->name . ' wirklich akzeptieren?',
|
||||
'acceptLabel' => 'Ja, akzeptieren',
|
||||
'method' => 'acceptPleb',
|
||||
'params' => $rowId,
|
||||
]);
|
||||
}
|
||||
|
||||
#[\Livewire\Attributes\On('delete')]
|
||||
public function delete($rowId): void
|
||||
{
|
||||
$pleb = EinundzwanzigPleb::query()
|
||||
->with('profile')
|
||||
->findOrFail($rowId);
|
||||
$this->dialog()->confirm([
|
||||
'title' => 'Bist du sicher?',
|
||||
'description' => 'Möchtest du ' . $pleb->profile->name . ' wirklich löschen?',
|
||||
'acceptLabel' => 'Ja, lösche',
|
||||
'method' => 'deletePleb',
|
||||
'params' => $rowId,
|
||||
]);
|
||||
}
|
||||
|
||||
public function acceptPleb($rowId)
|
||||
{
|
||||
$pleb = EinundzwanzigPleb::query()->findOrFail($rowId);
|
||||
$for = $pleb->application_for;
|
||||
@@ -154,16 +185,33 @@ final class EinundzwanzigPlebTable extends PowerGridComponent
|
||||
$this->fillData();
|
||||
}
|
||||
|
||||
public function deletePleb($rowId)
|
||||
{
|
||||
$pleb = EinundzwanzigPleb::query()->findOrFail($rowId);
|
||||
$pleb->application_for = null;
|
||||
$pleb->application_text = null;
|
||||
$pleb->save();
|
||||
|
||||
$this->fillData();
|
||||
}
|
||||
|
||||
public function actions(EinundzwanzigPleb $row): array
|
||||
{
|
||||
return [
|
||||
Button::add('edit')
|
||||
->slot('Approve')
|
||||
Button::add('delete')
|
||||
->slot('Löschen')
|
||||
->id()
|
||||
->class(
|
||||
'btn bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 text-red-500',
|
||||
)
|
||||
->dispatch('delete', ['rowId' => $row->id]),
|
||||
Button::add('accept')
|
||||
->slot('Akzeptieren')
|
||||
->id()
|
||||
->class(
|
||||
'btn bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700/60 hover:border-gray-300 dark:hover:border-gray-600 text-green-500',
|
||||
)
|
||||
->dispatch('edit', ['rowId' => $row->id]),
|
||||
->dispatch('accept', ['rowId' => $row->id]),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -171,7 +219,7 @@ final class EinundzwanzigPlebTable extends PowerGridComponent
|
||||
{
|
||||
return [
|
||||
// Hide button edit for ID 1
|
||||
Rule::button('edit')
|
||||
Rule::button('accept')
|
||||
->when(fn($row) => $row->application_for === null)
|
||||
->hide(),
|
||||
];
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
|
||||
<title>{{ $title ?? 'Page Title' }}</title>
|
||||
@livewireStyles
|
||||
@wireUiScripts
|
||||
@stack('scripts')
|
||||
@vite(['resources/js/app.js','resources/css/app.css'])
|
||||
@googlefonts
|
||||
<script src="https://kit.fontawesome.com/866fd3d0ab.js" crossorigin="anonymous"></script>
|
||||
@wireUiScripts
|
||||
@stack('scripts')
|
||||
</head>
|
||||
<body
|
||||
class="font-sans antialiased bg-gray-100 dark:bg-[#222222] text-gray-600 dark:text-gray-400"
|
||||
@@ -18,6 +18,8 @@
|
||||
x-data="{ sidebarOpen: false, sidebarExpanded: localStorage.getItem('sidebar-expanded') == 'true', inboxSidebarOpen: false }"
|
||||
x-init="$watch('sidebarExpanded', value => localStorage.setItem('sidebar-expanded', value))"
|
||||
>
|
||||
<x-dialog />
|
||||
<x-notifications />
|
||||
<script>
|
||||
if (localStorage.getItem('sidebar-expanded') == 'true') {
|
||||
document.querySelector('body').classList.add('sidebar-expanded');
|
||||
|
||||
@@ -340,15 +340,13 @@ $loadEvents = function () {
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="mt-8 flex">
|
||||
<div class="mt-8 flex" x-show="!$store.nostr.user">
|
||||
<div class="w-full sm:w-1/2">
|
||||
<h2 class="text-xl leading-snug text-[#1B1B1B] dark:text-gray-100 font-bold mb-1">
|
||||
Nsec.app Tutorial (sicheres Anmelden mit Nsec)
|
||||
</h2>
|
||||
<video class="aspect-video rounded-lg shadow-sm"
|
||||
x-show="!$store.nostr.user"
|
||||
src="https://v.nostr.build/bomfuwLnOTIDrP4y.mp4"
|
||||
autoplay
|
||||
playsinline
|
||||
controls/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user