feat: using programstore
ref: N25B-399
This commit is contained in:
@@ -181,21 +181,23 @@ function graphReducer() {
|
||||
*/
|
||||
function VisProgPage() {
|
||||
const [showSimpleProgram, setShowSimpleProgram] = useState(false);
|
||||
const [phases, setPhases] = useState<any[]>([]);
|
||||
const setProgramState = useProgramStore((state) => state.setProgramState);
|
||||
|
||||
const runProgram = () => {
|
||||
const reducedPhases = graphReducer();
|
||||
setPhases(reducedPhases);
|
||||
setShowSimpleProgram(true);
|
||||
runProgramm();
|
||||
const phases = graphReducer(); // reduce graph
|
||||
setProgramState({ phases }); // <-- save to store
|
||||
setShowSimpleProgram(true); // show SimpleProgram
|
||||
runProgramm(); // send to backend if needed
|
||||
};
|
||||
|
||||
if (showSimpleProgram) {
|
||||
return (
|
||||
<SimpleProgram
|
||||
phases={phases}
|
||||
|
||||
/>
|
||||
<div>
|
||||
<button onClick={() => setShowSimpleProgram(false)}>
|
||||
Back to Editor ◀
|
||||
</button>
|
||||
<SimpleProgram/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user