From 18c0be6a5351043ff7fc8502bf5ae35f80df473b Mon Sep 17 00:00:00 2001 From: Ole Morud Date: Mon, 22 Aug 2022 22:37:35 +0200 Subject: [PATCH] make drag&drop transfer entire object --- src/components/InstructionMenu.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/InstructionMenu.tsx b/src/components/InstructionMenu.tsx index a00a7e0..71d25a3 100644 --- a/src/components/InstructionMenu.tsx +++ b/src/components/InstructionMenu.tsx @@ -1,6 +1,6 @@ import { Card, CardContent, Grid, styled, Typography } from "@mui/material" import React from "react" -import instructions, { Instruction } from "../Instructions" +import instructions, { Instruction } from "../instructions" import Tooltip, { TooltipProps, tooltipClasses } from "@mui/material/Tooltip" import { SIDEBAR_WIDTH } from "../const" @@ -36,7 +36,7 @@ function handleDragStart( } event.dataTransfer.dropEffect = "copy" - event.dataTransfer.setData("text/plain", instruction.symbol) + event.dataTransfer.setData("instruction", JSON.stringify(instruction)) } export default function InstructionMenu() { @@ -45,7 +45,7 @@ export default function InstructionMenu() { return (
- {instructions.map((instruction: Instruction) => { + {instructions.slice(1).map((instruction: Instruction) => { return (