mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: add options column on Domain table
This commit is contained in:
29
assets/utils/functions/DomainToTag.tsx
Normal file
29
assets/utils/functions/DomainToTag.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import {Tag} from 'antd'
|
||||
import {DeleteOutlined, ExclamationCircleOutlined} from '@ant-design/icons'
|
||||
import punycode from 'punycode/punycode'
|
||||
import {Link} from 'react-router-dom'
|
||||
import React from 'react'
|
||||
|
||||
export function DomainToTag({domain}: { domain: { ldhName: string, deleted: boolean, status: string[] } }) {
|
||||
return (
|
||||
<Link to={'/search/domain/' + domain.ldhName}>
|
||||
<Tag
|
||||
color={
|
||||
domain.deleted
|
||||
? 'magenta'
|
||||
: domain.status.includes('redemption period')
|
||||
? 'yellow'
|
||||
: domain.status.includes('pending delete') ? 'volcano' : 'default'
|
||||
}
|
||||
icon={
|
||||
domain.deleted
|
||||
? <DeleteOutlined/>
|
||||
: domain.status.includes('redemption period')
|
||||
? <ExclamationCircleOutlined/>
|
||||
: domain.status.includes('pending delete') ? <DeleteOutlined/> : null
|
||||
}
|
||||
>{punycode.toUnicode(domain.ldhName)}
|
||||
</Tag>
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
17
assets/utils/functions/StatusToTag.tsx
Normal file
17
assets/utils/functions/StatusToTag.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import {Tag, Tooltip} from 'antd'
|
||||
import {eppStatusCodeToColor} from './eppStatusCodeToColor'
|
||||
import React from 'react'
|
||||
import {rdapStatusCodeDetailTranslation} from './rdapTranslation'
|
||||
|
||||
export function statusToTag(s: string) {
|
||||
const rdapStatusCodeDetailTranslated = rdapStatusCodeDetailTranslation()
|
||||
|
||||
return (
|
||||
<Tooltip
|
||||
placement='bottomLeft'
|
||||
title={rdapStatusCodeDetailTranslated[s as keyof typeof rdapStatusCodeDetailTranslated] || undefined}
|
||||
>
|
||||
<Tag color={eppStatusCodeToColor(s)}>{s}</Tag>
|
||||
</Tooltip>
|
||||
)
|
||||
}
|
||||
3
assets/utils/functions/isDomainLocked.ts
Normal file
3
assets/utils/functions/isDomainLocked.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export const isDomainLocked = (status: string[], type: 'client' | 'server'): boolean =>
|
||||
(status.includes(type + ' update prohibited') && status.includes(type + ' delete prohibited')) ||
|
||||
status.includes(type + ' transfer prohibited')
|
||||
Reference in New Issue
Block a user