mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: gray out old expiration events no longer relevant
This commit is contained in:
@@ -24,7 +24,7 @@ export function actionToColor(a: EventAction) {
|
|||||||
export const domainEvent = () => ({
|
export const domainEvent = () => ({
|
||||||
registration: t`Registration`,
|
registration: t`Registration`,
|
||||||
reregistration: t`Reregistration`,
|
reregistration: t`Reregistration`,
|
||||||
'last changed': t`Last changed`,
|
'last changed': t`Changed`,
|
||||||
expiration: t`Expiration`,
|
expiration: t`Expiration`,
|
||||||
deletion: t`Deletion`,
|
deletion: t`Deletion`,
|
||||||
reinstantiation: t`Reinstantiation`,
|
reinstantiation: t`Reinstantiation`,
|
||||||
@@ -38,48 +38,48 @@ export const domainEvent = () => ({
|
|||||||
export function EventTimeline({domain}: { domain: Domain }) {
|
export function EventTimeline({domain}: { domain: Domain }) {
|
||||||
const sm = useBreakpoint('sm')
|
const sm = useBreakpoint('sm')
|
||||||
|
|
||||||
|
|
||||||
const locale = navigator.language.split('-')[0]
|
const locale = navigator.language.split('-')[0]
|
||||||
const domainEventTranslated = domainEvent()
|
const domainEventTranslated = domainEvent()
|
||||||
|
|
||||||
|
const domainEvents = domain.events.sort((e1, e2) => new Date(e2.date).getTime() - new Date(e1.date).getTime())
|
||||||
|
const expirationEvents = domainEvents.filter(e => e.action === 'expiration')
|
||||||
|
|
||||||
return <Timeline
|
return <Timeline
|
||||||
mode={sm ? "left" : "right"}
|
mode={sm ? "left" : "right"}
|
||||||
items={domain.events
|
items={domainEvents.map(({action, date}) => {
|
||||||
.sort((e1, e2) => new Date(e2.date).getTime() - new Date(e1.date).getTime())
|
let dot
|
||||||
.map(({action, date}) => {
|
if (action === 'registration') {
|
||||||
let dot
|
dot = <SignatureOutlined style={{fontSize: '16px'}}/>
|
||||||
if (action === 'registration') {
|
} else if (action === 'expiration') {
|
||||||
dot = <SignatureOutlined style={{fontSize: '16px'}}/>
|
dot = <ClockCircleOutlined style={{fontSize: '16px'}}/>
|
||||||
} else if (action === 'expiration') {
|
} else if (action === 'transfer') {
|
||||||
dot = <ClockCircleOutlined style={{fontSize: '16px'}}/>
|
dot = <ShareAltOutlined style={{fontSize: '16px'}}/>
|
||||||
} else if (action === 'transfer') {
|
} else if (action === 'last changed') {
|
||||||
dot = <ShareAltOutlined style={{fontSize: '16px'}}/>
|
dot = <SyncOutlined style={{fontSize: '16px'}}/>
|
||||||
} else if (action === 'last changed') {
|
} else if (action === 'deletion') {
|
||||||
dot = <SyncOutlined style={{fontSize: '16px'}}/>
|
dot = <DeleteOutlined style={{fontSize: '16px'}}/>
|
||||||
} else if (action === 'deletion') {
|
} else if (action === 'reregistration') {
|
||||||
dot = <DeleteOutlined style={{fontSize: '16px'}}/>
|
dot = <ReloadOutlined style={{fontSize: '16px'}}/>
|
||||||
} else if (action === 'reregistration') {
|
|
||||||
dot = <ReloadOutlined style={{fontSize: '16px'}}/>
|
|
||||||
}
|
|
||||||
|
|
||||||
const eventName = Object.keys(domainEventTranslated).includes(action) ? domainEventTranslated[action as keyof typeof domainEventTranslated] : action
|
|
||||||
const dateStr = new Date(date).toLocaleString(locale)
|
|
||||||
|
|
||||||
const text = sm ? {
|
|
||||||
children: <>{eventName} {dateStr}</>
|
|
||||||
} : {
|
|
||||||
label: dateStr,
|
|
||||||
children: eventName,
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
color: actionToColor(action),
|
|
||||||
dot,
|
|
||||||
pending: new Date(date).getTime() > new Date().getTime(),
|
|
||||||
...text
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
const eventName = Object.keys(domainEventTranslated).includes(action) ? domainEventTranslated[action as keyof typeof domainEventTranslated] : action
|
||||||
|
const dateStr = new Date(date).toLocaleString(locale)
|
||||||
|
|
||||||
|
const text = sm ? {
|
||||||
|
children: <>{eventName} {dateStr}</>
|
||||||
|
} : {
|
||||||
|
label: dateStr,
|
||||||
|
children: eventName,
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
color: (action === 'expiration' ? (expirationEvents.length > 0 && domainEvents[0].date === date) : true) ? actionToColor(action) : 'grey',
|
||||||
|
dot,
|
||||||
|
pending: new Date(date).getTime() > new Date().getTime(),
|
||||||
|
...text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ msgid "Reregistration"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/search/EventTimeline.tsx:27
|
#: assets/components/search/EventTimeline.tsx:27
|
||||||
msgid "Last changed"
|
msgid "Changed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/search/EventTimeline.tsx:28
|
#: assets/components/search/EventTimeline.tsx:28
|
||||||
|
|||||||
Reference in New Issue
Block a user