diff --git a/motorradig/public/css/custom.css b/motorradig/public/css/custom.css index ec7fb03..d033bda 100644 --- a/motorradig/public/css/custom.css +++ b/motorradig/public/css/custom.css @@ -643,3 +643,142 @@ p { background-color: #1d5bc4; border-color: #1d5bc4; } + +/* Alte Touren: Jahres-Pillen und Gruppierung */ +.tour-years { + display: flex; + flex-wrap: wrap; + justify-content: center; + gap: .5rem; + max-width: 760px; + margin: 1.25rem auto 2rem; +} + +.tour-year-pill { + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 4.35rem; + padding: .45rem 1.15rem; + border: 1px solid rgba(255, 255, 255, .35); + border-radius: 999px; + background: rgba(13, 17, 23, .55); + color: #fff; + font-weight: 600; + line-height: 1.2; + text-decoration: none; + transition: background-color .18s ease, border-color .18s ease, + color .18s ease, transform .18s ease; +} + +.tour-year-pill:hover, +.tour-year-pill:focus { + border-color: #4ea1ff; + background: rgba(78, 161, 255, .18); + color: #fff; + text-decoration: none; + transform: translateY(-1px); +} + +.tour-year-pill.is-active { + border-color: #4ea1ff; + background: #4ea1ff; + color: #071a30; + box-shadow: 0 8px 20px rgba(78, 161, 255, .35); +} + +.tour-years-empty { + margin-top: 2rem; +} + +.tour-year-group { + max-width: 760px; + margin: 0 auto 2rem; +} + +.tour-year-heading { + margin: 0 0 .85rem; + color: #fff; + font-size: 1.35rem; + font-weight: 600; + letter-spacing: .02em; +} + +.tour-list { + text-align: left; +} + +.tour-list-item { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + gap: .65rem 1rem; + background: rgba(13, 17, 23, .72); + border-color: rgba(255, 255, 255, .14); + color: #fff; +} + +.tour-list-link { + display: flex; + flex-wrap: wrap; + align-items: baseline; + gap: .35rem .6rem; + color: #fff; + text-decoration: none; +} + +.tour-list-link:hover, +.tour-list-link:focus { + color: #9cc9ff; + text-decoration: none; +} + +.tour-list-title { + font-weight: 600; +} + +.tour-list-meta { + color: rgba(255, 255, 255, .72); + font-variant-numeric: tabular-nums; +} + +.tour-list-actions { + display: inline-flex; + flex-wrap: wrap; + align-items: center; + gap: .7rem; +} + +.tour-gallery-link { + color: #9cc9ff; + text-decoration: none; +} + +.tour-gallery-link:hover, +.tour-gallery-link:focus { + color: #fff; + text-decoration: underline; +} + +.tour-list-actions .badge { + flex-shrink: 0; +} + +@media (max-width: 575.98px) { + .tour-year-pill { + min-width: 3.7rem; + padding: .4rem .9rem; + } + + .tour-list-item { + align-items: flex-start; + flex-direction: column; + } +} + +@media (prefers-reduced-motion: reduce) { + .tour-year-pill { + transition: none; + } +} diff --git a/motorradig/src/Controllers/TourController.php b/motorradig/src/Controllers/TourController.php index e10748a..6c356bc 100644 --- a/motorradig/src/Controllers/TourController.php +++ b/motorradig/src/Controllers/TourController.php @@ -32,18 +32,47 @@ class TourController $tours = Tour::past(); $participantCount = []; $imagecountPerTour = []; + $toursByYear = []; foreach ($tours as $tour) { $participantCount[$tour->id] = Booking::countForTour((int) $tour->id); + + // Jahr vor der Formatierung aus dem DB-Datum (YYYY-MM-DD) lesen. + $year = (int) substr((string) $tour->start, 0, 4); + if ($year < 1900) { + $year = 0; + } + $tour->start = german_date($tour->start); $tour->deadline = german_date($tour->deadline); $files = glob(storage_path('img_storage/tour-' . $tour->id) . '/*') ?: []; $imagecountPerTour[$tour->id] = (int) (count($files) / 2); + + $toursByYear[$year][] = $tour; } + krsort($toursByYear, SORT_NUMERIC); + $years = array_keys($toursByYear); + + // Ohne Auswahl werden alle Jahre gruppiert angezeigt. ?jahr=2025 filtert. + $requestedYear = input('jahr'); + $selectedYear = null; + + if (is_string($requestedYear) && ctype_digit($requestedYear)) { + $candidate = (int) $requestedYear; + if (isset($toursByYear[$candidate])) { + $selectedYear = $candidate; + } + } + + $visibleYears = $selectedYear === null ? $years : [$selectedYear]; + view('tour.index_old', [ - 'tours' => $tours, + 'toursByYear' => $toursByYear, + 'years' => $years, + 'visibleYears' => $visibleYears, + 'selectedYear' => $selectedYear, 'participantCount' => $participantCount, 'imagecountPerTour' => $imagecountPerTour, ]); diff --git a/motorradig/views/tour/index_old.php b/motorradig/views/tour/index_old.php index 4aed5aa..996b130 100644 --- a/motorradig/views/tour/index_old.php +++ b/motorradig/views/tour/index_old.php @@ -2,6 +2,10 @@ use App\Models\Tour; $current = auth_check() ? user() : null; + $selectedYear = $selectedYear ?? null; + $years = $years ?? []; + $toursByYear = $toursByYear ?? []; + $visibleYears = $visibleYears ?? ($selectedYear === null ? $years : [$selectedYear]); ?>
@@ -11,21 +15,46 @@

Aktuelle Touren

-
- . -
+ + + + +
+

+ + +
+ +