diff --git a/src/components/DNSRecordTable.tsx b/src/components/DNSRecordTable.tsx index 37fa66c0..8c8f6bb4 100644 --- a/src/components/DNSRecordTable.tsx +++ b/src/components/DNSRecordTable.tsx @@ -5,6 +5,7 @@ import { useTranslations } from "next-intl"; import { Badge } from "@app/components/ui/badge"; import { DNSRecordsDataTable } from "./DNSRecordsDataTable"; import CopyToClipboard from "@app/components/CopyToClipboard"; +import { useEnvContext } from "@app/hooks/useEnvContext"; export type DNSRecordRow = { id: string; @@ -24,6 +25,30 @@ export default function DNSRecordsTable({ type }: Props) { const t = useTranslations(); + const env = useEnvContext(); + + const statusColumn: ColumnDef = { + 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" })} + + ); + } + }; const columns: ColumnDef[] = [ { @@ -81,28 +106,7 @@ export default function DNSRecordsTable({ ); } }, - { - 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" })} - - ); - } - } + ...(env.env.flags.usePangolinDns ? [statusColumn] : []) ]; return ( diff --git a/src/components/DomainInfoCard.tsx b/src/components/DomainInfoCard.tsx index b5de6cd3..e33998da 100644 --- a/src/components/DomainInfoCard.tsx +++ b/src/components/DomainInfoCard.tsx @@ -9,6 +9,7 @@ import { } from "@app/components/InfoSection"; import { useTranslations } from "next-intl"; import { Badge } from "./ui/badge"; +import { useEnvContext } from "@app/hooks/useEnvContext"; type DomainInfoCardProps = { failed: boolean; @@ -22,6 +23,7 @@ export default function DomainInfoCard({ type }: DomainInfoCardProps) { const t = useTranslations(); + const env = useEnvContext(); const getTypeDisplay = (type: string) => { switch (type) { @@ -46,32 +48,34 @@ export default function DomainInfoCard({ {getTypeDisplay(type ? type : "")} - - {t("status")} - - {failed ? ( - - {t("failed", { fallback: "Failed" })} - - ) : verified ? ( - type === "wildcard" ? ( - - {t("manual", { - fallback: "Manual" - })} + {env.env.flags.usePangolinDns && ( + + {t("status")} + + {failed ? ( + + {t("failed", { fallback: "Failed" })} + ) : verified ? ( + type === "wildcard" ? ( + + {t("manual", { + fallback: "Manual" + })} + + ) : ( + + {t("verified")} + + ) ) : ( - - {t("verified")} + + {t("pending", { fallback: "Pending" })} - ) - ) : ( - - {t("pending", { fallback: "Pending" })} - - )} - - + )} + + + )} diff --git a/src/components/DomainsTable.tsx b/src/components/DomainsTable.tsx index 3e12bab5..a099a8b8 100644 --- a/src/components/DomainsTable.tsx +++ b/src/components/DomainsTable.tsx @@ -55,7 +55,8 @@ export default function DomainsTable({ domains, orgId }: Props) { const [restartingDomains, setRestartingDomains] = useState>( new Set() ); - const api = createApiClient(useEnvContext()); + const env = useEnvContext(); + const api = createApiClient(env); const router = useRouter(); const t = useTranslations(); const { toast } = useToast(); @@ -134,6 +135,41 @@ export default function DomainsTable({ domains, orgId }: Props) { } }; + const statusColumn: ColumnDef = { + accessorKey: "verified", + header: ({ column }) => { + return ( + + ); + }, + cell: ({ row }) => { + const { verified, failed, type } = row.original; + if (verified) { + return type == "wildcard" ? ( + {t("manual")} + ) : ( + {t("verified")} + ); + } else if (failed) { + return ( + + {t("failed", { fallback: "Failed" })} + + ); + } else { + return {t("pending")}; + } + } + }; + const columns: ColumnDef[] = [ { accessorKey: "baseDomain", @@ -173,40 +209,7 @@ export default function DomainsTable({ domains, orgId }: Props) { ); } }, - { - accessorKey: "verified", - header: ({ column }) => { - return ( - - ); - }, - cell: ({ row }) => { - const { verified, failed, type } = row.original; - if (verified) { - return type == "wildcard" ? ( - {t("manual")} - ) : ( - {t("verified")} - ); - } else if (failed) { - return ( - - {t("failed", { fallback: "Failed" })} - - ); - } else { - return {t("pending")}; - } - } - }, + ...(env.env.flags.usePangolinDns ? [statusColumn] : []), { id: "actions", cell: ({ row }) => {