Skip to content

Commit 9c7f2a7

Browse files
committed
Revert "update dependences and demo error"
This reverts commit d25a58e.
1 parent d25a58e commit 9c7f2a7

File tree

3 files changed

+2917
-2145
lines changed

3 files changed

+2917
-2145
lines changed

app/src/components/main/DemoRender.tsx

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import { Link, Route, BrowserRouter as Router, Switch } from 'react-router-dom';
21
import React, { useEffect, useRef } from 'react';
3-
import { useDispatch, useSelector } from 'react-redux';
4-
2+
import { BrowserRouter as Router, Switch, Route, Link } from 'react-router-dom';
53
import Box from '@mui/material/Box';
64
import { Component } from '../../interfaces/Interfaces';
75
import ReactDOMServer from 'react-dom/server';
8-
import { RootState } from '../../redux/store';
6+
import { useDispatch, useSelector } from 'react-redux';
97
import { changeFocus } from '../../redux/reducers/slice/appStateSlice';
8+
import { RootState } from '../../redux/store';
109

1110
// DemoRender is the full sandbox demo of our user's custom built React components. DemoRender references the design specifications stored in state to construct
1211
// real react components that utilize hot module reloading to depict the user's prototype application.
@@ -54,21 +53,16 @@ const DemoRender = (): JSX.Element => {
5453
`;
5554

5655
//Switch between components when clicking on a link in the live render
57-
window.onmessage = (event) => {
58-
if (event.data === undefined) return;
59-
60-
const data = event.data.data;
61-
if (typeof data !== 'string') return; // Make sure data is a string
62-
63-
const component: string = data.split('/').at(-1);
64-
const componentId =
65-
component &&
66-
state.components?.find((el) => {
67-
return el.name.toLowerCase() === component.toLowerCase();
68-
})?.id; // Use optional chaining for state.components
69-
componentId && dispatch(changeFocus({ componentId, childId: null }));
70-
};
71-
56+
window.onmessage = (event) => {
57+
if (event.data === undefined) return;
58+
const component: string = event.data.data?.split('/').at(-1);
59+
const componentId =
60+
component &&
61+
state.components?.find((el) => {
62+
return el.name.toLowerCase() === component.toLowerCase();
63+
}).id;
64+
componentId && dispatch(changeFocus({ componentId, childId: null }));
65+
};
7266

7367
// This function is the heart of DemoRender it will take the array of components stored in state and dynamically construct the desired React component for the live demo
7468
// Material UI is utilized to incorporate the apporpriate tags with specific configuration designs as necessitated by HTML standards.

0 commit comments

Comments
 (0)