News Design (vibe-kanban 220425f3)

Nutze das aktuelle pencil Design und setze die News Seite 100% genauso um. Validiere deine Ergebnisse mit playwright. Überschreibe tailwindcss und Flux UI Styles wenn nötig.
This commit is contained in:
vk
2026-02-13 16:02:03 +01:00
parent ff7b9a3493
commit 6aa05e47f3
4 changed files with 205 additions and 122 deletions

9
app/Enums/Emoji.php Normal file
View File

@@ -0,0 +1,9 @@
<?php
namespace App\Enums;
use ArchTech\Enums\Meta\MetaProperty;
use Attribute;
#[Attribute]
class Emoji extends MetaProperty {}

View File

@@ -10,7 +10,7 @@ use ArchTech\Enums\Names;
use ArchTech\Enums\Options; use ArchTech\Enums\Options;
use ArchTech\Enums\Values; use ArchTech\Enums\Values;
#[Meta(Label::class, Color::class, Icon::class)] #[Meta(Label::class, Color::class, Icon::class, Emoji::class)]
enum NewsCategory: int enum NewsCategory: int
{ {
use From; use From;
@@ -20,31 +20,31 @@ enum NewsCategory: int
use Options; use Options;
use Values; use Values;
#[Label('Einundzwanzig')] #[Color('amber')] #[Icon('bitcoin-sign')] #[Label('Einundzwanzig')] #[Color('amber')] #[Icon('bitcoin-sign')] #[Emoji('₿')]
case Einundzwanzig = 1; case Einundzwanzig = 1;
#[Label('Allgemeines')] #[Color('zinc')] #[Icon('newspaper')] #[Label('Allgemeines')] #[Color('zinc')] #[Icon('newspaper')] #[Emoji('📋')]
case Allgemeines = 2; case Allgemeines = 2;
#[Label('Organisation')] #[Color('cyan')] #[Icon('file-lines')] #[Label('Organisation')] #[Color('cyan')] #[Icon('file-lines')] #[Emoji('📁')]
case Organisation = 3; case Organisation = 3;
#[Label('Bitcoin')] #[Color('orange')] #[Icon('coins')] #[Label('Bitcoin')] #[Color('orange')] #[Icon('coins')] #[Emoji('🏠')]
case Bitcoin = 4; case Bitcoin = 4;
#[Label('Meetups')] #[Color('green')] #[Icon('users')] #[Label('Meetups')] #[Color('green')] #[Icon('users')] #[Emoji('🎉')]
case Meetups = 5; case Meetups = 5;
#[Label('Bildung')] #[Color('blue')] #[Icon('graduation-cap')] #[Label('Bildung')] #[Color('blue')] #[Icon('graduation-cap')] #[Emoji('📚')]
case Bildung = 6; case Bildung = 6;
#[Label('Protokolle')] #[Color('purple')] #[Icon('clipboard-list')] #[Label('Protokolle')] #[Color('purple')] #[Icon('clipboard-list')] #[Emoji('📝')]
case Protokolle = 7; case Protokolle = 7;
#[Label('Finanzen')] #[Color('emerald')] #[Icon('chart-pie')] #[Label('Finanzen')] #[Color('emerald')] #[Icon('chart-pie')] #[Emoji('💰')]
case Finanzen = 8; case Finanzen = 8;
#[Label('Veranstaltungen')] #[Color('rose')] #[Icon('calendar-star')] #[Label('Veranstaltungen')] #[Color('rose')] #[Icon('calendar-star')] #[Emoji('📅')]
case Veranstaltungen = 9; case Veranstaltungen = 9;
public static function selectOptions() public static function selectOptions()
@@ -62,6 +62,8 @@ enum NewsCategory: int
), ),
'icon' => self::fromName($name) 'icon' => self::fromName($name)
->icon(), ->icon(),
'emoji' => self::fromName($name)
->emoji(),
] ]
) )
->values() ->values()

View File

@@ -81,4 +81,66 @@
.brand-icon { .brand-icon {
@apply w-8 h-8 rounded-lg bg-orange-primary flex items-center justify-center; @apply w-8 h-8 rounded-lg bg-orange-primary flex items-center justify-center;
} }
/**
* News Category Badges
*
* Farbige Kategorie-Badges für News-Karten.
* Jede Farbe hat einen transparenten Hintergrund mit passender Textfarbe.
*/
.news-category-badge {
@apply bg-bg-elevated text-text-secondary border border-border-default;
}
.news-category-badge--amber {
background-color: #FF5C0033;
color: #FF5C00;
border: none;
}
.news-category-badge--zinc {
@apply bg-bg-elevated text-text-secondary border border-border-default;
}
.news-category-badge--cyan {
background-color: #06b6d433;
color: #06b6d4;
border: none;
}
.news-category-badge--orange {
background-color: #FF5C0033;
color: #FF5C00;
border: none;
}
.news-category-badge--green {
background-color: #22c55e33;
color: #22c55e;
border: none;
}
.news-category-badge--blue {
background-color: #3b82f633;
color: #3b82f6;
border: none;
}
.news-category-badge--purple {
background-color: #7c3aed33;
color: #7c3aed;
border: none;
}
.news-category-badge--emerald {
background-color: #10b98133;
color: #10b981;
border: none;
}
.news-category-badge--rose {
background-color: #f4365833;
color: #f43658;
border: none;
}
} }

View File

@@ -142,109 +142,89 @@ class extends Component {
<div> <div>
@if($isAllowed) @if($isAllowed)
<div class="lg:flex gap-8"> <div class="flex flex-col gap-6 lg:flex-row lg:gap-8">
<!-- Main content --> <!-- Main content -->
<div class="flex-1 min-w-0"> <div class="flex-1 min-w-0 flex flex-col gap-6">
<!-- Header --> <!-- Page title -->
<div class="mb-6 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between"> <h1 class="text-[28px] font-semibold text-text-primary">News</h1>
<flux:heading size="xl">News</flux:heading>
</div>
<!-- Category filter (horizontal, scrollable on mobile) --> <!-- Category filter pills -->
<div class="mb-6 flex flex-nowrap gap-2 overflow-x-auto no-scrollbar pb-1"> <div class="flex flex-nowrap gap-2 overflow-x-auto no-scrollbar pb-1">
<flux:badge <button
as="button"
wire:click="clearFilter" wire:click="clearFilter"
:color="$selectedCategory === null ? 'amber' : 'zinc'" class="shrink-0 rounded-full px-4 py-1.5 text-[13px] font-semibold transition-colors cursor-pointer {{ $selectedCategory === null ? 'bg-orange-primary text-white' : 'border border-border-default text-text-secondary hover:text-text-primary' }}"
:variant="$selectedCategory === null ? 'solid' : 'outline'"
size="sm"
class="shrink-0 cursor-pointer"
> >
Alle Alle
</flux:badge> </button>
@foreach(\App\Enums\NewsCategory::selectOptions() as $category) @foreach(\App\Enums\NewsCategory::selectOptions() as $category)
<flux:badge <button
wire:key="cat_{{ $category['value'] }}" wire:key="cat_{{ $category['value'] }}"
as="button"
wire:click="filterByCategory({{ $category['value'] }})" wire:click="filterByCategory({{ $category['value'] }})"
:color="$selectedCategory === $category['value'] ? 'amber' : 'zinc'" class="shrink-0 rounded-full px-4 py-1.5 text-[13px] transition-colors cursor-pointer {{ $selectedCategory === $category['value'] ? 'bg-orange-primary text-white font-semibold' : 'border border-border-default text-text-secondary hover:text-text-primary font-normal' }}"
:variant="$selectedCategory === $category['value'] ? 'solid' : 'outline'"
size="sm"
class="shrink-0 cursor-pointer"
> >
<i class="fa-sharp-duotone fa-solid fa-{{ $category['icon'] }} mr-1"></i> {{ $category['emoji'] }} {{ $category['label'] }}
{{ $category['label'] }} </button>
</flux:badge>
@endforeach @endforeach
</div> </div>
<!-- News list --> <!-- News list -->
<div class="space-y-4"> <div class="flex flex-col gap-4">
@forelse($this->filteredNews as $post) @forelse($this->filteredNews as $post)
<flux:card wire:key="post_{{ $post->id }}" class="space-y-0"> <div wire:key="post_{{ $post->id }}" class="news-card bg-bg-surface rounded-xl p-5 border border-border-subtle flex flex-col gap-4">
<!-- Header row: avatar + meta + actions --> <!-- Card header: avatar + meta -->
<div class="flex items-start gap-3"> <div class="flex items-center gap-3">
<flux:avatar <img
size="sm" src="{{ $post->einundzwanzigPleb->profile?->picture ?? asset('einundzwanzig-alpha.jpg') }}"
:src="$post->einundzwanzigPleb->profile?->picture ?? asset('einundzwanzig-alpha.jpg')" alt="{{ $post->einundzwanzigPleb->profile?->name ?? 'Anonym' }}"
:name="$post->einundzwanzigPleb->profile?->name ?? 'Anonym'" class="w-10 h-10 rounded-full bg-bg-elevated object-cover shrink-0"
circle
/> />
<div class="flex-1 min-w-0"> <div class="flex-1 min-w-0 flex flex-col gap-1">
<div class="flex flex-wrap items-center gap-2 mb-1"> <div class="flex items-center gap-2">
<flux:text class="text-sm font-medium text-zinc-900 dark:text-zinc-100"> <span class="text-sm font-semibold text-text-primary">{{ $post->einundzwanzigPleb?->profile?->name ?? str($post->einundzwanzigPleb?->npub)->limit(32) }}</span>
{{ $post->einundzwanzigPleb?->profile?->name ?? str($post->einundzwanzigPleb?->npub)->limit(32) }} <span class="text-xs text-text-tertiary">{{ $post->created_at->format('d.m.Y') }}</span>
</flux:text>
<flux:text class="text-xs text-zinc-400 dark:text-zinc-500">
{{ $post->created_at->format('d.m.Y') }}
</flux:text>
</div> </div>
<flux:badge <div>
as="button" <button
wire:click="filterByCategory({{ $post->category->value }})" wire:click="filterByCategory({{ $post->category->value }})"
:color="$post->category->color()" class="news-category-badge news-category-badge--{{ $post->category->color() }} inline-flex items-center rounded-full px-2.5 py-0.5 text-[11px] cursor-pointer"
size="sm"
class="cursor-pointer"
> >
<i class="fa-sharp-duotone fa-solid fa-{{ $post->category->icon() }} mr-1"></i> {{ $post->category->emoji() }} {{ $post->category->label() }}
{{ $post->category->label() }} </button>
</flux:badge> </div>
</div> </div>
</div> </div>
<!-- Body --> <!-- Card body -->
<div class="mt-3"> <div class="flex flex-col gap-2">
<flux:heading class="mb-1">{{ $post->name }}</flux:heading> <h3 class="text-base font-semibold text-text-primary">{{ $post->name }}</h3>
@if($post->description) @if($post->description)
<flux:text class="text-sm">{{ $post->description }}</flux:text> <p class="text-[13px] leading-relaxed text-text-secondary">{{ $post->description }}</p>
@endif @endif
</div> </div>
<!-- Actions --> <!-- Card footer -->
<div class="mt-4 flex items-center gap-2"> <div class="flex items-center">
@if($post->getFirstMedia('pdf')) @if($post->getFirstMedia('pdf'))
<flux:button <a
size="sm" href="{{ url()->temporarySignedRoute('media.signed', now()->addMinutes(30), ['media' => $post->getFirstMedia('pdf')]) }}"
variant="ghost"
target="_blank" target="_blank"
:href="url()->temporarySignedRoute('media.signed', now()->addMinutes(30), ['media' => $post->getFirstMedia('pdf')])" class="inline-flex items-center gap-2 rounded-lg border border-border-default px-4 py-2 text-[13px] font-medium text-text-secondary hover:text-text-primary transition-colors"
icon="document-arrow-down"
> >
<svg class="w-3.5 h-3.5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 13H6"/><path d="M14 13h-1"/></svg>
PDF öffnen PDF öffnen
</flux:button> </a>
@endif @endif
@if($canEdit) @if($canEdit)
<flux:spacer /> <div class="ml-auto">
<flux:modal.trigger name="delete-news-{{ $post->id }}"> <flux:modal.trigger name="delete-news-{{ $post->id }}">
<flux:button <button
size="sm"
variant="danger"
icon="trash"
wire:click="confirmDelete({{ $post->id }})" wire:click="confirmDelete({{ $post->id }})"
class="inline-flex items-center gap-1.5 rounded-lg bg-red-500/20 px-4 py-2 text-[13px] font-medium text-red-500 hover:bg-red-500/30 transition-colors cursor-pointer"
> >
<svg class="w-3.5 h-3.5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/></svg>
Löschen Löschen
</flux:button> </button>
</flux:modal.trigger> </flux:modal.trigger>
<flux:modal name="delete-news-{{ $post->id }}" class="min-w-88"> <flux:modal name="delete-news-{{ $post->id }}" class="min-w-88">
@@ -265,40 +245,43 @@ class extends Component {
</div> </div>
</div> </div>
</flux:modal> </flux:modal>
</div>
@endif @endif
</div> </div>
</flux:card> </div>
@empty @empty
<flux:card> <div class="bg-bg-surface rounded-xl p-5 border border-border-subtle">
<div class="py-6 text-center"> <div class="py-6 text-center">
@if($selectedCategory !== null) @if($selectedCategory !== null)
<flux:icon name="funnel" class="mx-auto mb-3 text-zinc-300 dark:text-zinc-600" /> <flux:icon name="funnel" class="mx-auto mb-3 text-text-disabled" />
<flux:heading>Keine News in dieser Kategorie</flux:heading> <h3 class="text-base font-semibold text-text-primary">Keine News in dieser Kategorie</h3>
<flux:text class="mt-1 text-sm">Versuche eine andere Kategorie oder zeige alle an.</flux:text> <p class="mt-1 text-sm text-text-secondary">Versuche eine andere Kategorie oder zeige alle an.</p>
<flux:button wire:click="clearFilter" size="sm" class="mt-4"> <button wire:click="clearFilter" class="mt-4 rounded-lg border border-border-default px-4 py-2 text-sm text-text-secondary hover:text-text-primary transition-colors cursor-pointer">
Alle anzeigen Alle anzeigen
</flux:button> </button>
@else @else
<flux:icon name="newspaper" class="mx-auto mb-3 text-zinc-300 dark:text-zinc-600" /> <flux:icon name="newspaper" class="mx-auto mb-3 text-text-disabled" />
<flux:heading>Noch keine News vorhanden</flux:heading> <h3 class="text-base font-semibold text-text-primary">Noch keine News vorhanden</h3>
<flux:text class="mt-1 text-sm">Hier werden zukünftige Neuigkeiten angezeigt.</flux:text> <p class="mt-1 text-sm text-text-secondary">Hier werden zukünftige Neuigkeiten angezeigt.</p>
@endif @endif
</div> </div>
</flux:card> </div>
@endforelse @endforelse
</div> </div>
</div> </div>
<!-- Sidebar: create form (board members only) --> <!-- Sidebar: create form (board members only) -->
@if($canEdit) @if($canEdit)
<div class="w-full lg:w-80 shrink-0 mt-8 lg:mt-0"> <div class="w-full lg:w-[360px] shrink-0">
<div class="lg:sticky lg:top-16"> <div class="lg:sticky lg:top-16 flex flex-col gap-6">
<flux:card class="space-y-4"> <div class="flex flex-col gap-6">
<flux:heading>News anlegen</flux:heading> <h2 class="text-lg font-semibold text-text-primary">News anlegen</h2>
<flux:separator />
<flux:file-upload wire:model="file" label="PDF hochladen"> <!-- Upload section -->
<flux:file-upload.dropzone heading="Datei hier ablegen oder klicken" text="PDF bis 10MB" /> <div class="flex flex-col gap-2">
<label class="text-sm font-medium text-text-primary">PDF hochladen</label>
<flux:file-upload wire:model="file">
<flux:file-upload.dropzone heading="Datei hier ablegen oder klicken" text="PDF bis 10MB" class="!border-orange-primary !border-2 !bg-orange-primary/10 !rounded-xl" />
</flux:file-upload> </flux:file-upload>
<flux:error name="file" /> <flux:error name="file" />
@@ -312,9 +295,11 @@ class extends Component {
</x-slot> </x-slot>
</flux:file-item> </flux:file-item>
@endif @endif
</div>
<flux:field> <!-- Kategorie -->
<flux:label>Kategorie</flux:label> <div class="flex flex-col gap-2">
<label class="text-sm font-medium text-text-primary">Kategorie</label>
<flux:select <flux:select
wire:model="form.category" wire:model="form.category"
placeholder="Wähle Kategorie" placeholder="Wähle Kategorie"
@@ -327,25 +312,50 @@ class extends Component {
@endforeach @endforeach
</flux:select> </flux:select>
<flux:error name="form.category" /> <flux:error name="form.category" />
</flux:field> </div>
<flux:field> <!-- Titel -->
<flux:label>Titel</flux:label> <div class="flex flex-col gap-2">
<label class="text-sm font-medium text-text-primary">Titel</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> </div>
<flux:field> <!-- Beschreibung -->
<flux:label>Beschreibung</flux:label> <div class="flex flex-col gap-2">
<flux:description>optional</flux:description> <div class="flex items-center gap-2">
<label class="text-sm font-medium text-text-primary">Beschreibung</label>
<span class="text-xs text-text-tertiary">optional</span>
</div>
<flux:textarea wire:model="form.description" rows="4" placeholder="Beschreibung..." /> <flux:textarea wire:model="form.description" rows="4" placeholder="Beschreibung..." />
<flux:error name="form.description" /> <flux:error name="form.description" />
</flux:field> </div>
<flux:button wire:click="save" variant="primary" class="w-full"> <!-- Submit -->
<button
wire:click="save"
class="w-full rounded-lg bg-orange-primary py-3 px-6 text-sm font-semibold text-white hover:bg-orange-light transition-colors cursor-pointer"
>
Hinzufügen Hinzufügen
</flux:button> </button>
</flux:card>
<!-- User badge -->
@if(NostrAuth::check())
@php
$currentPleb = \App\Models\EinundzwanzigPleb::query()->where('pubkey', NostrAuth::pubkey())->first();
@endphp
@if($currentPleb)
<div class="flex items-center gap-2.5 rounded-xl bg-bg-surface border border-border-subtle px-4 py-2.5">
<img
src="{{ $currentPleb->profile?->picture ?? asset('einundzwanzig-alpha.jpg') }}"
alt="{{ $currentPleb->profile?->name ?? 'Anonym' }}"
class="w-8 h-8 rounded-full bg-bg-elevated object-cover shrink-0"
/>
<span class="text-[13px] font-medium text-text-primary">{{ $currentPleb->profile?->name ?? str($currentPleb->npub)->limit(32) }}</span>
</div>
@endif
@endif
</div>
</div> </div>
</div> </div>
@endif @endif