Skip to content

Commit e85290b

Browse files
ChristianEdwardPadillatolgamizrakcispincycle01ShlomoPorges
committed
merge util files
util Co-authored-by: Tolga Mizrakci <[email protected]> Co-authored-by: Adam Singer <[email protected]> Co-authored-by: Shlomo Porges <[email protected]>
1 parent 1777109 commit e85290b

File tree

7 files changed

+42
-18
lines changed

7 files changed

+42
-18
lines changed

src/components/LeftColExpansionPanel.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ const LeftColExpansionPanel = (props: any) => {
2525
} = props;
2626
const { title, id, color } = component;
2727

28+
// show a string of all direct parents. SO the user can gaze at it.
29+
const directParents = components
30+
.filter((comp: ComponentInt) => comp.childrenArray.some((child: ChildInt) => child.childComponentId === id))
31+
.map((comp: ComponentInt) => comp.title)
32+
.join(',');
33+
2834
function isFocused() {
2935
return focusComponent.id === id ? 'focused' : '';
3036
}

src/components/SimpleModal.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Button from '@material-ui/core/Button';
66
import IconButton from '@material-ui/core/IconButton';
77
import CloseIcon from '@material-ui/icons/Close';
88

9-
const styles = theme => ({
9+
const styles = (theme: any): any => ({
1010
paper: {
1111
position: 'absolute',
1212
width: 'auto',
@@ -28,7 +28,7 @@ const styles = theme => ({
2828
},
2929
});
3030

31-
const SimpleModal = (props) => {
31+
const SimpleModal = (props: any) => {
3232
const {
3333
classes,
3434
open,
@@ -76,12 +76,22 @@ const SimpleModal = (props) => {
7676
<div>{children}</div>
7777
<div>
7878
{secBtnLabel ? (
79-
<Button variant="contained" color="secondary" className={classes.button} onClick={secBtnAction}>
79+
<Button
80+
variant="contained"
81+
color="secondary"
82+
className={classes.button}
83+
onClick={secBtnAction}
84+
>
8085
{secBtnLabel}
8186
</Button>
8287
) : null}
8388
{primBtnLabel ? (
84-
<Button variant="contained" color="primary" className={classes.button} onClick={primBtnAction}>
89+
<Button
90+
variant="contained"
91+
color="primary"
92+
className={classes.button}
93+
onClick={primBtnAction}
94+
>
8595
{primBtnLabel}
8696
</Button>
8797
) : null}

src/components/TransformerComponent.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import React, { Component } from 'react';
22
import { Transformer } from 'react-konva';
3-
import { ChildInt } from '../utils/interfaces';
3+
import { ChildInt } from '../utils/interfaces.ts';
44

5-
export default class TransformerComponent extends Component {
5+
interface PropsInt {
6+
focusChild: ChildInt;
7+
}
8+
9+
export default class TransformerComponent extends Component<PropsInt> {
610
componentDidMount() {
711
this.checkNode();
812
}

src/components/theme.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ import { createMuiTheme } from '@material-ui/core/styles';
22
import indigo from '@material-ui/core/colors/indigo';
33

44
const theme = createMuiTheme({
5+
typography: {
6+
useNextVariants: true,
7+
},
58
palette: {
69
primary: {
710
light: '#00e676',
8-
main: '#33eb91',
11+
// main: '#33eb91',
12+
main: '#01d46d', // less blinding green
913
dark: '#14a37f',
1014
contrastText: '#fff',
1115
},

src/containers/AppContainer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class AppContainer extends Component<Props> {
4848
<div className="app-container">
4949
<LeftContainer
5050
components={components}
51+
totalComponents={totalComponents}
5152
focusComponent={focusComponent}
5253
selectableChildren={selectableChildren}
5354
/>

src/containers/LeftContainer.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class LeftContainer extends Component<PropsInt, StateInt> {
8787
}
8888

8989
handleChange = (event: any) => {
90-
let newValue: string = event.target.value;
90+
const newValue: string = event.target.value;
9191
this.setState({
9292
componentName: newValue,
9393
});
@@ -169,10 +169,8 @@ class LeftContainer extends Component<PropsInt, StateInt> {
169169
render(): JSX.Element {
170170
const {
171171
components,
172-
updateComponent,
173172
deleteComponent,
174173
focusComponent,
175-
totalComponents,
176174
classes,
177175
addChild,
178176
changeFocusComponent,
@@ -194,6 +192,8 @@ class LeftContainer extends Component<PropsInt, StateInt> {
194192
changeFocusComponent={changeFocusComponent}
195193
changeFocusChild={changeFocusChild}
196194
selectableChildren={selectableChildren}
195+
deleteComponent={deleteComponent}
196+
components={components}
197197
/>
198198
));
199199

@@ -260,7 +260,7 @@ class LeftContainer extends Component<PropsInt, StateInt> {
260260
color="secondary"
261261
aria-label="Delete All"
262262
variant="contained"
263-
fullwidth="true"
263+
fullWidth
264264
onClick={this.clearWorkspace}
265265
disabled={this.props.components.length === 1}
266266
className={classes.clearButton}
@@ -278,12 +278,11 @@ class LeftContainer extends Component<PropsInt, StateInt> {
278278
>
279279
<Button
280280
color="primary"
281+
aria-label="Export Code"
281282
variant="contained"
282-
fullwidth="true"
283+
fullWidth
283284
onClick={this.showGenerateAppModal}
284285
className={classes.clearButton}
285-
disabled={totalComponents < 1}
286-
onClick={this.showGenerateAppModal}
287286
style={{ borderRadius: 0 }}
288287
>
289288
<GetAppIcon style={{ paddingRight: '5px' }} />

src/reducers/componentReducer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import {
4646
} from '../utils/componentReducer.util.ts';
4747
import cloneDeep from '../utils/cloneDeep.ts';
4848

49-
const appComponent = {
49+
const appComponent: ComponentInt = {
5050
id: 1,
5151
stateful: false,
5252
title: 'App',
@@ -64,7 +64,7 @@ const appComponent = {
6464
focusChildId: 0,
6565
};
6666

67-
const initialApplicationFocusChild = {
67+
const initialApplicationFocusChild: ChildInt = {
6868
childId: 0,
6969
componentName: null,
7070
position: {
@@ -81,7 +81,7 @@ const initialApplicationFocusChild = {
8181
HTMLInfo: null,
8282
};
8383

84-
const initialApplicationState = {
84+
const initialApplicationState: ApplicationStateInt = {
8585
totalComponents: 1,
8686
nextId: 2,
8787
successOpen: false,
@@ -96,7 +96,7 @@ const initialApplicationState = {
9696
loading: false,
9797
};
9898

99-
const componentReducer = (state = initialApplicationState, action) => {
99+
const componentReducer = (state = initialApplicationState, action: any) => {
100100
switch (action.type) {
101101
case LOAD_INIT_DATA:
102102
return {

0 commit comments

Comments
 (0)