"use client"; import Image from "next/image"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { PlusIcon, RefreshCwIcon, RotateCcwIcon, Trash2Icon } from "lucide-react"; import { useTransition } from "react"; import { toast } from "sonner"; import { deleteStructuredGuide, moveGuideToTrash, restoreStructuredGuide, startCatalogSync } from "@/app/admin/actions"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "@/components/ui/alert-dialog"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty"; import { Spinner } from "@/components/ui/spinner"; type GuideCard = { id: string; characterKey: string; name: string; overview: string; coverUrl: string; version: number; updatedAt: Date; trashedAt: Date | null }; export function StructuredDashboard({ guides, trash, catalogReady }: { guides: GuideCard[]; trash: GuideCard[]; catalogReady: boolean }) { const router = useRouter(); const [pending, startTransition] = useTransition(); function run(action: () => Promise<{ status: string; message?: string }>, success: string) { startTransition(async () => { const result = await action(); if (result.status === "error") toast.error(result.message); else { toast.success(success); router.refresh(); } }); } return (
แก้ไขล่าสุด {new Date(guide.updatedAt).toLocaleString("th-TH")}
Guide ที่ซ่อนไว้จากเว็บไซต์