2024-12-30 23:50:15 +01:00
|
|
|
import {Popconfirm, theme, Typography} from 'antd'
|
|
|
|
|
import {t} from 'ttag'
|
2024-12-31 13:55:42 +01:00
|
|
|
import type { Watchlist} from '../../../utils/api'
|
|
|
|
|
import {deleteWatchlist} from '../../../utils/api'
|
2024-12-30 23:50:15 +01:00
|
|
|
import {DeleteFilled} from '@ant-design/icons'
|
|
|
|
|
import React from 'react'
|
2024-08-15 22:58:15 +02:00
|
|
|
|
|
|
|
|
export function DeleteWatchlistButton({watchlist, onDelete}: { watchlist: Watchlist, onDelete: () => void }) {
|
|
|
|
|
const {token} = theme.useToken()
|
|
|
|
|
|
2024-12-30 23:50:15 +01:00
|
|
|
return (
|
|
|
|
|
<Popconfirm
|
|
|
|
|
title={t`Delete the Watchlist`}
|
|
|
|
|
description={t`Are you sure to delete this Watchlist?`}
|
|
|
|
|
onConfirm={async () => await deleteWatchlist(watchlist.token).then(onDelete)}
|
|
|
|
|
okText={t`Yes`}
|
|
|
|
|
cancelText={t`No`}
|
|
|
|
|
okButtonProps={{danger: true}}
|
|
|
|
|
>
|
|
|
|
|
<Typography.Link>
|
|
|
|
|
<DeleteFilled style={{color: token.colorError}} title={t`Delete the Watchlist`}/>
|
|
|
|
|
</Typography.Link>
|
|
|
|
|
</Popconfirm>
|
|
|
|
|
)
|
|
|
|
|
}
|