import React, {useState} from "react"; import { Avatar, Badge, Card, Divider, Empty, Flex, Form, FormProps, Input, List, message, Skeleton, Space, Tag, Timeline, Typography } from "antd"; import { BankOutlined, ClockCircleOutlined, DeleteOutlined, IdcardOutlined, ReloadOutlined, SearchOutlined, ShareAltOutlined, SignatureOutlined, SyncOutlined, ToolOutlined, UserOutlined } from "@ant-design/icons"; import {Domain, getDomain} from "../../utils/api"; import {AxiosError} from "axios" import vCard from 'vcf' type FieldType = { ldhName: string } export default function DomainSearchPage() { const [domain, setDomain] = useState() const [messageApi, contextHolder] = message.useMessage() const onFinish: FormProps['onFinish'] = (values) => { setDomain(null) getDomain(values.ldhName).then(d => { setDomain(d) messageApi.success('Found !') }).catch((e: AxiosError) => { const data = e?.response?.data as { detail: string } setDomain(undefined) messageApi.error(data.detail ?? 'An error occurred') }) } return {contextHolder}
name="ldhName" rules={[{ required: true, message: 'Required' }, { pattern: /^(?=.*\.)\S*[^.\s]$/, message: 'This domain name does not appear to be valid', max: 63, min: 2 }]} > } placeholder="example.com" autoFocus={true} autoComplete='off'/> { domain && (!domain.deleted ? {domain.status.length > 0 && <> EPP Status Codes { domain.status.map(s => {s} ) } } Timeline new Date(e2.date).getTime() - new Date(e1.date).getTime()) .map(({action, date}) => { let color, dot if (action === 'registration') { color = 'green' dot = } else if (action === 'expiration') { color = 'red' dot = } else if (action === 'transfer') { color = 'orange' dot = } else if (action === 'last changed') { color = 'blue' dot = } else if (action === 'deletion') { color = 'red' dot = } else if (action === 'reregistration') { color = 'green' dot = } return { label: new Date(date).toUTCString(), children: action, color, dot, pending: new Date(date).getTime() > new Date().getTime() } } ) } /> { domain.entities.length > 0 && <> Entities { const p = (r: string[]) => r.includes('registrant') ? 4 : r.includes('administrative') ? 3 : r.includes('billing') ? 2 : 1 return p(e2.roles) - p(e1.roles) })} renderItem={(e) => { const jCard = vCard.fromJSON(e.entity.jCard) let name = '' if (jCard.data.fn !== undefined && !Array.isArray(jCard.data.fn)) name = jCard.data.fn.valueOf() return : e.roles.includes('registrar') ? : e.roles.includes('technical') ? : e.roles.includes('administrative') ? : }/>} title={e.entity.handle} description={name} />
{e.roles.join(', ')}
}} /> }
: Although the domain exists in my database, it has been deleted from the WHOIS by its registrar. }/>) }
}