Skip to content

Commit 0a5b757

Browse files
committed
updated assignContext data type
1 parent a94fd15 commit 0a5b757

File tree

4 files changed

+58
-39
lines changed

4 files changed

+58
-39
lines changed

app/src/components/ContextAPIManager/AssignTab/AssignContainer.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,12 @@ const AssignContainer = () => {
6565
dispatch(deleteElement({ id: 'FAKE_ID', contextParam: contextParam }));
6666

6767
if (roomCode) {
68-
emitEvent('assignContextActions', roomCode, [
69-
{
70-
context: contextInput,
71-
component: componentInput
72-
},
73-
{ id: 'FAKE_ID', contextParam: contextParam }
74-
]);
68+
emitEvent('assignContextActions', roomCode, {
69+
context: contextInput,
70+
component: componentInput,
71+
id: 'FAKE_ID',
72+
contextParam: contextParam
73+
});
7574
}
7675

7776
renderComponentTable(componentInput);

app/src/components/left/RoomsContainer.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,15 @@ const RoomsContainer = () => {
241241
);
242242

243243
socket.on('assign context data from server', (data) => {
244-
store.dispatch(addComponentToContext(data[0]));
245-
store.dispatch(deleteElement(data[1]));
244+
store.dispatch(
245+
addComponentToContext({
246+
context: data.context,
247+
component: data.component
248+
})
249+
);
250+
store.dispatch(
251+
deleteElement({ id: 'FAKE_ID', contextParam: data.contextParam })
252+
);
246253
});
247254
}
248255
}

app/src/containers/CustomizationPanel.tsx

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
379379
contextParam: contextParam
380380
})
381381
);
382-
382+
383383
const eventsObj: any = {};
384384
if (eventAll[0] !== '') eventsObj[eventAll[0]] = eventAll[1];
385385
dispatch(updateEvents({ events: eventsObj, contextParam: contextParam }));
@@ -393,11 +393,12 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
393393
style: styleObj,
394394
events: eventsObj
395395
});
396-
console.log('emit updateChildAction event is triggered in CustomizationPanel.tsx');
396+
console.log(
397+
'emit updateChildAction event is triggered in CustomizationPanel.tsx'
398+
);
397399
}
398400

399401
return styleObj;
400-
401402
};
402403
const handleTailwind = (): void => {
403404
dispatch(changeTailwind(true));
@@ -424,10 +425,12 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
424425
id: {},
425426
contextParam: contextParam
426427
});
427-
console.log('emit deleteChildAction event is triggered in CustomizationPanel.tsx');
428+
console.log(
429+
'emit deleteChildAction event is triggered in CustomizationPanel.tsx'
430+
);
428431
}
429432
};
430-
433+
431434
const handlePageDelete = (id) => () => {
432435
// TODO: return modal
433436
if (isLinkedTo()) return setDeleteLinkedPageError(true);
@@ -532,24 +535,26 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
532535
<ProjectManager />
533536
<div className="rightPanelWrapper">
534537
<div>
538+
<div className={classes.rootConfigHeader}>
535539
<h4
536-
className={
537-
isThemeLight
538-
? classes.lightThemeFontColor
539-
: classes.darkThemeFontColor
540-
}
541-
>
542-
Parent Component:
543-
<br />
544-
<br />
545-
<span className={classes.rootCompName}>
546-
{configTarget.name}
547-
</span>
548-
<p style={{ fontSize: '16px' }}>
549-
Drag and drop an html element (or focus one) to see what
550-
happens!
551-
</p>
552-
</h4>
540+
className={
541+
isThemeLight
542+
? classes.lightThemeFontColor
543+
: classes.darkThemeFontColor
544+
}
545+
>
546+
Parent Component:
547+
<br />
548+
<br />
549+
<span className={classes.rootCompName}>
550+
{configTarget.name}
551+
</span>
552+
<p style={{ fontSize: '16px' }}>
553+
Drag and drop an html element (or focus one) to see what
554+
happens!
555+
</p>
556+
</h4>
557+
</div>
553558
</div>
554559
</div>
555560
<ProjectManager />
@@ -579,9 +584,17 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
579584
{configTarget.child.type === 'component'
580585
? ' component'
581586
: ' element'}{' '}
582-
: {configTarget.child.name}
583587
<br />
588+
<br />
589+
<span
590+
className={
591+
isThemeLight
592+
? `${classes.compName} ${classes.lightThemeFontColor}`
593+
: `${classes.compName} ${classes.darkThemeFontColor}`
594+
}
595+
>
584596
{configTarget.child.name}
597+
</span>
585598
</h4>
586599
</div>
587600
<section className={'customization-section'}>
@@ -867,18 +880,18 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
867880
<Button
868881
variant="contained"
869882
color="primary"
870-
onClick={handleSave}
871883
className={
872884
isThemeLight
873885
? `${classes.button} ${classes.saveButtonLight}`
874886
: `${classes.button} ${classes.saveButtonDark}`
875887
}
888+
onClick={handleSave}
876889
id="saveButton"
877890
>
878891
SAVE
879892
</Button>
880893
</div>
881-
{/* <div className={classes.buttonRow}>
894+
<div className={classes.buttonRow}>
882895
<Button
883896
variant="contained"
884897
color="primary"
@@ -892,9 +905,9 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
892905
>
893906
CSS
894907
</Button>
895-
</div> */}
908+
</div>
896909

897-
{/* <div>
910+
<div>
898911
<Button
899912
variant="contained"
900913
color="primary"
@@ -913,7 +926,7 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
913926
>
914927
Tailwind
915928
</Button>
916-
</div> */}
929+
</div>
917930
{configTarget.child ? (
918931
<div className={classes.buttonRow}>
919932
<Button
@@ -1025,7 +1038,7 @@ const useStyles = makeStyles({
10251038
marginTop: '20px'
10261039
},
10271040
configType: {
1028-
minWidth: '100px',
1041+
minWidth: '185px',
10291042
fontSize: '85%'
10301043
},
10311044
configValue: {

server/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ io.on('connection', (client) => {
293293
}
294294
);
295295

296-
client.on('assignContextActions', (roomCode: string, data: []) => {
296+
client.on('assignContextActions', (roomCode: string, data: object) => {
297297
if (roomCode) {
298298
client.to(roomCode).emit('assign context data from server', data);
299299
}

0 commit comments

Comments
 (0)