@@ -13,6 +13,7 @@ import { Component } from '../../interfaces/Interfaces';
13
13
import ReactDOMServer from 'react-dom/server' ;
14
14
import { RootState } from '../../redux/store' ;
15
15
import { changeFocus } from '../../redux/reducers/slice/appStateSlice' ;
16
+ import { blue } from '@mui/material/colors' ;
16
17
17
18
// DemoRender is the full sandbox demo of our user's custom built React components. DemoRender references the design specifications stored in state to construct
18
19
// real react components that utilize hot module reloading to depict the user's prototype application.
@@ -79,11 +80,12 @@ const DemoRender = (): JSX.Element => {
79
80
` ;
80
81
81
82
window . onmessage = ( event ) => {
83
+ // console.log('event', event)
82
84
// If event.data or event.data.data is undefined, return early
83
85
if ( ! event . data || typeof event . data . data !== 'string' ) return ;
84
86
85
87
const component : string = event . data . data . split ( '/' ) . at ( - 1 ) ;
86
-
88
+ console . log ( 'component' , component )
87
89
// If components aren't defined or component isn't a string, return early
88
90
if ( ! state . components || ! component ) return ;
89
91
@@ -102,10 +104,13 @@ const DemoRender = (): JSX.Element => {
102
104
const componentBuilder = ( array : any , key : number = 0 ) => {
103
105
const componentsToRender = [ ] ;
104
106
for ( const element of array ) {
107
+ console . log ( "array" )
108
+ console . log ( array )
105
109
if ( element . name !== 'separator' ) {
106
110
const elementType = element . name ;
107
111
const childId = element . childId ;
108
112
const elementStyle = element . style ;
113
+ console . log ( "elementStyle" , elementStyle )
109
114
const innerText = element . attributes . compText ;
110
115
const classRender = element . attributes . cssClasses ;
111
116
const activeLink = element . attributes . compLink ;
@@ -188,6 +193,7 @@ const DemoRender = (): JSX.Element => {
188
193
key += 1 ;
189
194
}
190
195
}
196
+ console . log ( 'componentstoRender array line 196' , componentsToRender )
191
197
return componentsToRender ;
192
198
} ;
193
199
@@ -198,16 +204,17 @@ const DemoRender = (): JSX.Element => {
198
204
const currComponent = state . components . find (
199
205
( element ) => element . id === state . canvasFocus . componentId
200
206
) ;
201
-
207
+
202
208
//writes each component to the code
203
209
componentBuilder ( currComponent . children ) . forEach ( ( element ) => {
204
210
try {
205
211
code += ReactDOMServer . renderToString ( element ) ;
212
+ console . log ( 'code line 211' , code )
206
213
} catch {
207
214
return ;
208
215
}
209
216
} ) ;
210
-
217
+ console . log ( 'code line 215' , code )
211
218
//writes our stylesheet from state to the code
212
219
code += `<style>${ stylesheet } </style>` ;
213
220
0 commit comments