Files
LarsandClaude Opus 5.5 4c9e6992f4
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m45s
Design Stufe 2: Tipp-Karten zum Umdrehen, Sommer/Winter-Vergleich, Galerie mit weichem Vergroessern
- Baustein "Ausflugstipps" (tips): Karten mit Foto vorne, Tipp/Weg/beste Zeit hinten; Seebad als Ansichtskarten
- Baustein "Sommer/Winter-Vergleich" (compare): Trennlinie ziehen, Tastatur ueber Range-Input, einmaliger Hinweis-Schwenk
- Lightbox: Foto waechst aus der Vorschau, Blaettern (Pfeile, Tasten, Wischen), Zaehler, Bildunterschrift; partials/lightbox
- Bewegung reduzieren: Ueberblenden statt Drehen, kein Schwenk, keine Zoom-Animation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 21:05:16 +01:00

86 lines
3.5 KiB
PHP

<?php
namespace App\Themes\Sections;
use App\Themes\Theme;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
/**
* Personal excursion tips as cards: photo and name in front, the host's tip, the way there and the best time
* on the back. Guests turn a card with a labelled button; without JavaScript both sides are shown.
*/
class TipsSection extends Section
{
public static function key(): string
{
return 'tips';
}
public static function label(): string
{
return 'Ausflugstipps (Karten zum Umdrehen)';
}
public static function icon(): string
{
return 'heroicon-o-sparkles';
}
public static function schema(): array
{
return [
TextInput::make('eyebrow')->label('Kleine Überschrift')->maxLength(100),
TextInput::make('heading')->label('Überschrift')->default('Unsere Tipps für Kühlungsborn')->maxLength(160),
Textarea::make('text')->label('Text')->rows(2)->maxLength(400),
TextInput::make('signature')
->label('Unterschrift')
->helperText('Steht unter jedem Tipp, z. B. „Brigitte“. Leer lassen für keine.')
->maxLength(60),
Repeater::make('tips')
->label('Tipps')
->addActionLabel('Tipp hinzufügen')
->helperText('Vier oder sechs Karten wirken am ruhigsten.')
->defaultItems(0)
->maxItems(9)
->collapsible()
->itemLabel(fn (array $state): ?string => $state['title'] ?? null)
->columns(2)
->schema([
TextInput::make('title')->label('Ziel')->placeholder('Gespensterwald')->required()->maxLength(80),
static::photoSelect('photo_id', 'Foto'),
Textarea::make('tip')
->label('Ihr Tipp (Rückseite)')
->placeholder('Am schönsten am späten Nachmittag, wenn die Sonne durch die Buchen fällt …')
->rows(3)
->required()
->maxLength(400)
->columnSpanFull(),
TextInput::make('way')->label('Weg dorthin')->placeholder('25 Minuten mit dem Rad')->maxLength(80),
TextInput::make('best_time')->label('Beste Zeit')->placeholder('Später Nachmittag')->maxLength(80),
]),
];
}
public function data(Theme $theme, array $data): array
{
$tips = collect($data['tips'] ?? [])->filter(fn (mixed $tip): bool => is_array($tip) && filled($tip['title'] ?? null) && filled($tip['tip'] ?? null));
$photos = $this->photos($tips->pluck('photo_id')->filter()->values()->all())->keyBy('id');
return [
'eyebrow' => $data['eyebrow'] ?? null,
'heading' => $data['heading'] ?? null,
'text' => $data['text'] ?? null,
'signature' => $data['signature'] ?? null,
'tips' => $tips->map(fn (array $tip): array => [
'title' => (string) $tip['title'],
'photo' => $photos->get((int) ($tip['photo_id'] ?? 0)),
'tip' => (string) $tip['tip'],
'way' => filled($tip['way'] ?? null) ? (string) $tip['way'] : null,
'bestTime' => filled($tip['best_time'] ?? null) ? (string) $tip['best_time'] : null,
])->values()->all(),
];
}
}