diff --git a/src/app/p/[secret]/reports/page.tsx b/src/app/p/[secret]/reports/page.tsx index a08008f..dc218d9 100644 --- a/src/app/p/[secret]/reports/page.tsx +++ b/src/app/p/[secret]/reports/page.tsx @@ -37,9 +37,23 @@ export default function AdminReportsPage() { const qc = useQueryClient(); const [action, setAction] = useState(null); const [reason, setReason] = useState(""); + const [detailPostId, setDetailPostId] = useState(null); const { data: reports = [], isLoading } = useQuery(trpc.admin.listReports.queryOptions()); + const { data: detailPost, isLoading: detailLoading } = useQuery( + trpc.admin.getReportedPostDetail.queryOptions( + { postId: detailPostId ?? "" }, + { enabled: !!detailPostId } + ) + ); + const { data: detailComments } = useQuery( + trpc.admin.listComments.queryOptions( + { postId: detailPostId ?? "" }, + { enabled: !!detailPostId } + ) + ); + const invalidate = () => void qc.invalidateQueries({ queryKey: trpc.admin.listReports.queryKey() }); @@ -161,7 +175,12 @@ export default function AdminReportsPage() { {/* Post preview */} {report.post ? ( -
+
- + ) : report.targetPetId ? (

@@ -286,6 +305,145 @@ export default function AdminReportsPage() { + + {/* Reported post detail — full images, who reacted, all comments */} +

{ if (!o) setDetailPostId(null); }}> + + + Gemeldeter Post + + + {detailLoading || !detailPost ? ( +
+ +
+ ) : ( +
+ {/* Images */} +
+ {detailPost.images.length > 0 ? ( + detailPost.images.map((img, i) => ( + + )) + ) : ( +
+ +
+ )} +
+ + {/* Right panel */} +
+
+
+ {detailPost.pet.avatarKey ? ( + // eslint-disable-next-line @next/next/no-img-element + + ) : ( +
+ )} + {detailPost.pet.name} + + {new Date(detailPost.createdAt).toLocaleDateString("de-DE", { + day: "2-digit", + month: "2-digit", + year: "numeric", + hour: "2-digit", + minute: "2-digit", + })} + +
+ {detailPost.caption && ( +

+ {detailPost.caption} +

+ )} +
+ + {/* Who liked */} +
+

+ + Geliked von ({detailPost.reactions.length}) +

+ {detailPost.reactions.length === 0 ? ( +

Noch keine Reaktionen.

+ ) : ( +
+ {detailPost.reactions.map((r, i) => ( +
+ {r.pet.avatarKey ? ( + // eslint-disable-next-line @next/next/no-img-element + + ) : ( +
+ )} + {r.pet.name} +
+ ))} +
+ )} +
+ + {/* Comments */} +
+

+ + Kommentare ({detailComments?.length ?? 0}) +

+ {!detailComments || detailComments.length === 0 ? ( +

Keine Kommentare.

+ ) : ( +
+ {detailComments.map((c) => ( +
+ {c.pet.avatarKey ? ( + // eslint-disable-next-line @next/next/no-img-element + + ) : ( +
+ )} +
+ {c.pet.name}{" "} + + {new Date(c.createdAt).toLocaleDateString("de-DE", { + day: "2-digit", + month: "2-digit", + })} + +

{c.body}

+
+
+ ))} +
+ )} +
+
+
+ )} + +
); } diff --git a/src/app/p/[secret]/users/page.tsx b/src/app/p/[secret]/users/page.tsx index 29887ff..8b3af21 100644 --- a/src/app/p/[secret]/users/page.tsx +++ b/src/app/p/[secret]/users/page.tsx @@ -284,7 +284,7 @@ export default function AdminUsersPage() {