import React from "react";
import { Action } from "./types";
import { EditableText } from "../components/EditableText";
import { saveAsJSON, loadFromJSON } from "../scene";
export const actionChangeProjectName: Action = {
name: "changeProjectName",
perform: (elements, appState, value) => {
return { appState: { ...appState, name: value } };
},
PanelComponent: ({ appState, updateData }) => (
<>
Name
{appState.name && (
updateData(name)}
/>
)}
>
)
};
export const actionChangeExportBackground: Action = {
name: "changeExportBackground",
perform: (elements, appState, value) => {
return { appState: { ...appState, exportBackground: value } };
},
PanelComponent: ({ appState, updateData }) => (
)
};
export const actionSaveScene: Action = {
name: "saveScene",
perform: (elements, appState, value) => {
saveAsJSON(elements, appState.name);
return {};
},
PanelComponent: ({ updateData }) => (
)
};
export const actionLoadScene: Action = {
name: "loadScene",
perform: (elements, appState, loadedElements) => {
return { elements: loadedElements };
},
PanelComponent: ({ updateData }) => (
)
};