import React, {useEffect, useState} from 'react'; import Container from "@mui/material/Container"; import {Accordion, AccordionDetails, AccordionSummary, Grid, Typography} from "@mui/material"; import {ExpandMore} from "@mui/icons-material"; import HeadTable from "../components/HeadTable"; import {getTldList} from "../utils/api"; import Footer from "../components/Footer"; const gTldColumns = [ {id: 'tld', label: 'TLD'}, {id: 'registryOperator', label: 'Operator'} ] const sTldColumns = [ {id: 'tld', label: 'TLD'} ] const toEmoji = (tld: string) => String.fromCodePoint( ...getCountryCode(tld) .toUpperCase() .split('') .map((char) => 127397 + char.charCodeAt(0) ) ) const getCountryCode = (tld: string): string => { const exceptions = {uk: 'gb', su: 'ru', tp: 'tl'} if (tld in exceptions) return exceptions[tld as keyof typeof exceptions] return tld } const regionNames = new Intl.DisplayNames(['en'], {type: 'region'}) const ccTldColumns = [ {id: 'tld', label: 'TLD'}, { id: 'tld', label: 'Flag', format: (tld: string) => toEmoji(tld) }, {id: 'tld', label: 'Country name', format: (tld: string) => regionNames.of(getCountryCode(tld)) ?? '-'}, ] export default function TldPage() { const [sTld, setSTld] = useState([]) const [gTld, setGTld] = useState([]) const [ccTld, setCcTld] = useState([]) const [brandGTld, setBrandGTld] = useState([]) useEffect(() => { getTldList({type: 'sTLD'}).then(setSTld) getTldList({type: 'gTLD', contractTerminated: 0, specification13: 0}).then(setGTld) getTldList({type: 'gTLD', contractTerminated: 0, specification13: 1}).then(setBrandGTld) getTldList({type: 'ccTLD'}).then(setCcTld) }, []) return ( }> sTLD Sponsored Top-Level Domains }> gTLD Generic Top-Level Domains }> Brand gTLD Brand Generic Top-Level Domains }> ccTLD Country-Code Top-Level Domains