From 94b3aa88b96742d6293de82a102f0e1369bf8af1 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Mon, 9 Oct 2023 21:13:42 -0300 Subject: [PATCH] add suport to drop collections --- src/frontend/src/contexts/tabsContext.tsx | 6 ++++++ src/frontend/src/pages/MainPage/index.tsx | 1 + 2 files changed, 7 insertions(+) diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx index 1fc036ef1..3d24823bb 100644 --- a/src/frontend/src/contexts/tabsContext.tsx +++ b/src/frontend/src/contexts/tabsContext.tsx @@ -280,6 +280,12 @@ export function TabsProvider({ children }: { children: ReactNode }) { let id; if (file) { let text = await file.text(); + let fileData = JSON.parse(text); + if (fileData.flows) { + fileData.flows.forEach((flow: FlowType) => { + id = addFlow(flow, newProject); + }); + } // parse the text into a JSON object let flow: FlowType = JSON.parse(text); diff --git a/src/frontend/src/pages/MainPage/index.tsx b/src/frontend/src/pages/MainPage/index.tsx index 5921b3cc8..1f012b4c2 100644 --- a/src/frontend/src/pages/MainPage/index.tsx +++ b/src/frontend/src/pages/MainPage/index.tsx @@ -62,6 +62,7 @@ export default function HomePage(): JSX.Element { setIsDragging(false); if (e.dataTransfer.types.some((types) => types === "Files")) { if (e.dataTransfer.files.item(0).type === "application/json") { + console.log(e.dataTransfer.files.item(0)); uploadFlow(true, e.dataTransfer.files.item(0)!); } else { setErrorData({