import React, {useEffect, useState} from 'react' import {Card, Divider, Table, Typography} from 'antd' import type {IcannAccreditation} from '../../utils/api' import {t} from 'ttag' import type {ColumnType} from 'antd/es/table' import {CheckCircleOutlined, SettingOutlined, CloseCircleOutlined} from "@ant-design/icons" import {getIcannAccreditations} from "../../utils/api/icann-accreditations" const {Text, Paragraph} = Typography interface FiltersType { status: 'Accredited' | 'Reserved' | 'Terminated', } function RegistrarListTable(filters: FiltersType) { interface TableRow { key: number handle: number name: string } const [dataTable, setDataTable] = useState([]) const [total, setTotal] = useState(0) const fetchData = (params: FiltersType & { page: number, itemsPerPage: number }) => { getIcannAccreditations(params).then((data) => { setTotal(data['hydra:totalItems']) setDataTable(data['hydra:member'].map((accreditation: IcannAccreditation) => ({ key: accreditation.id, handle: accreditation.id, name: accreditation.registrarName }) ).sort((a, b) => a.handle - b.handle)) }) } useEffect(() => { fetchData({...filters, page: 1, itemsPerPage: 30}) }, []) const columns: Array> = [ { title: t`ID`, dataIndex: 'handle', width: '10vh', align: 'center' }, { title: t`Registrar`, dataIndex: 'name' } ] return ( { fetchData({...filters, page, itemsPerPage}) } }} scroll={{y: '50vh'}} /> ) } export default function IcannRegistrarPage() { const [activeTabKey, setActiveTabKey] = useState('Accredited') const contentList: Record = { Accredited: <> {t`An accredited number means that ICANN's contract with the registrar is ongoing.`} , Reserved: <> {t`A reserved number can be used by TLD registries for specific operations.`} , Terminated: <> {t`A terminated number means that ICANN's contract with the registrar has been terminated.`} } return ( <> {t`This page lists ICANN-accredited registrars.`} {t`The list is officially published and maintained by the Internet Assigned Numbers Authority (IANA), the organization responsible for managing the Internet's unique identifiers (including numbers, IP addresses, and domain name extensions).`} }, { key: 'Reserved', label: t`Reserved`, icon: }, { key: 'Terminated', label: t`Terminated`, icon: } ]} activeTabKey={activeTabKey} key={activeTabKey} onTabChange={(k: string) => setActiveTabKey(k)} > {contentList[activeTabKey]} ) }