diff --git a/css/tweaks.css b/css/tweaks.css index f0bd208..7620123 100644 --- a/css/tweaks.css +++ b/css/tweaks.css @@ -194,21 +194,32 @@ body { white-space: nowrap; } - -.btn-pill i { font-size: 1rem; line-height: 1; margin: 0 .5rem; } +.btn-pill i { + font-size: 1rem; + line-height: 1; + margin: 0 0.5rem; +} .btn-pill span { - width: 0; opacity: 0; overflow: hidden; white-space: nowrap; margin-left: 0; - transition: width .18s ease, opacity .18s ease, margin-left .18s ease; + width: 0; + opacity: 0; + overflow: hidden; + white-space: nowrap; + margin-left: 0; + transition: width 0.18s ease, opacity 0.18s ease, margin-left 0.18s ease; } /* Hover: Button wächst, Text klappt auf */ .btn-pill:hover { width: auto; flex: 0 1 16rem; - padding: .5rem .8rem; + padding: 0.5rem 0.8rem; /* Keine Ausrichtung hier setzen – die Utility-Klasse bleibt wirksam */ } -.btn-pill:hover span { width: auto; opacity: 1; margin-left: .35rem; } +.btn-pill:hover span { + width: auto; + opacity: 1; + margin-left: 0.35rem; +} /* Fokus sichtbar (zugänglich) */ .btn-pill:focus-visible { @@ -216,6 +227,14 @@ body { outline-offset: 2px; } +/* ================= Footer ================== */ + +.icon-sm { + width: 24px; /* oder 24px, wenn du es etwas größer magst */ + height: auto; + vertical-align: middle; +} + /* ============ Responsive Tweaks ============ */ @media (max-width: 575.98px) { .card-body { diff --git a/img/heart-icon.png b/img/heart-icon.png new file mode 100644 index 0000000..ab077f2 Binary files /dev/null and b/img/heart-icon.png differ diff --git a/img/no-image-katie.png b/img/no-image-katie.png deleted file mode 100644 index 72987f5..0000000 Binary files a/img/no-image-katie.png and /dev/null differ diff --git a/img/paw-icon.png b/img/paw-icon.png new file mode 100644 index 0000000..d394f72 Binary files /dev/null and b/img/paw-icon.png differ diff --git a/img/shakaru-icon.png b/img/shakaru-icon.png new file mode 100644 index 0000000..80f0997 Binary files /dev/null and b/img/shakaru-icon.png differ diff --git a/include/listgenerator.php b/include/listgenerator.php index fe9bbf7..56a4e9a 100644 --- a/include/listgenerator.php +++ b/include/listgenerator.php @@ -270,12 +270,22 @@ function wishlistMainBuilder(int $ListID, string $sortby = 'priority'): void // 3) Wünsche laden $sql = " - SELECT w.ID, w.image, w.title, w.link, w.price, w.description, - w.date, w.qty, - (SELECT COUNT(*) FROM wishes_reservations r WHERE r.wish_id = w.ID) AS reserved_count - FROM wishes w - WHERE w.wishlist = ? - ORDER BY {$orderSql}"; + SELECT + w.ID, + w.image, + w.title, + w.link, + w.price, + w.description, + w.date, + w.qty, + COALESCE(rc.reserved_count, 0) AS reserved_count + FROM wishes w + LEFT JOIN v_wish_reserved_counts rc + ON rc.wish_id = w.ID + WHERE w.wishlist = ? + ORDER BY {$orderSql}"; + $stmt = $conn->prepare($sql); $stmt->bind_param('i', $ListID); $stmt->execute(); @@ -311,7 +321,7 @@ HTML; $row['link'] !== null ? (string) $row['link'] : null, (int) $row['price'], $row['description'] !== null ? (string) $row['description'] : null, - (int) $row['reserved_count'], // echte Anzahl Reservierungen + (int) $row['reserved_count'], $row['date'] !== null ? (string) $row['date'] : null, isset($row['qty']) ? (int) $row['qty'] : 1 ); diff --git a/index.php b/index.php index 911a1ce..05e7741 100644 --- a/index.php +++ b/index.php @@ -77,13 +77,24 @@ function require_csrf(): void } } ensure_csrf_token(); - // ===== URL-Param: Liste per UUID (oder Alt-ID -> Redirect) ===== $ListID = -1; $ListUUID = ''; -if (isset($_GET['list'])) { +$showCreateEmptyState = false; + +if (!isset($_GET['list'])) { + // Kein Parameter => nur Empty-State ohne Message + $showCreateEmptyState = true; + +} else { $raw = trim((string) $_GET['list']); - if (preg_match('/^[0-9a-fA-F-]{32,36}$/', $raw)) { + + if ($raw === '') { + // Leerer Parameter => nur Empty-State ohne Message + $showCreateEmptyState = true; + + } elseif (preg_match('/^[0-9a-fA-F-]{32,36}$/', $raw)) { + // UUID übergeben $c = db(); $s = $c->prepare('SELECT ID, uuid FROM lists WHERE uuid=?'); $s->bind_param('s', $raw); @@ -92,27 +103,40 @@ if (isset($_GET['list'])) { if ($r && ($row = $r->fetch_assoc())) { $ListID = (int) $row['ID']; $ListUUID = (string) $row['uuid']; + } else { + // UUID-Format ok, aber nicht vorhanden => Message + Empty-State + $message = ['msg' => 'Diese Liste gibt es nicht. Lege eine neue an oder prüfe den Link.', 'type' => 'warning']; + $showCreateEmptyState = true; } $s->close(); $c->close(); - } else { - $ListID = (int) $raw; - if ($ListID >= 0) { - $c = db(); - $s = $c->prepare('SELECT uuid FROM lists WHERE ID=?'); - $s->bind_param('i', $ListID); - $s->execute(); - $r = $s->get_result(); - if ($r && ($row = $r->fetch_assoc())) { - $ListUUID = (string) $row['uuid']; - $scheme = $secure ? 'https' : 'http'; - $host = $_SERVER['HTTP_HOST'] ?? ''; - header('Location: ' . $scheme . '://' . $host . '/?list=' . urlencode($ListUUID), true, 301); - exit; - } - $s->close(); - $c->close(); + + } elseif (preg_match('/^\d+$/', $raw)) { + // Numerische ID übergeben -> auf UUID umleiten, wenn vorhanden + $id = (int) $raw; + $c = db(); + $s = $c->prepare('SELECT uuid FROM lists WHERE ID=?'); + $s->bind_param('i', $id); + $s->execute(); + $r = $s->get_result(); + if ($r && ($row = $r->fetch_assoc())) { + $uuid = (string) $row['uuid']; + $scheme = $secure ? 'https' : 'http'; + $host = $_SERVER['HTTP_HOST'] ?? ''; + header('Location: ' . $scheme . '://' . $host . '/?list=' . urlencode($uuid), true, 301); + exit; + } else { + // ID-Format ok, aber nicht vorhanden => Message + Empty-State + $message = ['msg' => 'Diese Liste gibt es nicht. Lege eine neue an oder prüfe den Link.', 'type' => 'warning']; + $showCreateEmptyState = true; } + $s->close(); + $c->close(); + + } else { + // Weder gültige UUID noch Zahl => Message + Empty-State + $message = ['msg' => 'Diese Liste gibt es nicht. Lege eine neue an oder prüfe den Link.', 'type' => 'warning']; + $showCreateEmptyState = true; } } @@ -252,7 +276,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { - + @@ -277,29 +301,33 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
@@ -314,13 +342,46 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { - + + ++ Es wurde keine gültige Liste ausgewählt. Du kannst jetzt eine neue Liste anlegen. +
++ +
+