🎉 update(deps): bump dependencies for email-validator, pretty-package-versions, and others to latest versions

🔒 refactor(auth): streamline access control logic in election and project support forms

 add(styles): include partial styles for better layout management

🚀 feat(layout): integrate new styles partial into main layout for consistent design

🆕 create(partials): add styles partial to manage CSS styles more effectively
This commit is contained in:
fsociety
2025-03-23 23:28:02 +01:00
parent ffa6564d00
commit 0b5b6cc9ad
12 changed files with 133 additions and 126 deletions

View File

@@ -14,6 +14,7 @@
<script src="https://kit.fontawesome.com/866fd3d0ab.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/easymde/dist/easymde.min.css">
<script src="https://cdn.jsdelivr.net/npm/easymde/dist/easymde.min.js"></script>
@include('components.layouts.partials.styles')
</head>
<body
class="font-sans antialiased bg-gray-100 dark:bg-[#222222] text-gray-600 dark:text-gray-400"

View File

@@ -26,7 +26,7 @@
</div>
</a>
</li>
<li class="{{ $currentRoute === 'association.election' ? $isCurrentRouteClass : $isNotCurrentRouteClass }}">
{{--<li class="{{ $currentRoute === 'association.election' ? $isCurrentRouteClass : $isNotCurrentRouteClass }}">
<a class="block text-gray-800 dark:text-gray-100 hover:text-gray-900 dark:hover:text-white truncate transition"
href="{{ route('association.election', ['election' => date('Y')]) }}">
<div class="flex items-center">
@@ -35,7 +35,7 @@
class="text-sm font-medium ml-4 lg:opacity-0 lg:sidebar-expanded:opacity-100 2xl:opacity-100 duration-200">Vorstands-Wahlen</span>
</div>
</a>
</li>
</li>--}}
<li class="{{ $currentRoute === 'association.projectSupport' ? $isCurrentRouteClass : $isNotCurrentRouteClass }}">
<a class="block text-gray-800 dark:text-gray-100 hover:text-gray-900 dark:hover:text-white truncate transition"
href="{{ route('association.projectSupport') }}">

View File

@@ -0,0 +1,3 @@
<style>
/**/
</style>

View File

@@ -51,17 +51,14 @@ on([
'nostrLoggedIn' => function ($pubkey) {
$this->currentPubkey = $pubkey;
$this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $pubkey)->first();
if ($this->currentPleb->association_status->value < 3) {
return $this->js('alert("Du bist nicht berechtigt, an der Wahl teilzunehmen.")');
}
$logPubkeys = [
'0adf67475ccc5ca456fd3022e46f5d526eb0af6284bf85494c0dd7847f3e5033',
'430169631f2f0682c60cebb4f902d68f0c71c498fd1711fd982f052cf1fd4279',
];
if (in_array($this->currentPubkey, $logPubkeys, true)) {
$this->showLog = true;
$this->isAllowed = true;
}
$this->isAllowed = true;
},
'echo:votes,.newVote' => function () {
$this->loadEvents();

View File

@@ -67,16 +67,17 @@ on([
]);
on([
'nostrLoggedIn' => fn($pubkey)
=> [
$this->currentPubkey = $pubkey,
'nostrLoggedIn' => function($pubkey) {
$this->currentPubkey = $pubkey;
$allowedPubkeys = [
'0adf67475ccc5ca456fd3022e46f5d526eb0af6284bf85494c0dd7847f3e5033',
'430169631f2f0682c60cebb4f902d68f0c71c498fd1711fd982f052cf1fd4279',
],
!in_array($this->currentPubkey, $allowedPubkeys, true) ?
$this->js('alert("Du bist hierzu nicht berechtigt.")') : $this->isAllowed = true,
],
];
if(in_array($this->currentPubkey, $allowedPubkeys, true)) {
$this->isAllowed = true;
}
dd($this->isAllowed);
},
'echo:votes,.newVote' => fn()
=> [
$this->loadEvents(),
@@ -186,7 +187,9 @@ $loadNostrEvents = function ($kinds) {
];
@endphp
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto" x-data="electionAdminCharts(@this)">
@if($isAllowed)
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto" x-data="electionAdminCharts(@this)">
<!-- Dashboard actions -->
<div class="sm:flex sm:justify-between sm:items-center mb-8">
@@ -237,5 +240,18 @@ $loadNostrEvents = function ($kinds) {
</div>
@else
<div class="px-4 sm:px-6 lg:px-8 py-8 w-full max-w-9xl mx-auto">
<div class="bg-white dark:bg-[#1B1B1B] shadow overflow-hidden sm:rounded-lg">
<div class="px-4 py-5 sm:px-6">
<h3 class="text-lg font-medium leading-6 text-gray-900 dark:text-gray-200">Mitglieder</h3>
<p class="mt-1 max-w">
Du bist nicht berechtigt, Mitglieder zu bearbeiten.
</p>
</div>
</div>
</div>
@endif
@endvolt
</x-layouts.app>

View File

@@ -36,10 +36,13 @@ on([
$this->currentPubkey = $pubkey;
$this->currentPleb = \App\Models\EinundzwanzigPleb::query()
->where('pubkey', $pubkey)->first();
if ($this->currentPubkey !== '0adf67475ccc5ca456fd3022e46f5d526eb0af6284bf85494c0dd7847f3e5033') {
return $this->js('alert("Du bist nicht berechtigt, Wahlen zu bearbeiten.")');
$logPubkeys = [
'0adf67475ccc5ca456fd3022e46f5d526eb0af6284bf85494c0dd7847f3e5033',
'430169631f2f0682c60cebb4f902d68f0c71c498fd1711fd982f052cf1fd4279',
];
if (in_array($this->currentPubkey, $logPubkeys, true)) {
$this->isAllowed = true;
}
$this->isAllowed = true;
},
]);

View File

@@ -40,10 +40,9 @@ on([
'f240be2b684f85cc81566f2081386af81d7427ea86250c8bde6b7a8500c761ba',
'19e358b8011f5f4fc653c565c6d4c2f33f32661f4f90982c9eedc292a8774ec3',
];
if (!in_array($this->currentPubkey, $allowedPubkeys, true)) {
return $this->js('alert("Du bist nicht berechtigt, Mitglieder zu bearbeiten.")');
if (in_array($this->currentPubkey, $allowedPubkeys, true)) {
$this->isAllowed = true;
}
$this->isAllowed = true;
},
]);

View File

@@ -56,9 +56,6 @@ $getOtherVotes = function () {
$handleNostrLoggedIn = function ($pubkey) {
$this->currentPubkey = $pubkey;
$this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $pubkey)->first();
if ($this->currentPleb->association_status->value < 2) {
return $this->js('alert("Du bist hierzu nicht berechtigt.")');
}
$this->isAllowed = true;
$this->ownVoteExists = Vote::query()
->where('project_proposal_id', $this->projectProposal->id)

View File

@@ -35,12 +35,6 @@ on([
'nostrLoggedIn' => function ($pubkey) {
$this->currentPubkey = $pubkey;
$this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $pubkey)->first();
if (
$this->currentPleb->id !== $this->projectProposal->einundzwanzig_pleb_id
&& !in_array($this->currentPleb->npub, config('einundzwanzig.config.current_board'), true)
) {
return $this->js('alert("Du bist hierzu nicht berechtigt.")');
}
$this->isAllowed = true;
},
'nostrLoggedOut' => function () {

View File

@@ -29,9 +29,6 @@ on([
'nostrLoggedIn' => function ($pubkey) {
$this->currentPubkey = $pubkey;
$this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $pubkey)->first();
if ($this->currentPleb->association_status->value < 3) {
return $this->js('alert("Du bist hierzu nicht berechtigt.")');
}
$this->isAllowed = true;
},
'nostrLoggedOut' => function () {

View File

@@ -33,9 +33,6 @@ on([
'nostrLoggedIn' => function ($pubkey) {
$this->currentPubkey = $pubkey;
$this->currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', $pubkey)->first();
if ($this->currentPleb->association_status->value < 2) {
return $this->js('alert("Du bist hierzu nicht berechtigt.")');
}
$this->isAllowed = true;
},
'nostrLoggedOut' => function () {
@@ -98,7 +95,7 @@ $delete = function ($id) {
</form>
<!-- Add meetup button -->
@if($currentPleb && $currentPleb->association_status->value > 2)
@if($currentPleb && $currentPleb->association_status->value > 1)
<x-button :href="route('association.projectSupport.create')" icon="plus"
label="Projekt einreichen"/>
@endif