-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### What problem does this PR solve? feat: add OperateDropdown feat: send debug message #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
- Loading branch information
Showing
19 changed files
with
336 additions
and
363 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.delete { | ||
height: 24px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { ReactComponent as MoreIcon } from '@/assets/svg/more.svg'; | ||
import { useShowDeleteConfirm } from '@/hooks/commonHooks'; | ||
import { DeleteOutlined } from '@ant-design/icons'; | ||
import { Dropdown, MenuProps, Space } from 'antd'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import React from 'react'; | ||
import styles from './index.less'; | ||
|
||
interface IProps { | ||
deleteItem: () => Promise<any>; | ||
} | ||
|
||
const OperateDropdown = ({ | ||
deleteItem, | ||
children, | ||
}: React.PropsWithChildren<IProps>) => { | ||
const { t } = useTranslation(); | ||
const showDeleteConfirm = useShowDeleteConfirm(); | ||
|
||
const handleDelete = () => { | ||
showDeleteConfirm({ onOk: deleteItem }); | ||
}; | ||
|
||
const handleDropdownMenuClick: MenuProps['onClick'] = ({ domEvent, key }) => { | ||
domEvent.preventDefault(); | ||
domEvent.stopPropagation(); | ||
if (key === '1') { | ||
handleDelete(); | ||
} | ||
}; | ||
|
||
const items: MenuProps['items'] = [ | ||
{ | ||
key: '1', | ||
label: ( | ||
<Space> | ||
{t('common.delete')} | ||
<DeleteOutlined /> | ||
</Space> | ||
), | ||
}, | ||
]; | ||
|
||
return ( | ||
<Dropdown | ||
menu={{ | ||
items, | ||
onClick: handleDropdownMenuClick, | ||
}} | ||
> | ||
{children || ( | ||
<span className={styles.delete}> | ||
<MoreIcon /> | ||
</span> | ||
)} | ||
</Dropdown> | ||
); | ||
}; | ||
|
||
export default OperateDropdown; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { IModalProps } from '@/interfaces/common'; | ||
import { Drawer } from 'antd'; | ||
import FlowChatBox from './box'; | ||
|
||
const ChatDrawer = ({ visible, hideModal }: IModalProps<any>) => { | ||
return ( | ||
<Drawer | ||
title="Debug" | ||
placement="right" | ||
onClose={hideModal} | ||
open={visible} | ||
getContainer={false} | ||
width={470} | ||
zIndex={10000} | ||
> | ||
<FlowChatBox></FlowChatBox> | ||
</Drawer> | ||
); | ||
}; | ||
|
||
export default ChatDrawer; |
Oops, something went wrong.