mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: translate domain events in watchlistsList
This commit is contained in:
@@ -21,31 +21,33 @@ export function actionToColor(a: EventAction) {
|
||||
a === 'last changed' ? 'blue' : 'default'
|
||||
}
|
||||
|
||||
export const domainEvent = () => ({
|
||||
registration: t`Registration`,
|
||||
reregistration: t`Reregistration`,
|
||||
'last changed': t`Last changed`,
|
||||
expiration: t`Expiration`,
|
||||
deletion: t`Deletion`,
|
||||
reinstantiation: t`Reinstantiation`,
|
||||
transfer: t`Transfer`,
|
||||
locked: t`Locked`,
|
||||
unlocked: t`Unlocked`,
|
||||
'registrar expiration': t`Registrar expiration`,
|
||||
'enum validation expiration': t`ENUM validation expiration`
|
||||
})
|
||||
|
||||
export function EventTimeline({domain}: { domain: Domain }) {
|
||||
const sm = useBreakpoint('sm')
|
||||
|
||||
const domainEvent = {
|
||||
registration: t`Registration`,
|
||||
reregistration: t`Reregistration`,
|
||||
'last changed': t`Last changed`,
|
||||
expiration: t`Expiration`,
|
||||
deletion: t`Deletion`,
|
||||
reinstantiation: t`Reinstantiation`,
|
||||
transfer: t`Transfer`,
|
||||
locked: t`Locked`,
|
||||
unlocked: t`Unlocked`,
|
||||
'registrar expiration': t`Registrar expiration`,
|
||||
'enum validation expiration': t`ENUM validation expiration`
|
||||
}
|
||||
|
||||
|
||||
const locale = navigator.language.split('-')[0]
|
||||
const domainEventTranslated = domainEvent()
|
||||
|
||||
return <Timeline
|
||||
mode={sm ? "left" : "right"}
|
||||
items={domain.events
|
||||
.sort((e1, e2) => new Date(e2.date).getTime() - new Date(e1.date).getTime())
|
||||
.map(({action, date}) => {
|
||||
|
||||
let dot
|
||||
if (action === 'registration') {
|
||||
dot = <SignatureOutlined style={{fontSize: '16px'}}/>
|
||||
@@ -61,7 +63,7 @@ export function EventTimeline({domain}: { domain: Domain }) {
|
||||
dot = <ReloadOutlined style={{fontSize: '16px'}}/>
|
||||
}
|
||||
|
||||
const eventName = Object.keys(domainEvent).includes(action) ? domainEvent[action as keyof typeof domainEvent] : action
|
||||
const eventName = Object.keys(domainEventTranslated).includes(action) ? domainEventTranslated[action as keyof typeof domainEventTranslated] : action
|
||||
const dateStr = new Date(date).toLocaleString(locale)
|
||||
|
||||
const text = sm ? {
|
||||
|
||||
Reference in New Issue
Block a user