2025-12-11 10:40:55 +01:00
|
|
|
/*
|
2026-01-12 15:00:36 +01:00
|
|
|
* Copyright (c) 2026 by Christian Kellner.
|
2025-12-11 10:40:55 +01:00
|
|
|
* Licensed under Apache-2.0 with Commons Clause and Attribution/Naming Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2026-01-22 16:09:36 +01:00
|
|
|
import { Empty, Table, Button } from '@douyinfe/semi-ui-19';
|
2023-03-20 08:52:13 +01:00
|
|
|
import { IconDelete, IconEdit } from '@douyinfe/semi-icons';
|
2026-06-04 10:35:42 +02:00
|
|
|
import { useTranslation } from '../../services/i18n/i18n.jsx';
|
2021-01-21 16:09:23 +01:00
|
|
|
|
2023-03-20 08:52:13 +01:00
|
|
|
export default function NotificationAdapterTable({ notificationAdapter = [], onRemove, onEdit } = {}) {
|
2026-06-04 10:35:42 +02:00
|
|
|
const t = useTranslation();
|
2021-01-21 16:09:23 +01:00
|
|
|
return (
|
2023-03-20 08:52:13 +01:00
|
|
|
<Table
|
|
|
|
|
pagination={false}
|
2026-06-04 10:35:42 +02:00
|
|
|
empty={<Empty description={t('notification.tableEmptyState')} />}
|
2023-03-20 08:52:13 +01:00
|
|
|
columns={[
|
|
|
|
|
{
|
2026-06-04 10:35:42 +02:00
|
|
|
title: t('notification.tableColumnName'),
|
2023-03-20 08:52:13 +01:00
|
|
|
dataIndex: 'name',
|
|
|
|
|
},
|
2021-01-21 16:09:23 +01:00
|
|
|
|
2023-03-20 08:52:13 +01:00
|
|
|
{
|
|
|
|
|
title: '',
|
|
|
|
|
dataIndex: 'tools',
|
|
|
|
|
render: (_, record) => {
|
|
|
|
|
return (
|
2021-01-21 16:09:23 +01:00
|
|
|
<div style={{ float: 'right' }}>
|
2023-03-20 08:52:13 +01:00
|
|
|
<Button
|
|
|
|
|
type="secondary"
|
|
|
|
|
icon={<IconEdit />}
|
|
|
|
|
onClick={() => onEdit(record.id)}
|
|
|
|
|
style={{ marginRight: '1rem' }}
|
|
|
|
|
/>
|
|
|
|
|
<Button type="danger" icon={<IconDelete />} onClick={() => onRemove(record.id)} />
|
2021-01-21 16:09:23 +01:00
|
|
|
</div>
|
2023-03-20 08:52:13 +01:00
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
dataSource={notificationAdapter}
|
|
|
|
|
/>
|
2021-01-21 16:09:23 +01:00
|
|
|
);
|
|
|
|
|
}
|