mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
Merge branch 'develop' into feat/openprovider-provider
This commit is contained in:
@@ -44,6 +44,13 @@ export async function patchWatchlist(token: string, watchlist: Partial<Watchlist
|
||||
return response.data
|
||||
}
|
||||
|
||||
export async function addDomainToWatchlist(watchlist: Watchlist, ldhName: string) {
|
||||
const domains = watchlist.domains.map(d => '/api/domains/' + d.ldhName)
|
||||
domains.push('/api/domains/' + ldhName)
|
||||
|
||||
return patchWatchlist(watchlist.token, {domains})
|
||||
}
|
||||
|
||||
export async function deleteWatchlist(token: string): Promise<void> {
|
||||
await request({
|
||||
method: 'DELETE',
|
||||
|
||||
@@ -6,32 +6,38 @@ import React from 'react'
|
||||
import type {Event} from "../api"
|
||||
import {t} from "ttag"
|
||||
|
||||
export function DomainToTag({domain}: { domain: { ldhName: string, deleted: boolean, status: string[], events?: Event[] } }) {
|
||||
return (
|
||||
<Link to={'/search/domain/' + domain.ldhName}>
|
||||
<Badge dot={domain.events?.find(e =>
|
||||
e.action === 'last changed' &&
|
||||
!e.deleted &&
|
||||
((new Date().getTime() - new Date(e.date).getTime()) < 7*24*60*60*1e3)
|
||||
) !== undefined} color='blue' title={t`The domain name was updated less than a week ago.`}>
|
||||
<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>
|
||||
</Badge>
|
||||
</Link>
|
||||
)
|
||||
export function DomainToTag({domain, link}: { domain: { ldhName: string, deleted: boolean, status: string[], events?: Event[] }, link?: boolean }) {
|
||||
const tag = <Badge dot={domain.events?.find(e =>
|
||||
e.action === 'last changed' &&
|
||||
!e.deleted &&
|
||||
((new Date().getTime() - new Date(e.date).getTime()) < 7*24*60*60*1e3)
|
||||
) !== undefined} color='blue' title={t`The domain name was updated less than a week ago.`}>
|
||||
<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>
|
||||
</Badge>
|
||||
|
||||
if (link ?? true) {
|
||||
return (
|
||||
<Link to={'/search/domain/' + domain.ldhName}>
|
||||
{tag}
|
||||
</Link>
|
||||
)
|
||||
} else {
|
||||
return tag
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ export function statusToTag(s: string) {
|
||||
<Tooltip
|
||||
placement='bottomLeft'
|
||||
title={rdapStatusCodeDetailTranslated[s as keyof typeof rdapStatusCodeDetailTranslated] || undefined}
|
||||
key={s}
|
||||
>
|
||||
<Tag color={eppStatusCodeToColor(s)}>{s}</Tag>
|
||||
</Tooltip>
|
||||
|
||||
Reference in New Issue
Block a user