mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-17 17:55:42 +00:00
feat: translate domain events in watchlistsList
This commit is contained in:
parent
ee47f9aac6
commit
9afaf11476
@ -21,31 +21,33 @@ export function actionToColor(a: EventAction) {
|
|||||||
a === 'last changed' ? 'blue' : 'default'
|
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 }) {
|
export function EventTimeline({domain}: { domain: Domain }) {
|
||||||
const sm = useBreakpoint('sm')
|
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 locale = navigator.language.split('-')[0]
|
||||||
|
const domainEventTranslated = domainEvent()
|
||||||
|
|
||||||
return <Timeline
|
return <Timeline
|
||||||
mode={sm ? "left" : "right"}
|
mode={sm ? "left" : "right"}
|
||||||
items={domain.events
|
items={domain.events
|
||||||
.sort((e1, e2) => new Date(e2.date).getTime() - new Date(e1.date).getTime())
|
.sort((e1, e2) => new Date(e2.date).getTime() - new Date(e1.date).getTime())
|
||||||
.map(({action, date}) => {
|
.map(({action, date}) => {
|
||||||
|
|
||||||
let dot
|
let dot
|
||||||
if (action === 'registration') {
|
if (action === 'registration') {
|
||||||
dot = <SignatureOutlined style={{fontSize: '16px'}}/>
|
dot = <SignatureOutlined style={{fontSize: '16px'}}/>
|
||||||
@ -61,7 +63,7 @@ export function EventTimeline({domain}: { domain: Domain }) {
|
|||||||
dot = <ReloadOutlined style={{fontSize: '16px'}}/>
|
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 dateStr = new Date(date).toLocaleString(locale)
|
||||||
|
|
||||||
const text = sm ? {
|
const text = sm ? {
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import {deleteWatchlist} from "../../utils/api";
|
|||||||
import {DeleteFilled} from "@ant-design/icons";
|
import {DeleteFilled} from "@ant-design/icons";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import useBreakpoint from "../../hooks/useBreakpoint";
|
import useBreakpoint from "../../hooks/useBreakpoint";
|
||||||
import {actionToColor} from "../search/EventTimeline";
|
import {actionToColor, domainEvent} from "../search/EventTimeline";
|
||||||
import {Watchlist} from "../../pages/tracking/WatchlistPage";
|
import {Watchlist} from "../../pages/tracking/WatchlistPage";
|
||||||
|
|
||||||
const {useToken} = theme;
|
const {useToken} = theme;
|
||||||
@ -14,6 +14,8 @@ export function WatchlistsList({watchlists, onDelete}: { watchlists: Watchlist[]
|
|||||||
const {token} = useToken()
|
const {token} = useToken()
|
||||||
const sm = useBreakpoint('sm')
|
const sm = useBreakpoint('sm')
|
||||||
|
|
||||||
|
const domainEventTranslated = domainEvent()
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: t`Domain names`,
|
title: t`Domain names`,
|
||||||
@ -49,7 +51,10 @@ export function WatchlistsList({watchlists, onDelete}: { watchlists: Watchlist[]
|
|||||||
dataSource={[{
|
dataSource={[{
|
||||||
domains: watchlist.domains.map(d => <Tag>{d.ldhName}</Tag>),
|
domains: watchlist.domains.map(d => <Tag>{d.ldhName}</Tag>),
|
||||||
events: watchlist.triggers?.filter(t => t.action === 'email')
|
events: watchlist.triggers?.filter(t => t.action === 'email')
|
||||||
.map(t => <Tag color={actionToColor(t.event)}>{t.event}</Tag>)
|
.map(t => <Tag color={actionToColor(t.event)}>
|
||||||
|
{domainEventTranslated[t.event as keyof typeof domainEventTranslated]}
|
||||||
|
</Tag>
|
||||||
|
)
|
||||||
}]}
|
}]}
|
||||||
{...(sm ? {scroll: {y: 'max-content'}} : {scroll: {y: 240}})}
|
{...(sm ? {scroll: {y: 'max-content'}} : {scroll: {y: 240}})}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -3,47 +3,47 @@ msgstr ""
|
|||||||
"Content-Type: text/plain; charset=utf-8\n"
|
"Content-Type: text/plain; charset=utf-8\n"
|
||||||
"Plural-Forms: nplurals=2; plural=(n!=1);\n"
|
"Plural-Forms: nplurals=2; plural=(n!=1);\n"
|
||||||
|
|
||||||
#: assets/components/search/EventTimeline.tsx:28
|
#: assets/components/search/EventTimeline.tsx:25
|
||||||
msgid "Registration"
|
msgid "Registration"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/search/EventTimeline.tsx:29
|
#: assets/components/search/EventTimeline.tsx:26
|
||||||
msgid "Reregistration"
|
msgid "Reregistration"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/search/EventTimeline.tsx:30
|
#: assets/components/search/EventTimeline.tsx:27
|
||||||
msgid "Last changed"
|
msgid "Last changed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/search/EventTimeline.tsx:31
|
#: assets/components/search/EventTimeline.tsx:28
|
||||||
msgid "Expiration"
|
msgid "Expiration"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/search/EventTimeline.tsx:32
|
#: assets/components/search/EventTimeline.tsx:29
|
||||||
msgid "Deletion"
|
msgid "Deletion"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/search/EventTimeline.tsx:33
|
#: assets/components/search/EventTimeline.tsx:30
|
||||||
msgid "Reinstantiation"
|
msgid "Reinstantiation"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/search/EventTimeline.tsx:34
|
#: assets/components/search/EventTimeline.tsx:31
|
||||||
msgid "Transfer"
|
msgid "Transfer"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/search/EventTimeline.tsx:35
|
#: assets/components/search/EventTimeline.tsx:32
|
||||||
msgid "Locked"
|
msgid "Locked"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/search/EventTimeline.tsx:36
|
#: assets/components/search/EventTimeline.tsx:33
|
||||||
msgid "Unlocked"
|
msgid "Unlocked"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/search/EventTimeline.tsx:37
|
#: assets/components/search/EventTimeline.tsx:34
|
||||||
msgid "Registrar expiration"
|
msgid "Registrar expiration"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/search/EventTimeline.tsx:38
|
#: assets/components/search/EventTimeline.tsx:35
|
||||||
msgid "ENUM validation expiration"
|
msgid "ENUM validation expiration"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ msgid "At least one domain name"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/tracking/WatchlistForm.tsx:101
|
#: assets/components/tracking/WatchlistForm.tsx:101
|
||||||
#: assets/components/tracking/WatchlistsList.tsx:19
|
#: assets/components/tracking/WatchlistsList.tsx:21
|
||||||
msgid "Domain names"
|
msgid "Domain names"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -257,29 +257,29 @@ msgid ""
|
|||||||
"names via the Provider's API"
|
"names via the Provider's API"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/tracking/WatchlistsList.tsx:23
|
#: assets/components/tracking/WatchlistsList.tsx:25
|
||||||
msgid "Tracked events"
|
msgid "Tracked events"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/tracking/WatchlistsList.tsx:32
|
#: assets/components/tracking/WatchlistsList.tsx:34
|
||||||
msgid "Watchlist"
|
msgid "Watchlist"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/tracking/WatchlistsList.tsx:35
|
#: assets/components/tracking/WatchlistsList.tsx:37
|
||||||
msgid "Delete the Watchlist"
|
msgid "Delete the Watchlist"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/tracking/WatchlistsList.tsx:36
|
#: assets/components/tracking/WatchlistsList.tsx:38
|
||||||
msgid "Are you sure to delete this Watchlist?"
|
msgid "Are you sure to delete this Watchlist?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/tracking/ConnectorsList.tsx:33
|
#: assets/components/tracking/ConnectorsList.tsx:33
|
||||||
#: assets/components/tracking/WatchlistsList.tsx:38
|
#: assets/components/tracking/WatchlistsList.tsx:40
|
||||||
msgid "Yes"
|
msgid "Yes"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: assets/components/tracking/ConnectorsList.tsx:34
|
#: assets/components/tracking/ConnectorsList.tsx:34
|
||||||
#: assets/components/tracking/WatchlistsList.tsx:39
|
#: assets/components/tracking/WatchlistsList.tsx:41
|
||||||
msgid "No"
|
msgid "No"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user