import { useState } from "react"; import { useParams, useNavigate, Link } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { Trash2, Pencil } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Skeleton } from "@/components/ui/skeleton"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog"; import { useCardTransaction, useDeleteCardTransaction } from "@/features/cardTransactions/hooks/useCardTransactions"; import { BentoGrid, BentoCard, InfoRow } from "@/components/viewPageComponents"; // ─── Page ───────────────────────────────────────────────────────────────────── export default function CardTransactionViewPage() { const { t } = useTranslation(); const { id } = useParams<{ id: string }>(); const navigate = useNavigate(); const [deleteOpen, setDeleteOpen] = useState(false); const numericId = Number(id); const { data, isLoading } = useCardTransaction(numericId); const deleteMutation = useDeleteCardTransaction(); const handleDelete = async () => { await deleteMutation.mutateAsync(numericId); navigate("/card-transactions"); }; if (isLoading) { return (
{Array.from({ length: 7 }).map((_, i) => (
))}
); } if (!data) { return
{t("Not found", "Tapylmady")}
; } return (
{/* Header */}

{t("Card transaction detail", "Kart giňişleýin")}: {data.number}

{/* Detail cards */} {/* Delete dialog */} {t("Are you sure?", "Eminsiňizmi?")} {t( "This action cannot be undone. This will permanently delete the card.", "Bu amal yzyna gaýtarylmaz. Kart hemişelik öçüriler.", )} {t("Cancel", "Ýatyr")} {deleteMutation.isPending ? t("Deleting...", "Öçürilýär...") : t("Delete", "Öçür")}
); }