2023-09-20 16:19:37 +00:00
|
|
|
import { PlusOutlined } from '@ant-design/icons';
|
|
|
|
import { Button, List } from 'antd';
|
|
|
|
import React, { useState } from 'react';
|
2023-09-27 08:57:46 +00:00
|
|
|
import {
|
|
|
|
NotificationFormValues,
|
|
|
|
NotificationInfoModal,
|
|
|
|
} from '../../components/modals/NotificationInfo';
|
2023-09-20 16:19:37 +00:00
|
|
|
import { PageHeader } from '../../components/PageHeader';
|
|
|
|
import { useEvent } from '../../hooks/useEvent';
|
|
|
|
|
|
|
|
export const NotificationList: React.FC = React.memo(() => {
|
|
|
|
const [open, setOpen] = useState(false);
|
|
|
|
|
2023-09-27 08:57:46 +00:00
|
|
|
const handleSubmit = useEvent((values: NotificationFormValues) => {
|
|
|
|
console.log('ok', values);
|
2023-09-20 16:19:37 +00:00
|
|
|
setOpen(false);
|
|
|
|
});
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<PageHeader
|
|
|
|
title="Notification List"
|
|
|
|
action={
|
|
|
|
<div>
|
|
|
|
<Button
|
|
|
|
type="primary"
|
|
|
|
icon={<PlusOutlined />}
|
|
|
|
size="large"
|
|
|
|
onClick={() => setOpen(true)}
|
|
|
|
>
|
|
|
|
New
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<List
|
|
|
|
bordered={true}
|
|
|
|
dataSource={[
|
|
|
|
{ id: '1', name: 'Email Notify' },
|
|
|
|
{ id: '1', name: 'Email Notify' },
|
|
|
|
{ id: '1', name: 'Email Notify' },
|
|
|
|
]}
|
|
|
|
renderItem={(item) => (
|
|
|
|
<List.Item actions={[<Button>edit</Button>]}>
|
|
|
|
<List.Item.Meta title={item.name} />
|
|
|
|
</List.Item>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
|
|
|
|
<NotificationInfoModal
|
|
|
|
open={open}
|
2023-09-27 08:57:46 +00:00
|
|
|
onSubmit={handleSubmit}
|
2023-09-20 16:19:37 +00:00
|
|
|
onCancel={() => setOpen(false)}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
NotificationList.displayName = 'NotificationList';
|