Skip to content

Commit e4e10e9

Browse files
MadinventorZerojonocrbuddhajjigaexkevinparkwilliamdyoon
committed
Portion of the Tutorial Updates. Added comments. Fixed side scroll of reusable components. Restored focus feature.
Co-authored-by: jonocr <[email protected]> Co-authored-by: buddhajjigae <[email protected]> Co-authored-by: xkevinpark <[email protected]> Co-authored-by: williamdyoon <[email protected]>
1 parent cfd5ce4 commit e4e10e9

21 files changed

+36
-25
lines changed

app/src/components/bottom/CreationPanel.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import ComponentPanel from '../right/ComponentPanel'
33
import StatePropsPanel from '../right/StatePropsPanel'
44
import HTMLPanel from '../left/HTMLPanel'
55

6+
// Creation panel holds all of the creation functionality of the application. ComponentPanel, HTMLPanel, and StatePropsPanel are all hanged here.
7+
// This allows users to create all aspects of this application in one place.
68
const CreationPanel = (props): JSX.Element => {
79
return (
810
<div className="creation-panel" >

app/src/components/left/DragDropPanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import HTMLItem from './HTMLItem';
55
import { makeStyles } from '@material-ui/core/styles';
66

77
/*
8-
DESCRIPTION: This is the bottom half of the left panel, starting from the 'HTML
8+
DESCRIPTION: This is the top half of the left panel, starting from the 'HTML
99
Elements' header. The boxes containing each HTML element are rendered in
1010
HTMLItem, which itself is rendered by this component.
1111
@@ -16,7 +16,7 @@ Central state contains all available HTML elements (stored in the HTMLTypes prop
1616
Hook state:
1717
-tag:
1818
*/
19-
19+
// Extracted the drag and drop functionality from HTMLPanel to make a modular component that can hang wherever the future designers may choose.
2020
const DragDropPanel = (props): JSX.Element => {
2121
// const classes = useStyles();
2222
const [state, dispatch] = useContext(StateContext);

app/src/components/main/DemoRender.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import Box from '@material-ui/core/Box';
77
import StateContext from '../../context/context';
88
import cssRefresher from '../../helperFunctions/cssRefresh';
99

10+
// DemoRender is the full sandbox demo of our user's custom built React components. DemoRender references the design specifications stored in state to construct
11+
// real react components that utilize hot module reloading to depict the user's prototype application.
1012
const DemoRender = (props): JSX.Element => {
1113
const [components, setComponents] = useState([]);
1214
const [state, dispatch] = useContext(StateContext);
@@ -16,7 +18,9 @@ const DemoRender = (props): JSX.Element => {
1618
border: '2px Solid grey',
1719
};
1820

19-
const componentBuilder = (array, key = 0) => {
21+
// 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
22+
// Material UI is utilized to incorporate the apporpriate tags with specific configuration designs as necessitated by HTML standards.
23+
const componentBuilder = (array: object, key: number = 0) => {
2024
const componentsToRender = [];
2125
for (const element of array) {
2226
if (element.name !== 'separator') {

app/src/components/right/ComponentPanel.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@ const ComponentPanel = ({isThemeLight}): JSX.Element => {
125125
}
126126
}, []);
127127

128-
const isFocus = (targetId: Number) => {
129-
return state.canvasFocus.componentId === targetId ? true : false;
130-
};
131-
132128
return (
133129
<div className={classes.panelWrapper}>
134130
{/* Add a new component*/}

app/src/components/right/ComponentPanelItem.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { makeStyles } from '@material-ui/core/styles';
44
import StateContext from '../../context/context';
55
import { useDrag } from 'react-dnd';
66
import { ItemTypes } from '../../constants/ItemTypes';
7+
import { wrap } from 'module';
78

89
/*
910
DESCRIPTION: This component is each box beneath the 'root components' and
@@ -71,17 +72,19 @@ const ComponentPanelItem: React.FC<{
7172
ref={drag}
7273
xs={8}
7374
style={{
75+
display: 'grid',
7476
color: '#262626',
7577
backgroundColor: 'transparent',
7678
border: root
7779
? '2px dotted #186BB4'
7880
: '2px solid #186BB4',
7981
borderRadius: '4px',
8082
borderColor: '#000000',
83+
margin: '5px 0px'
8184
}}
8285
>
86+
{isFocus && <div className={classes.focusMark}></div>}
8387
<div className="compPanelItem" onClick={handleClick}>
84-
{isFocus && <div className={classes.focusMark}></div>}
8588
<h3 >{name}</h3>
8689
</div>
8790
</Grid>
@@ -93,13 +96,11 @@ const useStyles = makeStyles({
9396
backgroundColor: 'rgba(1,212,109,0.3)'
9497
},
9598
focusMark: {
96-
backgroundColor: '#808080',
97-
position: 'absolute',
99+
backgroundColor: 'red',
100+
justifySelf: 'left',
98101
width: '12px',
99102
height: '12px',
100-
borderRadius: '12px',
101-
left: '-35px',
102-
top: '30px'
103+
borderRadius: '25px',
103104
}
104105
});
105106

app/src/containers/CustomizationPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import FormSelector from '../components/form/Selector';
3131
// Caret
3232
//import Arrow from '../components/main/Arrow';
3333
import { config } from 'ace-builds';
34-
34+
// Previously named rightContainer, Renamed to Customizationpanel this now hangs on BottomTabs
3535
// need to pass in props to use the useHistory feature of react router
3636
const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
3737
const classes = useStyles(isThemeLight);

app/src/helperFunctions/componentNestValidation.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
const componentNest = (children: any, nestId: Number) => {
1+
2+
// This function is used in both DirectChildHTMLNestable and SeparatorChild to ensure that user created components do not nest within themselves.
3+
// To allow such nesting would be a certain paradox and locks the application.
4+
// This check is done right after the drag functionality resolves and releases. Nothing is done if a component is found trying to nest within itself.
5+
const componentNest = (children: object, nestId: Number) => {
26
console.log('Made it to this point')
37
let notNested = true;
48
for (const element of children) {

app/src/helperFunctions/generateCode.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,20 @@ const generateUnformattedCode = (
9898
return customizationDetails;
9999
};
100100

101-
// function to dynamically generate a complete html (& also other library type) elements
101+
// function to fix the spacing of the ace editor for new lines of added content. This was breaking on nested components, leaving everything right justified.
102102
const tabSpacer = (level: number) => {
103103
let tabs = ''
104104
for (let i = 0; i < level; i++) tabs += ' ';
105105
return tabs;
106106
}
107-
107+
108+
// function to dynamically generate the appropriate levels for the code preview
108109
const levelSpacer = (level: number, spaces: number) => {
109110
if (level === 2 ) return `\n${tabSpacer(spaces)}`;
110111
else return ''
111112
}
112-
113+
114+
// function to dynamically generate a complete html (& also other library type) elements
113115
const elementGenerator = (childElement: object, level: number = 2) => {
114116
let innerText = '';
115117
let activeLink = '';
@@ -162,7 +164,8 @@ const generateUnformattedCode = (
162164
.filter(element => !!element)
163165
.join('')}`;
164166
};
165-
167+
168+
// function to properly incorporate the user created state that is stored in the application state
166169
const writeStateProps = (stateArray: any) => {
167170
let stateToRender = '';
168171
for (const element of stateArray) {
@@ -211,7 +214,7 @@ const generateUnformattedCode = (
211214
}
212215
${
213216
stateful && !classBased
214-
? `const [value, setValue] = useState<any | undefined>("INITIAL VALUE");${writeStateProps(currentComponent.useStateCodes)};
217+
? `const [value, setValue] = useState<any | undefined>("INITIAL VALUE")${writeStateProps(currentComponent.useStateCodes)};
215218
`
216219
: ``
217220
}

app/src/public/styles/style.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ LEFT COLUMN
130130
}
131131

132132
#CompBottomHalf{
133+
flex-grow: 1;
133134
overflow-y: auto;
135+
margin-bottom: 50%;
134136
}
135137

136138
.HTMLElements {
@@ -372,10 +374,9 @@ RIGHT COLUMN
372374

373375
.compPanelItem {
374376
height: 100%;
375-
position: center;
377+
display: flex;
376378
justify-content: center;
377379
align-content: center;
378-
display: flex;
379380
word-wrap: break-word;
380381
}
381382

app/src/tutorial/ReusableComponents.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ const ReusableComponents: React.FC<{
1212
<div className={classes.wrapper}>
1313
<h1 className={classes.title}>Reusable Components</h1>
1414
<hr/>
15-
<p className={classes.text}>To add a Reusable Component, use the top right input form to name a Component. Leave the Root/Page checkbox unchecked. Then select add to create a new Reusable Component.</p>
15+
<p className={classes.text}>To add a Reusable Component, use the New Component input form in the Creation Panel to name a Component. Leave the Root/Page checkbox unchecked. Then click Create to add a new Reusable Component.</p>
1616
<div className={classes.imgWrapper}>
1717
<img className={classes.img} src={reusableComponents1} />
1818
</div>
1919
<hr/>
20-
<p className={classes.text}>The Components you create will populate the right container under the section 'Reusable Components'.</p>
20+
<p className={classes.text}>The Components you create will populate on the left panel under the section 'Reusable Components'.</p>
2121
<div className={classes.imgWrapper}>
2222
<img className={classes.img} src={reusableComponents2} />
2323
</div>
@@ -28,7 +28,7 @@ const ReusableComponents: React.FC<{
2828
<div className={classes.imgWrapper}>
2929
<img className={classes.img} src={reusableComponents3} />
3030
</div>
31-
<p className={classes.text}>You can place a reusable component inside <span className={classes.notLink} onClick={() => setPage('Pages')} >Pages</span> and populate the component itself with the <span className={classes.notLink} onClick={() => setPage('HTML_Elements')} >HTML Elements</span>.</p>
31+
<p className={classes.text}>You can place a reusable component inside <span className={classes.notLink} onClick={() => setPage('Pages')} >Pages</span> and populate the component itself with other <span className={classes.notLink} onClick={() => setPage('HTML_Elements')} >HTML Elements</span>.</p>
3232
<hr/>
3333
</div>
3434
);
Loading
Loading
Loading
Binary file not shown.
Loading
-15.2 KB
Loading
-15.8 KB
Loading
-20.3 KB
Loading
-138 KB
Loading
-229 KB
Loading
-70.1 KB
Loading

0 commit comments

Comments
 (0)