add suport to drop collections

This commit is contained in:
anovazzi1 2023-10-09 21:13:42 -03:00
commit 94b3aa88b9
2 changed files with 7 additions and 0 deletions

View file

@ -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);

View file

@ -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({