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
19 lines
527 B
TypeScript
19 lines
527 B
TypeScript
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" });
|
|
} |