chore: reformat code

This commit is contained in:
Maël Gangloff
2024-07-31 12:37:43 +02:00
parent edefe53208
commit fc51f65f3b
7 changed files with 94 additions and 92 deletions

View File

@@ -210,12 +210,12 @@ export function WatchlistForm({form, connectors, onCreateWatchlist}: {
<Form.Item label={t`Connector`}
name='connector'
labelCol={{
xs: {span: 24},
sm: {span: 4},
xs: {span: 24},
sm: {span: 4},
}}
wrapperCol={{
md: {span: 12},
sm: {span: 20},
md: {span: 12},
sm: {span: 20},
}}
>
<Select showSearch

View File

@@ -1,16 +1,16 @@
import {Card, Divider, Popconfirm, Typography, theme} from "antd";
import {Card, Divider, Popconfirm, theme, Typography} from "antd";
import {t} from "ttag";
import {deleteWatchlist, EventAction} from "../../utils/api";
import {DeleteFilled} from "@ant-design/icons";
import React from "react";
const { useToken } = theme;
const {useToken} = theme;
type Watchlist = { token: string, domains: { ldhName: string }[], triggers?: { event: EventAction, action: string }[] }
export function WatchlistsList({watchlists, onDelete}: { watchlists: Watchlist[], onDelete: () => void }) {
const { token } = useToken()
const {token} = useToken()
return <>
{watchlists.map(watchlist =>
@@ -22,8 +22,8 @@ export function WatchlistsList({watchlists, onDelete}: { watchlists: Watchlist[]
okText={t`Yes`}
cancelText={t`No`}
okButtonProps={{danger: true}}
><DeleteFilled style={{color: token.colorError}} /></Popconfirm>}>
<Card.Meta description={watchlist.token} style={{marginBottom: '1em'}} />
><DeleteFilled style={{color: token.colorError}}/></Popconfirm>}>
<Card.Meta description={watchlist.token} style={{marginBottom: '1em'}}/>
<Typography.Paragraph>
{t`Domain name`} : {watchlist?.domains.map(d => d.ldhName).join(',')}
</Typography.Paragraph>

View File

@@ -1,19 +1,19 @@
import { Breakpoint, theme } from 'antd';
import { useMediaQuery } from 'react-responsive';
import {Breakpoint, theme} from 'antd';
import {useMediaQuery} from 'react-responsive';
const { useToken } = theme;
const {useToken} = theme;
type ScreenProperty = 'screenXXL' | 'screenXL' | 'screenLG' | 'screenMD' | 'screenSM' | 'screenXS';
const propertyName = (breakpoint: Breakpoint): ScreenProperty => {
return 'screen' + breakpoint.toUpperCase() as ScreenProperty
return 'screen' + breakpoint.toUpperCase() as ScreenProperty
};
export default function useBreakpoint(
breakpoint: Breakpoint
breakpoint: Breakpoint
) {
const { token } = useToken()
const width: number = token[propertyName(breakpoint)]
const {token} = useToken()
const width: number = token[propertyName(breakpoint)]
return useMediaQuery({maxWidth: width})
return useMediaQuery({maxWidth: width})
}

View File

@@ -4,7 +4,7 @@ import {getTldList, Tld} from "../../utils/api";
import {t} from 'ttag'
import {regionNames} from "../../i18n";
import useBreakpoint from "../../hooks/useBreakpoint";
import { ColumnType } from "antd/es/table";
import {ColumnType} from "antd/es/table";
const {Text, Paragraph} = Typography
@@ -43,7 +43,7 @@ function TldTable(filters: FiltersType) {
try {
countryName = regionNames.of(getCountryCode(tld.tld))
} catch(e) {
} catch (e) {
countryName = '-'
}

View File

@@ -7,7 +7,7 @@ import {DomainSearchBar, FieldType} from "../../components/search/DomainSearchBa
import {EventTimeline} from "../../components/search/EventTimeline";
import {EntitiesList} from "../../components/search/EntitiesList";
const { Text } = Typography;
const {Text} = Typography;
export default function DomainSearchPage() {
const [domain, setDomain] = useState<Domain | null>()
@@ -41,7 +41,8 @@ export default function DomainSearchPage() {
domain.tld.type === 'gTLD' ? "green"
: "cyan"
}>
<Card title={<>{domain.ldhName}{domain.handle ? <> (<Text code>{domain.handle}</Text>)</>: undefined}</>}
<Card title={<>{domain.ldhName}{domain.handle ? <> (<Text
code>{domain.handle}</Text>)</> : undefined}</>}
size="small">
{domain.status.length > 0 &&
<>

View File

@@ -1,5 +1,5 @@
import React, {useEffect, useState} from "react";
import {Card, Divider, Flex, Form, message, Skeleton} from "antd";
import {Card, Divider, Flex, Form, message} from "antd";
import {EventAction, getWatchlists, postWatchlist} from "../../utils/api";
import {AxiosError} from "axios";
import {t} from 'ttag'
@@ -64,10 +64,11 @@ export default function WatchlistPage() {
}
</Card>
<Divider />
<Divider/>
<Card size="small" loading={!watchlists} title={t`My Watchlists`} style={{width: '100%'}}>
{watchlists && watchlists.length > 0 && <WatchlistsList watchlists={watchlists} onDelete={refreshWatchlists}/>}
{watchlists && watchlists.length > 0 &&
<WatchlistsList watchlists={watchlists} onDelete={refreshWatchlists}/>}
</Card>
</Flex>
}