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'
|
2022-02-04 19:00:08 +01:00
|
|
|
import { StepIndices } from 'models'
|
2021-12-22 14:59:07 +01:00
|
|
|
|
2022-02-04 19:00:08 +01:00
|
|
|
type Props = { indices: StepIndices }
|
|
|
|
export const StepNodeContextMenu = ({ indices }: Props) => {
|
2022-03-23 11:00:43 +01:00
|
|
|
const { deleteStep, duplicateStep } = useTypebot()
|
|
|
|
|
|
|
|
const handleDuplicateClick = () => duplicateStep(indices)
|
2022-01-06 09:40:56 +01:00
|
|
|
|
2022-02-04 19:00:08 +01:00
|
|
|
const handleDeleteClick = () => deleteStep(indices)
|
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>
|
|
|
|
)
|
|
|
|
}
|