Skip to content

Commit 7e1a800

Browse files
authored
Merge pull request #33 from MadinventorZero/tutorialupdate
Portion of the Tutorial Updates. Added comments. Fixed side scroll of…
2 parents b3395a9 + f4b96dd commit 7e1a800

26 files changed

+46
-26
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/team-reactype/ReacType/pulls)
77
![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)
8-
![Version 6.0](https://img.shields.io/badge/Release-6.0-lightgrey.svg)
8+
![Version 7.0.0](https://img.shields.io/badge/Release-7.0.0-lightgrey.svg)
99

10-
**ReacType** is a visual prototyping tool for developers employing **React** component architecture alongside the comprehensive type-checking of **TypeScript**.
10+
**ReacType** is a rapid prototyping tool for developers employing **React** component architecture alongside the comprehensive type-checking of **TypeScript**.
1111
In other words, **you can draw prototypes and export React / TypeScript code!**
1212

13-
**ReacType** allows users to _visualize_ their application architecture dynamically, employing a _drag-and-drop canvas display_ and a _real-time component code preview_. Users can create components and drag _instances_ of these components, as well as HTML elements, onto the canvas. This architecture can then be _exported_ as TypeScript application files to be used as a starter template for any repository.
13+
**ReacType** allows users to _visualize_ their application architecture dynamically, employing a _drag-and-drop canvas display_ , a _real-time demo render_ , a _real-time component code preview_. Users can create components and drag _instances_ of these components, as well as HTML elements, onto the canvas. This architecture can then be _exported_ as TypeScript application files to be used as a starter template for any repository.
1414

1515
Download for [MacOS](https://github.com/team-reactype/ReacType/releases), [Windows](https://github.com/team-reactype/ReacType/releases/), [Linux](https://github.com/team-reactype/ReacType/releases/).
1616

@@ -48,6 +48,13 @@ Download for [MacOS](https://github.com/team-reactype/ReacType/releases), [Windo
4848

4949
### Features
5050

51+
52+
- **Live Render Demo**: Live render demo in React using Electron's sandbox environment. Updates in realtime to reflect canvas structure and customization options.
53+
- **Annotations**: Provide design notes directly on the canvas and have these persist while sharing designs with other engineers.
54+
- **CSS Editor**: Copy and paste custom css styles and classes into the editor and save to use personal or company designs in an instant.
55+
- **State & Props Creator**: Create custom state hooks with real-time updates in the code preview.
56+
- **Application Style Update**: Complete redesign of the entire application for enhanced user experience to maintain a single view application
57+
5158
- **Dashboard**: Click the 'Dashboard' button to view the Public Dashboard and User Dashboard.
5259
- **Like**: Like other people's templates by clicking on the thumbs up icon.
5360
- **Comment**: Comment on other templates by typing in the input field and clicking the comment icon.

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
@@ -124,10 +124,6 @@ const ComponentPanel = ({isThemeLight}): JSX.Element => {
124124
}
125125
}, []);
126126

127-
const isFocus = (targetId: Number) => {
128-
return state.canvasFocus.componentId === targetId ? true : false;
129-
};
130-
131127
return (
132128
<div className={classes.panelWrapper}>
133129
{/* 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
@@ -29,7 +29,7 @@ import ProjectManager from '../components/right/ProjectManager';
2929
import StateContext from '../context/context';
3030
import FormSelector from '../components/form/Selector';
3131
import { config } from 'ace-builds';
32-
32+
// Previously named rightContainer, Renamed to Customizationpanel this now hangs on BottomTabs
3333
// need to pass in props to use the useHistory feature of react router
3434
const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
3535
const classes = useStyles(isThemeLight);

app/src/helperFunctions/componentNestValidation.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2+
3+
// This function is used in both DirectChildHTMLNestable and SeparatorChild to ensure that user created components do not nest within themselves.
4+
// To allow such nesting would be a certain paradox and locks the application.
5+
// 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.
16
const componentNest = (children: any, nestId: Number) => {
27
let notNested = true;
38
for (const element of children) {

app/src/helperFunctions/generateCode.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,20 @@ const generateUnformattedCode = (
9595
return customizationDetails;
9696
};
9797

98-
// function to dynamically generate a complete html (& also other library type) elements
98+
// 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.
9999
const tabSpacer = (level: number) => {
100100
let tabs = ''
101101
for (let i = 0; i < level; i++) tabs += ' ';
102102
return tabs;
103103
}
104-
104+
105+
// function to dynamically generate the appropriate levels for the code preview
105106
const levelSpacer = (level: number, spaces: number) => {
106107
if (level === 2 ) return `\n${tabSpacer(spaces)}`;
107108
else return ''
108109
}
109-
110+
111+
// function to dynamically generate a complete html (& also other library type) elements
110112
const elementGenerator = (childElement: object, level: number = 2) => {
111113
let innerText = '';
112114
let activeLink = '';
@@ -160,7 +162,8 @@ const generateUnformattedCode = (
160162
.join('')
161163
}`;
162164
};
163-
165+
166+
// function to properly incorporate the user created state that is stored in the application state
164167
const writeStateProps = (stateArray: any) => {
165168
let stateToRender = '';
166169
for (const element of stateArray) {
@@ -205,6 +208,7 @@ const generateUnformattedCode = (
205208
? `class ${currentComponent.name} extends Component {`
206209
: `const ${currentComponent.name} = (props): JSX.Element => {`
207210
}
211+
208212
${
209213
stateful && !classBased
210214
? `const [value, setValue] = useState<any | undefined>("INITIAL VALUE")${writeStateProps(currentComponent.useStateCodes)};

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
Loading
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)