Skip to content

Commit e3c61b1

Browse files
merged Shlomo deletions
2 parents 43dd43c + 41b890b commit e3c61b1

30 files changed

+380
-357
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# ReacType
22

3-
43
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/team-reactype/ReacType/pulls)
54
![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
65

76
**ReacType** is a visual prototyping tool for developers employing **React** component architecture alongside the comprehensive type checking of **TypeScript**.
87

98
**ReacType** allows the user to _visualize_ their application architecture dynamically, employing a _canvas display_, an _application tree_, and a _component code preview_. The user can create components and load _instances_ of these components, as well as nested 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.
109

11-
Download for [MacOS](), [Windows](), [Linux]().
10+
Download for [MacOS](), [Windows](), [Linux]().
11+
12+
![Image of ReacType Application](src/public/images/TreeImageComponent.png)
1213

1314
### How to use
1415

src/actions/components.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import {
22
ComponentInt,
3-
ChildInt,
4-
ApplicationStateInt,
53
ComponentsInt,
64
PropInt
75
} from "../utils/interfaces";

src/components/App.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { Component } from 'react';
22
import '../public/styles/style.css';
3-
// import { MuiThemeProvider } from '@material-ui/core/styles';
43
import AppContainer from '../containers/AppContainer';
54

65
export const App: React.SFC = () => (

src/components/BottomPanel.tsx

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import React, { Component } from "react";
2+
import { connect } from "react-redux";
3+
import {
4+
handleClose,
5+
deleteCompProp,
6+
addCompProp
7+
} from "../actions/components.ts";
8+
import BottomTabs from "./BottomTabs.tsx";
9+
import { ComponentInt, ComponentsInt, ChildInt } from "../utils/interfaces";
10+
11+
const IPC = require("electron").ipcRenderer;
12+
13+
const mapDispatchToProps = (dispatch: any) => ({
14+
handleNotificationClose: () => dispatch(handleClose()),
15+
deleteProp: ({ id, index }: { id: number; index: number }) =>
16+
dispatch(deleteCompProp({ id, index })),
17+
addProp: (prop: any) => dispatch(addCompProp(prop))
18+
});
19+
20+
const mapStateToProps = (store: any) => ({
21+
focusChild: store.workspace.focusChild,
22+
components: store.workspace.components
23+
});
24+
25+
interface PropsInt {
26+
focusChild: ChildInt;
27+
components: ComponentsInt;
28+
focusComponent: ComponentInt;
29+
deleteProp: any;
30+
addProp: any;
31+
}
32+
33+
class BottomPanel extends Component<PropsInt> {
34+
35+
render() {
36+
const {
37+
components,
38+
focusComponent,
39+
deleteProp,
40+
addProp,
41+
focusChild
42+
} = this.props;
43+
44+
return (
45+
<div className="bottom-panel" style={{ width: "100%" }}>
46+
<BottomTabs
47+
components={components}
48+
focusComponent={focusComponent}
49+
deleteProp={deleteProp}
50+
addProp={addProp}
51+
focusChild={focusChild}
52+
/>
53+
</div>
54+
);
55+
}
56+
}
57+
58+
export default connect(
59+
mapStateToProps,
60+
mapDispatchToProps
61+
)(BottomPanel);

src/components/BottomTabs.jsx

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,36 @@ import { withStyles } from '@material-ui/core/styles';
33
import Tabs from '@material-ui/core/Tabs';
44
import Tab from '@material-ui/core/Tab';
55
import Tree from 'react-d3-tree';
6-
import Props from './Props.jsx';
7-
import HtmlAttr from './HtmlAttr.jsx';
8-
// import Tree from "./Tree.jsx";
6+
import Props from './Props.tsx';
7+
import HtmlAttr from './HtmlAttr.tsx';
8+
import CodePreview from './CodePreview.tsx';
9+
import { ComponentInt, ComponentsInt, ChildInt } from '../utils/interfaces';
910

10-
const styles = theme => ({
11+
interface PropsInt {
12+
focusChild: ChildInt;
13+
components: ComponentsInt;
14+
focusComponent: ComponentInt;
15+
deleteProp: any;
16+
addProp: any;
17+
classes: any;
18+
}
19+
20+
interface TreeInt {
21+
name: string;
22+
attributes: { [key: string]: { value: string } };
23+
children: TreeInt[];
24+
}
25+
26+
const styles = (theme: any): any => ({
1127
root: {
1228
flexGrow: 1,
13-
// backgroundColor: "#212121",
1429
backgroundColor: '#333333',
1530
height: '100%',
1631
color: '#fff',
1732
boxShadow: '0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23)',
1833
},
1934
tabsRoot: {
2035
borderBottom: '0.5px solid #424242',
21-
// backgroundColor: "#424242"
2236
},
2337
tabsIndicator: {
2438
backgroundColor: '#1de9b6',

src/components/CodePreview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React, { Component, Fragment } from 'react';
2-
import { withStyles } from '@material-ui/core/styles';
32
import { format } from 'prettier';
4-
import componentRender from '../utils/componentRender.util.ts';
3+
import componentRender from '../utils/componentRender.util';
54
import { ComponentInt, ComponentsInt } from '../utils/interfaces';
5+
/**** SortCHildren will be fixed , dont XXX the file *** */
66
import SortChildren from './SortChildren.jsx';
77

88
type Props = {

src/components/DataTable.tsx

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import React from "react";
2+
import { withStyles } from "@material-ui/core/styles";
3+
import Table from "@material-ui/core/Table";
4+
import TableBody from "@material-ui/core/TableBody";
5+
import TableCell from "@material-ui/core/TableCell";
6+
import TableHead from "@material-ui/core/TableHead";
7+
import TableRow from "@material-ui/core/TableRow";
8+
import Paper from "@material-ui/core/Paper";
9+
import DeleteIcon from "@material-ui/icons/Delete";
10+
import { IconButton } from "@material-ui/core";
11+
12+
const styles = (theme: any) => ({
13+
root: {
14+
width: "80%",
15+
marginTop: theme.spacing.unit * 3
16+
// overflowX: "auto"
17+
},
18+
table: {
19+
minWidth: 500
20+
}
21+
});
22+
23+
/** **************************
24+
* cannot have a row header or a key in the data called "key"
25+
* ,ust have unique id
26+
* ****************************** */
27+
28+
function dataTable(props: any) {
29+
const { classes, rowData, rowHeader, deletePropHandler } = props;
30+
31+
const renderHeader = rowHeader.map((col: any, idx: number) => (
32+
<TableCell key={`head_+${idx}`}>{col}</TableCell>
33+
));
34+
35+
function renderRowCells(row: any) {
36+
if (!row) return;
37+
// for some reason we must put each value in a div.
38+
return rowHeader.map((header: string, idx: number) => (
39+
<TableCell align={"center"} key={`td_${idx}`}>
40+
{/* <div align={'center'} padding = {'none'} >{typeof row[header] === 'string' ? row[header] : row[header].toString()}</div> */}
41+
{/* {row[header]} */}
42+
{typeof row[header] === "string" ? row[header] : row[header].toString()}
43+
</TableCell>
44+
));
45+
}
46+
// style={{height: 30}}
47+
const renderRows = rowData.map((row: any) => (
48+
<TableRow key={`row-${row.id}`}>
49+
{renderRowCells(row)}
50+
<TableCell align={"center"} padding={"none"}>
51+
<IconButton
52+
color="default"
53+
fontSize="small"
54+
onClick={() => deletePropHandler(row.id)}
55+
>
56+
<DeleteIcon />
57+
</IconButton>
58+
{/* <Button style={{height: 20}} onClick={() => deletePropHandler(row.id)}>Delete</Button> */}
59+
</TableCell>
60+
</TableRow>
61+
));
62+
63+
return (
64+
<Paper className={classes.root}>
65+
<Table className={classes.table} selectable={"true"}>
66+
<TableHead>
67+
<TableRow>{renderHeader}</TableRow>
68+
</TableHead>
69+
<TableBody>{renderRows}</TableBody>
70+
</Table>
71+
</Paper>
72+
);
73+
}
74+
75+
export default withStyles(styles)(dataTable);

src/components/GrandchildRectangle.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import React, { Component } from 'react';
22
import { Rect, Group } from 'react-konva';
3-
// import findComponentById from '../utils/findComponentById.ts';
3+
import { ComponentsInt } from '../utils/interfaces';
44

55
class GrandchildRectangle extends Component {
66
state = {
77
imageHeight: 0,
88
imageWidth: 0,
99
};
1010

11-
getComponentColor(componentId) {
12-
// const color = findComponentById(componentId, this.props.components).color;
11+
getComponentColor(componentId: number) {
1312
const color = this.props.components.find(comp => comp.id === componentId).color;
1413
return color;
1514
}

src/components/HTMLComponentPanel.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
import React, { Component } from "react";
2-
import { connect } from "react-redux";
3-
import { compose } from "redux";
42
import { withStyles } from "@material-ui/core/styles";
5-
// import TextField from '@material-ui/core/TextField';
63
import IconButton from "@material-ui/core/IconButton";
74
import ImageIcon from "@material-ui/icons/Image";
85
import FormIcon from "@material-ui/icons/Description";
96
import ButtonIcon from "@material-ui/icons/EditAttributes";
107
import LinkIcon from "@material-ui/icons/Link";
118
import ListIcon from "@material-ui/icons/List";
129
import ParagraphIcon from "@material-ui/icons/LocalParking";
13-
// import Typography from '@material-ui/core/Typography';
1410
import Grid from "@material-ui/core/Grid";
15-
// import Paper from '@material-ui/core/Paper';
1611
import Tab from "@material-ui/core/Tab";
1712
import Chip from "@material-ui/core/Chip";
18-
// import theme from './theme.ts';
13+
1914

2015
interface PropsInt {
2116
classes: any;

0 commit comments

Comments
 (0)