diff --git a/src/app/p/[secret]/ads/page.tsx b/src/app/p/[secret]/ads/page.tsx index 45076f5..618ed22 100644 --- a/src/app/p/[secret]/ads/page.tsx +++ b/src/app/p/[secret]/ads/page.tsx @@ -3,6 +3,8 @@ import { useState, useRef, useCallback } from "react"; import { useQuery, useQueries, useMutation, useQueryClient } from "@tanstack/react-query"; import { useTRPC } from "@/trpc/client"; +import { AdminPageHeader } from "@/components/admin/AdminSection"; +import { StatusBadge } from "@/components/admin/StatusBadge"; import { getMediaUrl } from "@/lib/media-url"; import { Plus, Pencil, Trash2, Loader2, Check, X, ImagePlus, ImageOff, Eye, PawPrint, MessageCircle, Repeat2 } from "lucide-react"; import { Button } from "@/components/ui/button"; @@ -10,7 +12,6 @@ import { Input } from "@/components/ui/input"; import { Textarea } from "@/components/ui/textarea"; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog"; import { Switch } from "@/components/ui/switch"; -import { Badge } from "@/components/ui/badge"; import { toast } from "sonner"; type AdForm = { @@ -171,8 +172,8 @@ export default function AdminAdsPage() { await new Promise((resolve, reject) => { const xhr = new XMLHttpRequest(); xhr.onload = () => - xhr.status >= 200 && xhr.status < 300 ? resolve() : reject(new Error(`Upload failed: ${xhr.status}`)); - xhr.onerror = () => reject(new Error("Network error")); + xhr.status >= 200 && xhr.status < 300 ? resolve() : reject(new Error(`Hochladen fehlgeschlagen (${xhr.status})`)); + xhr.onerror = () => reject(new Error("Netzwerkfehler")); xhr.open("PUT", presignedUrl); xhr.setRequestHeader("Content-Type", file.type); xhr.send(file); @@ -201,21 +202,24 @@ export default function AdminAdsPage() { const isPending = createAd.isPending || updateAd.isPending; return ( -
-
-

Werbung

- -
+
+ + + Neue Anzeige + + } + /> {isLoading ? (
) : ads.length === 0 ? ( -

Noch keine Ads — oben erstellen

+

Noch keine Anzeigen – oben rechts „Neue Anzeige“ wählen.

) : (
{ads.map((ad) => ( @@ -241,17 +245,17 @@ export default function AdminAdsPage() {

{ad.title}

{ad.isActive ? ( - Aktiv + Aktiv ) : ( - Inaktiv + Inaktiv )} {ad.species.length > 0 && ( - + {ad.species .map((id) => speciesList?.find((s) => s.id === id)?.name ?? "?") .join(", ")} {ad.breeds.length > 0 && ` · ${ad.breeds.length} Rasse${ad.breeds.length !== 1 ? "n" : ""}`} - + )}
{ad.caption && ( @@ -299,7 +303,7 @@ export default function AdminAdsPage() { { if (!o) closeDialog(); }}> - {editingId ? "Ad bearbeiten" : "Ad erstellen"} + {editingId ? "Anzeige bearbeiten" : "Anzeige erstellen"}
@@ -317,7 +321,7 @@ export default function AdminAdsPage() { {/* eslint-disable-next-line @next/next/no-img-element */} Ad preview
@@ -369,7 +373,7 @@ export default function AdminAdsPage() { className="bg-muted border-border text-foreground placeholder:text-muted-foreground" />