mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-17 17:55:42 +00:00
34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
import {Card, Divider, Popconfirm, theme, Typography} from "antd";
|
|
import {t} from "ttag";
|
|
import {DeleteFilled} from "@ant-design/icons";
|
|
import React from "react";
|
|
import {Connector, deleteConnector} from "../../../utils/api/connectors";
|
|
|
|
const {useToken} = theme;
|
|
|
|
|
|
export type ConnectorElement = Connector & { id: string, createdAt: string }
|
|
|
|
export function ConnectorsList({connectors, onDelete}: { connectors: ConnectorElement[], onDelete: () => void }) {
|
|
const {token} = useToken()
|
|
|
|
return <>
|
|
{connectors.map(connector =>
|
|
<>
|
|
<Card hoverable title={<Typography.Text
|
|
title={new Date(connector.createdAt).toLocaleString()}>{t`Connector ${connector.provider}`}</Typography.Text>}
|
|
size='small'
|
|
style={{width: '100%'}}
|
|
extra={<Popconfirm title={t`Delete the Connector`}
|
|
description={t`Are you sure to delete this Connector?`}
|
|
onConfirm={() => deleteConnector(connector.id).then(onDelete)}
|
|
okText={t`Yes`}
|
|
cancelText={t`No`}
|
|
><DeleteFilled style={{color: token.colorError}}/></Popconfirm>}>
|
|
<Card.Meta description={connector.id} style={{marginBottom: '1em'}}/>
|
|
</Card>
|
|
<Divider/>
|
|
</>
|
|
)}
|
|
</>
|
|
} |