"use client"; import { ColumnDef } from "@tanstack/react-table"; import { useTranslations } from "next-intl"; import { Badge } from "@app/components/ui/badge"; import { DNSRecordsDataTable } from "./DNSRecordsDataTable"; export type DNSRecordRow = { id: string; domainId: string; recordType: string; // "NS" | "CNAME" | "A" | "TXT" baseDomain: string | null; value: string; verified?: boolean; }; type Props = { records: DNSRecordRow[]; domainId: string; isRefreshing?: boolean; type: string | null; }; export default function DNSRecordsTable({ records, domainId, isRefreshing, type }: Props) { const t = useTranslations(); const columns: ColumnDef[] = [ { accessorKey: "baseDomain", header: ({ column }) => { return (
{t("recordName", { fallback: "Record name" })}
); }, cell: ({ row }) => { const baseDomain = row.original.baseDomain; return
{baseDomain || "-"}
; } }, { accessorKey: "recordType", header: ({ column }) => { return
{t("type")}
; }, cell: ({ row }) => { const type = row.original.recordType; return
{type}
; } }, { accessorKey: "ttl", header: ({ column }) => { return
{t("TTL")}
; }, cell: ({ row }) => { return
{t("auto")}
; } }, { accessorKey: "value", header: () => { return
{t("value")}
; }, cell: ({ row }) => { const value = row.original.value; return
{value}
; } }, { accessorKey: "verified", header: ({ column }) => { return
{t("status")}
; }, cell: ({ row }) => { const verified = row.original.verified; return verified ? ( type === "wildcard" ? ( {t("manual", { fallback: "Manual" })} ) : ( {t("verified")} ) ) : ( {t("pending", { fallback: "Pending" })} ); } } ]; return ( ); }