mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: add eslint linter
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import {Timeline, Tooltip, Typography} from "antd";
|
||||
import React from "react";
|
||||
import {Event} from "../../utils/api";
|
||||
import useBreakpoint from "../../hooks/useBreakpoint";
|
||||
import {rdapEventDetailTranslation, rdapEventNameTranslation} from "../../utils/functions/rdapTranslation";
|
||||
import {actionToColor} from "../../utils/functions/actionToColor";
|
||||
import {actionToIcon} from "../../utils/functions/actionToIcon";
|
||||
import {Timeline, Tooltip, Typography} from 'antd'
|
||||
import React from 'react'
|
||||
import {Event} from '../../utils/api'
|
||||
import useBreakpoint from '../../hooks/useBreakpoint'
|
||||
import {rdapEventDetailTranslation, rdapEventNameTranslation} from '../../utils/functions/rdapTranslation'
|
||||
import {actionToColor} from '../../utils/functions/actionToColor'
|
||||
import {actionToIcon} from '../../utils/functions/actionToIcon'
|
||||
|
||||
export function EventTimeline({events}: { events: Event[] }) {
|
||||
const sm = useBreakpoint('sm')
|
||||
@@ -13,38 +13,46 @@ export function EventTimeline({events}: { events: Event[] }) {
|
||||
const rdapEventNameTranslated = rdapEventNameTranslation()
|
||||
const rdapEventDetailTranslated = rdapEventDetailTranslation()
|
||||
|
||||
return <>
|
||||
<Timeline
|
||||
mode={sm ? "left" : "right"}
|
||||
items={events.map(e => {
|
||||
const eventName = <Typography.Text style={{color: e.deleted ? 'grey' : 'default'}}>
|
||||
{rdapEventNameTranslated[e.action as keyof typeof rdapEventNameTranslated] || e.action}
|
||||
</Typography.Text>
|
||||
return (
|
||||
<>
|
||||
<Timeline
|
||||
mode={sm ? 'left' : 'right'}
|
||||
items={events.map(e => {
|
||||
const eventName = (
|
||||
<Typography.Text style={{color: e.deleted ? 'grey' : 'default'}}>
|
||||
{rdapEventNameTranslated[e.action as keyof typeof rdapEventNameTranslated] || e.action}
|
||||
</Typography.Text>
|
||||
)
|
||||
|
||||
const dateStr = <Typography.Text
|
||||
style={{color: e.deleted ? 'grey' : 'default'}}>{new Date(e.date).toLocaleString(locale)}
|
||||
</Typography.Text>
|
||||
const dateStr = (
|
||||
<Typography.Text
|
||||
style={{color: e.deleted ? 'grey' : 'default'}}
|
||||
>{new Date(e.date).toLocaleString(locale)}
|
||||
</Typography.Text>
|
||||
)
|
||||
|
||||
const eventDetail = rdapEventDetailTranslated[e.action as keyof typeof rdapEventDetailTranslated] || undefined
|
||||
const eventDetail = rdapEventDetailTranslated[e.action as keyof typeof rdapEventDetailTranslated] || undefined
|
||||
|
||||
const text = sm ? {
|
||||
children: <Tooltip placement='bottom' title={eventDetail}>
|
||||
{eventName} {dateStr}
|
||||
</Tooltip>
|
||||
} : {
|
||||
label: dateStr,
|
||||
children: <Tooltip placement='left' title={eventDetail}>{eventName}</Tooltip>,
|
||||
const text = sm
|
||||
? {
|
||||
children: <Tooltip placement='bottom' title={eventDetail}>
|
||||
{eventName} {dateStr}
|
||||
</Tooltip>
|
||||
}
|
||||
: {
|
||||
label: dateStr,
|
||||
children: <Tooltip placement='left' title={eventDetail}>{eventName}</Tooltip>
|
||||
}
|
||||
|
||||
return {
|
||||
color: e.deleted ? 'grey' : actionToColor(e.action),
|
||||
dot: actionToIcon(e.action),
|
||||
pending: new Date(e.date).getTime() > new Date().getTime(),
|
||||
...text
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
color: e.deleted ? 'grey' : actionToColor(e.action),
|
||||
dot: actionToIcon(e.action),
|
||||
pending: new Date(e.date).getTime() > new Date().getTime(),
|
||||
...text
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
)}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user