diff --git a/assets/components/search/DomainResult.tsx b/assets/components/search/DomainResult.tsx index 2f98c58..cd4ed7c 100644 --- a/assets/components/search/DomainResult.tsx +++ b/assets/components/search/DomainResult.tsx @@ -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`} > } @@ -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`} > } @@ -96,7 +98,10 @@ export function DomainResult({domain}: { domain: Domain }) { { domain.events.length > 0 && <> {t`Timeline`} - + } { diff --git a/assets/components/search/EventTimeline.tsx b/assets/components/search/EventTimeline.tsx index 536d059..6d325f9 100644 --- a/assets/components/search/EventTimeline.tsx +++ b/assets/components/search/EventTimeline.tsx @@ -7,16 +7,17 @@ import {actionToColor} from '../../utils/functions/actionToColor' import {actionToIcon} from '../../utils/functions/actionToIcon' import {ThunderboltOutlined} from "@ant-design/icons" 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 sm = useBreakpoint('sm') - const eventName = t`Estimated removal` - 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 eventName = withRenewalPeriod ? t`Estimated removal (incl. renewal)` : t`Estimated removal (excl. renewal)` + 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 = - {new Date(new Date().getTime() + expiresInDays * 24 * 60 * 60 * 1e3).toLocaleDateString(locale)} + {whoisRemoveDateEstimate.toLocaleDateString(locale)} const text = sm @@ -31,7 +32,7 @@ function getWhoisRemoveTimelineEvent(expiresInDays: number) { } return { - color: 'yellow', + color: withRenewalPeriod ? 'grey' : 'yellow', dot: , pending: true, ...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 sortedEvents = events.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()) const locale = navigator.language.split('-')[0] const rdapEventNameTranslated = rdapEventNameTranslation() const rdapEventDetailTranslated = rdapEventDetailTranslation() + const items: TimeLineItemProps[] = [] - const items = [] 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( - ...events - .sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()) + ...sortedEvents .map(e => { const eventName = ( diff --git a/translations/translations.pot b/translations/translations.pot index 81744e2..0f6ca8b 100644 --- a/translations/translations.pot +++ b/translations/translations.pot @@ -140,43 +140,43 @@ msgid "" "at the registry level" msgstr "" -#: assets/components/search/DomainResult.tsx:64 +#: assets/components/search/DomainResult.tsx:65 #: assets/components/tracking/watchlist/TrackedDomainTable.tsx:93 msgid "Registry Lock" msgstr "" -#: assets/components/search/DomainResult.tsx:68 +#: assets/components/search/DomainResult.tsx:69 msgid "" "Registrar-level protection, safeguarding the domain from unauthorized, " "unwanted, or accidental changes through registrar controls" msgstr "" -#: assets/components/search/DomainResult.tsx:75 +#: assets/components/search/DomainResult.tsx:77 #: assets/components/tracking/watchlist/TrackedDomainTable.tsx:99 msgid "Registrar Lock" msgstr "" -#: assets/components/search/DomainResult.tsx:79 +#: assets/components/search/DomainResult.tsx:81 msgid "" "DNSSEC secures DNS by adding cryptographic signatures to DNS records, " "ensuring authenticity and integrity of responses" msgstr "" -#: assets/components/search/DomainResult.tsx:84 +#: assets/components/search/DomainResult.tsx:86 #: assets/components/tracking/watchlist/TrackedDomainTable.tsx:105 msgid "DNSSEC" msgstr "" -#: assets/components/search/DomainResult.tsx:90 +#: assets/components/search/DomainResult.tsx:92 #: assets/components/tracking/watchlist/TrackedDomainTable.tsx:219 msgid "EPP Status Codes" msgstr "" -#: assets/components/search/DomainResult.tsx:98 +#: assets/components/search/DomainResult.tsx:100 msgid "Timeline" msgstr "" -#: assets/components/search/DomainResult.tsx:105 +#: assets/components/search/DomainResult.tsx:110 msgid "Entities" msgstr "" @@ -185,15 +185,19 @@ msgstr "" msgid "This domain name does not appear to be valid" msgstr "" -#: assets/components/search/EventTimeline.tsx:14 -msgid "Estimated removal" +#: assets/components/search/EventTimeline.tsx:15 +msgid "Estimated removal (incl. renewal)" msgstr "" #: assets/components/search/EventTimeline.tsx:15 +msgid "Estimated removal (excl. renewal)" +msgstr "" + +#: assets/components/search/EventTimeline.tsx:16 msgid "" -"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." +"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." msgstr "" #: assets/components/Sider.tsx:35