From d09b22f4ce826bf09d961a95b8ea2b59ac3c45ef Mon Sep 17 00:00:00 2001 From: neodk2004 Date: Wed, 12 Aug 2026 08:00:48 +0200 Subject: [PATCH] feat(admin): make the posts moderation grid density selectable (3/5/8 cols) --- src/app/p/[secret]/posts/page.tsx | 46 ++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/src/app/p/[secret]/posts/page.tsx b/src/app/p/[secret]/posts/page.tsx index 8dabd17..1ca2dc6 100644 --- a/src/app/p/[secret]/posts/page.tsx +++ b/src/app/p/[secret]/posts/page.tsx @@ -10,11 +10,23 @@ import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from " import { getMediaUrl } from "@/lib/media-url"; import { BlurImage } from "@/components/ui/blur-image"; import { MILESTONE_META } from "@/lib/milestone-meta"; +import { cn } from "@/lib/utils"; + +const GRID_SIZES = [3, 5, 8] as const; +type GridSize = (typeof GRID_SIZES)[number]; + +// Tailwind class names must be static strings for the JIT scanner to pick them up. +const GRID_COLS_CLASS: Record = { + 3: "sm:grid-cols-2 lg:grid-cols-3", + 5: "sm:grid-cols-3 lg:grid-cols-5", + 8: "sm:grid-cols-4 lg:grid-cols-8", +}; export default function AdminPostsPage() { const trpc = useTRPC(); const qc = useQueryClient(); const [search, setSearch] = useState(""); + const [gridSize, setGridSize] = useState(3); const [commentsPostId, setCommentsPostId] = useState(null); const [deleteTarget, setDeleteTarget] = useState<{ id: string; type: "post" | "comment" } | null>(null); const [reason, setReason] = useState(""); @@ -70,12 +82,32 @@ export default function AdminPostsPage() {

Posts

- setSearch(e.target.value)} - className="w-64 bg-zinc-900 border-zinc-700 text-zinc-100 placeholder:text-zinc-500" - /> +
+
+ {GRID_SIZES.map((size) => ( + + ))} +
+ setSearch(e.target.value)} + className="w-64 bg-zinc-900 border-zinc-700 text-zinc-100 placeholder:text-zinc-500" + /> +
{isLoading ? ( @@ -84,7 +116,7 @@ export default function AdminPostsPage() {
) : (
-
+
{posts.map((post) => { const originalPost = post.repost?.originalPost; const effectiveMilestone = post.milestone ?? originalPost?.milestone;