chore: applied feedback from merge request
Removed all the DOM manipulations and created a utils file so npx eslint is happy. Also changed the tests to test the new version of the code. ref: N25B-189
This commit is contained in:
19
src/utils/SaveLoad.ts
Normal file
19
src/utils/SaveLoad.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import {type Edge, type Node } from "@xyflow/react";
|
||||
|
||||
export type SavedProject = {
|
||||
name: string;
|
||||
savedASavedProject: string; // ISO timestamp
|
||||
nodes: Node[];
|
||||
edges: Edge[];
|
||||
};
|
||||
|
||||
// Creates a JSON Blob containing the current visual program (nodes + edges)
|
||||
export function makeProjectBlob(name: string, nodes: Node[], edges: Edge[]): Blob {
|
||||
const payload = {
|
||||
name,
|
||||
savedAt: new Date().toISOString(),
|
||||
nodes,
|
||||
edges,
|
||||
};
|
||||
return new Blob([JSON.stringify(payload, null, 2)], { type: "application/json" });
|
||||
}
|
||||
Reference in New Issue
Block a user