2021-12-22 14:59:07 +01:00
|
|
|
import { MenuList, MenuItem } from '@chakra-ui/react'
|
2023-06-05 14:49:04 +02:00
|
|
|
import { CopyIcon, TrashIcon } from '@/components/icons'
|
2023-03-15 11:51:30 +01:00
|
|
|
import { useTypebot } from '@/features/editor/providers/TypebotProvider'
|
2023-03-15 08:35:16 +01:00
|
|
|
import { ItemIndices } from '@typebot.io/schemas'
|
2021-12-22 14:59:07 +01:00
|
|
|
|
2022-02-04 19:00:08 +01:00
|
|
|
type Props = {
|
|
|
|
|
indices: ItemIndices
|
|
|
|
|
}
|
|
|
|
|
export const ItemNodeContextMenu = ({ indices }: Props) => {
|
2023-06-05 14:49:04 +02:00
|
|
|
const { deleteItem, duplicateItem } = useTypebot()
|
2021-12-22 14:59:07 +01:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<MenuList>
|
2023-06-05 14:49:04 +02:00
|
|
|
<MenuItem icon={<CopyIcon />} onClick={() => duplicateItem(indices)}>
|
|
|
|
|
Duplicate
|
|
|
|
|
</MenuItem>
|
|
|
|
|
<MenuItem icon={<TrashIcon />} onClick={() => deleteItem(indices)}>
|
2021-12-22 14:59:07 +01:00
|
|
|
Delete
|
|
|
|
|
</MenuItem>
|
|
|
|
|
</MenuList>
|
|
|
|
|
)
|
|
|
|
|
}
|