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:
Pim Hutting
2025-12-04 09:12:01 +01:00
parent 3bcc865dd8
commit 413fb05cd8
4 changed files with 261 additions and 262 deletions

19
src/utils/SaveLoad.ts Normal file
View 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" });
}