2021-12-22 14:59:07 +01:00
|
|
|
import { MenuList, MenuItem } from '@chakra-ui/react'
|
2022-03-23 11:00:43 +01:00
|
|
|
import { CopyIcon, TrashIcon } from 'assets/icons'
|
2022-01-06 09:40:56 +01:00
|
|
|
import { useTypebot } from 'contexts/TypebotContext/TypebotContext'
|
2021-12-22 14:59:07 +01:00
|
|
|
|
2022-06-11 07:27:38 +02:00
|
|
|
export const GroupNodeContextMenu = ({
|
|
|
|
groupIndex,
|
|
|
|
}: {
|
|
|
|
groupIndex: number
|
|
|
|
}) => {
|
|
|
|
const { deleteGroup, duplicateGroup } = useTypebot()
|
2022-03-23 11:00:43 +01:00
|
|
|
|
2022-06-11 07:27:38 +02:00
|
|
|
const handleDeleteClick = () => deleteGroup(groupIndex)
|
2022-01-06 09:40:56 +01:00
|
|
|
|
2022-06-11 07:27:38 +02:00
|
|
|
const handleDuplicateClick = () => duplicateGroup(groupIndex)
|
2021-12-22 14:59:07 +01:00
|
|
|
|
|
|
|
return (
|
|
|
|
<MenuList>
|
2022-03-23 11:00:43 +01:00
|
|
|
<MenuItem icon={<CopyIcon />} onClick={handleDuplicateClick}>
|
|
|
|
Duplicate
|
|
|
|
</MenuItem>
|
2021-12-22 14:59:07 +01:00
|
|
|
<MenuItem icon={<TrashIcon />} onClick={handleDeleteClick}>
|
|
|
|
Delete
|
|
|
|
</MenuItem>
|
|
|
|
</MenuList>
|
|
|
|
)
|
|
|
|
}
|