feat: add estimated removal date (excl. renewal) in the timeline

This commit is contained in:
Maël Gangloff 2025-12-11 13:14:13 +01:00
parent 8a3ba9eb52
commit 6d5530d29c
No known key found for this signature in database
GPG Key ID: 11FDC81C24A7F629
3 changed files with 49 additions and 26 deletions

View File

@ -57,7 +57,8 @@ export function DomainResult({domain}: { domain: Domain }) {
title={t`Registry-level protection, ensuring the highest level of security by preventing unauthorized, unwanted, or accidental changes to the domain name at the registry level`} title={t`Registry-level protection, ensuring the highest level of security by preventing unauthorized, unwanted, or accidental changes to the domain name at the registry level`}
> >
<Tag <Tag
bordered={false} color={isDomainLocked(domain.status, 'server') ? 'green' : 'default'} bordered={false}
color={isDomainLocked(domain.status, 'server') ? 'green' : 'default'}
icon={<SafetyCertificateOutlined icon={<SafetyCertificateOutlined
style={{fontSize: '16px'}} style={{fontSize: '16px'}}
/>} />}
@ -68,7 +69,8 @@ export function DomainResult({domain}: { domain: Domain }) {
title={t`Registrar-level protection, safeguarding the domain from unauthorized, unwanted, or accidental changes through registrar controls`} title={t`Registrar-level protection, safeguarding the domain from unauthorized, unwanted, or accidental changes through registrar controls`}
> >
<Tag <Tag
bordered={false} color={isDomainLocked(domain.status, 'client') ? 'green' : 'default'} bordered={false}
color={isDomainLocked(domain.status, 'client') ? 'green' : 'default'}
icon={<BankOutlined icon={<BankOutlined
style={{fontSize: '16px'}} style={{fontSize: '16px'}}
/>} />}
@ -96,7 +98,10 @@ export function DomainResult({domain}: { domain: Domain }) {
{ {
domain.events.length > 0 && <> domain.events.length > 0 && <>
<Divider orientation='left'>{t`Timeline`}</Divider> <Divider orientation='left'>{t`Timeline`}</Divider>
<EventTimeline events={domainEvents} expiresInDays={domain.expiresInDays}/> <EventTimeline events={domainEvents}
expiresInDays={domain.expiresInDays}
isRenewalPeriod={domain.status.includes('auto renew period') || domain.status.includes('renew period')}
/>
</> </>
} }
{ {

View File

@ -7,16 +7,17 @@ import {actionToColor} from '../../utils/functions/actionToColor'
import {actionToIcon} from '../../utils/functions/actionToIcon' import {actionToIcon} from '../../utils/functions/actionToIcon'
import {ThunderboltOutlined} from "@ant-design/icons" import {ThunderboltOutlined} from "@ant-design/icons"
import {t} from "ttag" import {t} from "ttag"
import type {TimeLineItemProps} from "antd/lib/timeline/TimelineItem"
function getWhoisRemoveTimelineEvent(expiresInDays: number) { function getWhoisRemoveTimelineEvent(whoisRemoveDateEstimate: Date, withRenewalPeriod = false) {
const locale = navigator.language.split('-')[0] const locale = navigator.language.split('-')[0]
const sm = useBreakpoint('sm') const sm = useBreakpoint('sm')
const eventName = t`Estimated removal` const eventName = withRenewalPeriod ? t`Estimated removal (incl. renewal)` : t`Estimated removal (excl. renewal)`
const eventDetail = t`Estimated WHOIS removal date. This is the earliest date this record would be deleted, according to ICANN's standard lifecycle. Note that some registries have their own lifecycles.` const eventDetail = t`Estimated WHOIS removal date. This is the latest date this record would be deleted, according to ICANN's standard lifecycle. Note that some registries have their own lifecycles.`
const dateStr = const dateStr =
<Typography.Text> <Typography.Text>
{new Date(new Date().getTime() + expiresInDays * 24 * 60 * 60 * 1e3).toLocaleDateString(locale)} {whoisRemoveDateEstimate.toLocaleDateString(locale)}
</Typography.Text> </Typography.Text>
const text = sm const text = sm
@ -31,7 +32,7 @@ function getWhoisRemoveTimelineEvent(expiresInDays: number) {
} }
return { return {
color: 'yellow', color: withRenewalPeriod ? 'grey' : 'yellow',
dot: <ThunderboltOutlined style={{fontSize: '16px'}}/>, dot: <ThunderboltOutlined style={{fontSize: '16px'}}/>,
pending: true, pending: true,
...text ...text
@ -39,21 +40,34 @@ function getWhoisRemoveTimelineEvent(expiresInDays: number) {
} }
export function EventTimeline({events, expiresInDays}: { events: Event[], expiresInDays?: number }) { export function EventTimeline({events, expiresInDays, isRenewalPeriod}: {
events: Event[],
expiresInDays?: number,
isRenewalPeriod: boolean
}) {
const sm = useBreakpoint('sm') const sm = useBreakpoint('sm')
const sortedEvents = events.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
const locale = navigator.language.split('-')[0] const locale = navigator.language.split('-')[0]
const rdapEventNameTranslated = rdapEventNameTranslation() const rdapEventNameTranslated = rdapEventNameTranslation()
const rdapEventDetailTranslated = rdapEventDetailTranslation() const rdapEventDetailTranslated = rdapEventDetailTranslation()
const items: TimeLineItemProps[] = []
const items = []
if (expiresInDays !== undefined) { if (expiresInDays !== undefined) {
items.push(getWhoisRemoveTimelineEvent(expiresInDays)) const whoisRemoveDateEstimate = new Date(new Date().getTime() + expiresInDays * 24 * 60 * 60 * 1e3)
items.push(getWhoisRemoveTimelineEvent(whoisRemoveDateEstimate, true))
const expirationEvent = sortedEvents.find(e => !e.deleted && e.action === 'expiration')
const lastExpirationEvent = sortedEvents.find(e => e.deleted && e.action === 'expiration')
if (expirationEvent && lastExpirationEvent && isRenewalPeriod) {
const date = new Date(whoisRemoveDateEstimate.getTime() - (new Date(expirationEvent.date).getTime() - new Date(lastExpirationEvent.date).getTime()))
items.push(getWhoisRemoveTimelineEvent(date, false))
}
} }
items.push( items.push(
...events ...sortedEvents
.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
.map(e => { .map(e => {
const eventName = ( const eventName = (
<Typography.Text style={{color: e.deleted ? 'grey' : 'default'}}> <Typography.Text style={{color: e.deleted ? 'grey' : 'default'}}>

View File

@ -140,43 +140,43 @@ msgid ""
"at the registry level" "at the registry level"
msgstr "" msgstr ""
#: assets/components/search/DomainResult.tsx:64 #: assets/components/search/DomainResult.tsx:65
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:93 #: assets/components/tracking/watchlist/TrackedDomainTable.tsx:93
msgid "Registry Lock" msgid "Registry Lock"
msgstr "" msgstr ""
#: assets/components/search/DomainResult.tsx:68 #: assets/components/search/DomainResult.tsx:69
msgid "" msgid ""
"Registrar-level protection, safeguarding the domain from unauthorized, " "Registrar-level protection, safeguarding the domain from unauthorized, "
"unwanted, or accidental changes through registrar controls" "unwanted, or accidental changes through registrar controls"
msgstr "" msgstr ""
#: assets/components/search/DomainResult.tsx:75 #: assets/components/search/DomainResult.tsx:77
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:99 #: assets/components/tracking/watchlist/TrackedDomainTable.tsx:99
msgid "Registrar Lock" msgid "Registrar Lock"
msgstr "" msgstr ""
#: assets/components/search/DomainResult.tsx:79 #: assets/components/search/DomainResult.tsx:81
msgid "" msgid ""
"DNSSEC secures DNS by adding cryptographic signatures to DNS records, " "DNSSEC secures DNS by adding cryptographic signatures to DNS records, "
"ensuring authenticity and integrity of responses" "ensuring authenticity and integrity of responses"
msgstr "" msgstr ""
#: assets/components/search/DomainResult.tsx:84 #: assets/components/search/DomainResult.tsx:86
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:105 #: assets/components/tracking/watchlist/TrackedDomainTable.tsx:105
msgid "DNSSEC" msgid "DNSSEC"
msgstr "" msgstr ""
#: assets/components/search/DomainResult.tsx:90 #: assets/components/search/DomainResult.tsx:92
#: assets/components/tracking/watchlist/TrackedDomainTable.tsx:219 #: assets/components/tracking/watchlist/TrackedDomainTable.tsx:219
msgid "EPP Status Codes" msgid "EPP Status Codes"
msgstr "" msgstr ""
#: assets/components/search/DomainResult.tsx:98 #: assets/components/search/DomainResult.tsx:100
msgid "Timeline" msgid "Timeline"
msgstr "" msgstr ""
#: assets/components/search/DomainResult.tsx:105 #: assets/components/search/DomainResult.tsx:110
msgid "Entities" msgid "Entities"
msgstr "" msgstr ""
@ -185,15 +185,19 @@ msgstr ""
msgid "This domain name does not appear to be valid" msgid "This domain name does not appear to be valid"
msgstr "" msgstr ""
#: assets/components/search/EventTimeline.tsx:14 #: assets/components/search/EventTimeline.tsx:15
msgid "Estimated removal" msgid "Estimated removal (incl. renewal)"
msgstr "" msgstr ""
#: assets/components/search/EventTimeline.tsx:15 #: assets/components/search/EventTimeline.tsx:15
msgid "Estimated removal (excl. renewal)"
msgstr ""
#: assets/components/search/EventTimeline.tsx:16
msgid "" msgid ""
"Estimated WHOIS removal date. This is the earliest date this record would " "Estimated WHOIS removal date. This is the latest date this record would be "
"be deleted, according to ICANN's standard lifecycle. Note that some " "deleted, according to ICANN's standard lifecycle. Note that some registries "
"registries have their own lifecycles." "have their own lifecycles."
msgstr "" msgstr ""
#: assets/components/Sider.tsx:35 #: assets/components/Sider.tsx:35