Skip to content

Stable MVP version #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Apr 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a304ca2
No changes that I know of, probably space or something
ShlomoPorges Apr 22, 2019
657a804
Merge branch 'development' of https://github.com/team-reactype/ReacTy…
ShlomoPorges Apr 22, 2019
9dcaddd
Merge branch 'development' of https://github.com/team-reactype/ReacTy…
ShlomoPorges Apr 22, 2019
efd8c51
No real changes, maybe SPACE or god knows what
ShlomoPorges Apr 23, 2019
8a1fe72
Merge branch 'development' of https://github.com/team-reactype/ReacTy…
ShlomoPorges Apr 23, 2019
cc22040
not sure ehat i changed
ShlomoPorges Apr 23, 2019
dc18e63
no real changes..
ShlomoPorges Apr 23, 2019
89b41c3
just pulled from upstream
ShlomoPorges Apr 23, 2019
2926623
..
ShlomoPorges Apr 23, 2019
9c1fa2b
naive recursive rendering working
ChristianEdwardPadilla Apr 23, 2019
b00cb19
Merge branch 'development' of https://github.com/team-reactype/ReacTy…
ChristianEdwardPadilla Apr 23, 2019
43d9f00
Added DELETE child (action, reducer, button, logic)
ShlomoPorges Apr 23, 2019
60cb036
recursive rendering changes, and new children are offset
ChristianEdwardPadilla Apr 23, 2019
c31cec3
Merge pull request #32 from ShlomoPorges/development
ChristianEdwardPadilla Apr 23, 2019
9b0dc2b
merged with Shlomo delete button
ChristianEdwardPadilla Apr 23, 2019
f4d0b9f
better recursive rendering, size is relative to canvas size. Shoube r…
ChristianEdwardPadilla Apr 23, 2019
d2446e1
added local state to KonvaStage to keep track of size of inner column…
ChristianEdwardPadilla Apr 24, 2019
ae5ec91
delete component added
ShlomoPorges Apr 24, 2019
496b82e
Merge pull request #33 from ShlomoPorges/development
ShlomoPorges Apr 24, 2019
af227d8
merged with Shlomo delete functionality
ChristianEdwardPadilla Apr 24, 2019
4621bd3
colors of recursive children are correct now
ChristianEdwardPadilla Apr 24, 2019
ac61fc2
added changeComponentFocusChild to reducers
ChristianEdwardPadilla Apr 24, 2019
88b455b
Merge pull request #34 from ChristianEdwardPadilla/development
ShlomoPorges Apr 24, 2019
737e122
WHen change focus compoenet grab the focus child from components array
ShlomoPorges Apr 24, 2019
75e799f
fixed change focus component
ShlomoPorges Apr 24, 2019
8ad8eed
Merge pull request #35 from ShlomoPorges/development
ChristianEdwardPadilla Apr 24, 2019
39f7705
added placeholder componentRect, changed styling of transformer
ChristianEdwardPadilla Apr 25, 2019
0fe1f5c
transformer changes
ChristianEdwardPadilla Apr 25, 2019
1dba2e5
Merge pull request #36 from ChristianEdwardPadilla/development
ChristianEdwardPadilla Apr 25, 2019
f95cd70
bottom props panel first iteration
Apr 25, 2019
5905db4
Merge pull request #37 from tolgamizrakci/development
tolgamizrakci Apr 25, 2019
b9f4ed4
no real change
ShlomoPorges Apr 25, 2019
20cd369
got rid of conflict. my mistake
ShlomoPorges Apr 25, 2019
1c045cc
added colors AND initial value 4 app NextPropID
ShlomoPorges Apr 25, 2019
b30c641
Merge pull request #38 from ShlomoPorges/development
ShlomoPorges Apr 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 28 additions & 26 deletions src/actionTypes/index.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
export const LOAD_INIT_DATA = "LOAD_INIT_DATA";
export const ADD_COMPONENT = "ADD_COMPONENT";
export const ADD_CHILD = "ADD_CHILD";
export const UPDATE_COMPONENT = "UPDATE_COMPONENT";
export const DELETE_COMPONENT = "DELETE_COMPONENT";
export const CHANGE_FOCUS_COMPONENT = "CHANGE_FOCUS_COMPONENT";
export const CHANGE_FOCUS_CHILD = "CHANGE_FOCUS_CHILD";
export const UPDATE_CHILDREN = "UPDATE_CHILDREN";
export const REASSIGN_PARENT = "REASSIGN_PARENT";
export const SET_SELECTABLE_PARENTS = "SET_SELECTABLE_PARENTS";
export const EXPORT_FILES = "EXPORT_FILES";
export const EXPORT_FILES_SUCCESS = "EXPORT_FILES_SUCCESS";
export const EXPORT_FILES_ERROR = "EXPORT_FILES_ERROR";
export const HANDLE_CLOSE = "HANDLE_CLOSE";
export const HANDLE_TRANSFORM = "HANDLE_TRANSFORM";
export const CREATE_APPLICATION = "CREATE_APPLICATION";
export const CREATE_APPLICATION_SUCCESS = "CREATE_APPLICATION_SUCCESS";
export const CREATE_APPLICATION_ERROR = "CREATE_APPLICATION_ERROR";
export const TOGGLE_DRAGGING = "TOGGLE_DRAGGING";
export const MOVE_TO_BOTTOM = "MOVE_TO_BOTTOM";
export const MOVE_TO_TOP = "MOVE_TO_TOP";
export const OPEN_EXPANSION_PANEL = "OPEN_EXPANSION_PANEL";
export const DELETE_PROP = "DELETE_PROP";
export const ADD_PROP = "ADD_PROP";
export const DELETE_ALL_DATA = "DELETE_ALL_DATA";
export const CHANGE_IMAGE_PATH = "CHANGE_IMAGE_PATH";
export const LOAD_INIT_DATA = 'LOAD_INIT_DATA';
export const ADD_COMPONENT = 'ADD_COMPONENT';
export const ADD_CHILD = 'ADD_CHILD';
export const DELETE_CHILD = 'DELETE_CHILD';
export const UPDATE_COMPONENT = 'UPDATE_COMPONENT';
export const DELETE_COMPONENT = 'DELETE_COMPONENT';
export const CHANGE_FOCUS_COMPONENT = 'CHANGE_FOCUS_COMPONENT';
export const CHANGE_COMPONENT_FOCUS_CHILD = 'CHANGE_COMPONENT_FOCUS_CHILD';
export const CHANGE_FOCUS_CHILD = 'CHANGE_FOCUS_CHILD';
export const UPDATE_CHILDREN = 'UPDATE_CHILDREN';
export const REASSIGN_PARENT = 'REASSIGN_PARENT';
export const SET_SELECTABLE_PARENTS = 'SET_SELECTABLE_PARENTS';
export const EXPORT_FILES = 'EXPORT_FILES';
export const EXPORT_FILES_SUCCESS = 'EXPORT_FILES_SUCCESS';
export const EXPORT_FILES_ERROR = 'EXPORT_FILES_ERROR';
export const HANDLE_CLOSE = 'HANDLE_CLOSE';
export const HANDLE_TRANSFORM = 'HANDLE_TRANSFORM';
export const CREATE_APPLICATION = 'CREATE_APPLICATION';
export const CREATE_APPLICATION_SUCCESS = 'CREATE_APPLICATION_SUCCESS';
export const CREATE_APPLICATION_ERROR = 'CREATE_APPLICATION_ERROR';
export const TOGGLE_DRAGGING = 'TOGGLE_DRAGGING';
export const MOVE_TO_BOTTOM = 'MOVE_TO_BOTTOM';
export const MOVE_TO_TOP = 'MOVE_TO_TOP';
export const OPEN_EXPANSION_PANEL = 'OPEN_EXPANSION_PANEL';
export const DELETE_PROP = 'DELETE_PROP';
export const ADD_PROP = 'ADD_PROP';
export const DELETE_ALL_DATA = 'DELETE_ALL_DATA';
export const CHANGE_IMAGE_PATH = 'CHANGE_IMAGE_PATH';
73 changes: 54 additions & 19 deletions src/actions/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import {
LOAD_INIT_DATA,
ADD_COMPONENT,
ADD_CHILD,
DELETE_CHILD,
UPDATE_COMPONENT,
DELETE_COMPONENT,
CHANGE_FOCUS_COMPONENT,
CHANGE_FOCUS_CHILD,
CHANGE_COMPONENT_FOCUS_CHILD,
UPDATE_CHILDREN,
REASSIGN_PARENT,
SET_SELECTABLE_PARENTS,
Expand Down Expand Up @@ -63,24 +65,47 @@ export const parentReassignment = ({ index, id, parentIds }) => ({

export const addComponent = ({ title }) => dispatch => {
dispatch({ type: ADD_COMPONENT, payload: { title } });
// dispatch({ type: SET_SELECTABLE_PARENTS });
};

export const addChild = ({ title }) => dispatch => {
dispatch({ type: ADD_CHILD, payload: { title } });
// dispatch({ type: SET_SELECTABLE_PARENTS });
};

export const deleteComponent = ({ index, id, parentIds = [] }) => dispatch => {
if (parentIds.length) {
// Delete Component from its parent if it has a parent.
dispatch(updateChildren({ parentIds, childId: id, childIndex: index }));
}
// Reassign Component's children to its parent if it has one or make them orphans
dispatch(parentReassignment({ index, id, parentIds }));
export const deleteChild = ({}) => dispatch => {
// with no payload, it will delete focusd child
dispatch({ type: DELETE_CHILD, payload: {} });
};

dispatch({ type: DELETE_COMPONENT, payload: { index, id } });
dispatch({ type: SET_SELECTABLE_PARENTS });
export const deleteComponent = ({
componentId,
stateComponents
}) => dispatch => {
console.log(
"Hello from component.js delete component.componentId= ",
componentId
);

// find all places where the "to be delted" is a child and do what u gotta do
stateComponents.forEach(parent => {
parent.childrenArray
.filter(child => child.childComponentId == componentId)
.forEach(child => {
// console.log(`Should delete ${child.childId} from component id:${parent.id} ${parent.title}`)
dispatch({
type: DELETE_CHILD,
payload: {
parentId: parent.id,
childId: child.childId,
calledFromDeleteComponent: true
}
});
});
});

// change focus to APp
dispatch({ type: CHANGE_FOCUS_COMPONENT, payload: { title: "App" } });
// after taking care of the children delete the component
dispatch({ type: DELETE_COMPONENT, payload: { componentId } });
};

export const updateComponent = ({
Expand Down Expand Up @@ -123,6 +148,16 @@ export const changeFocusChild = ({ title, childId }) => dispatch => {
dispatch({ type: CHANGE_FOCUS_CHILD, payload: { title, childId } });
};

export const changeComponentFocusChild = ({
componentId,
childId
}) => dispatch => {
dispatch({
type: CHANGE_COMPONENT_FOCUS_CHILD,
payload: { componentId, childId }
});
};

// export const exportFiles = ({ components, path }) => (dispatch) => {
// dispatch({
// type: EXPORT_FILES,
Expand Down Expand Up @@ -214,12 +249,12 @@ export const openExpansionPanel = component => ({
// payload: path,
// });

// export const deleteCompProp = ({ id, index }) => ({
// type: DELETE_PROP,
// payload: { id, index },
// });
export const deleteProp = ({ id, index }) => ({
type: DELETE_PROP,
payload: { id, index }
});

// export const addCompProp = prop => ({
// type: ADD_PROP,
// payload: { ...prop },
// });
export const addProp = prop => ({
type: ADD_PROP,
payload: { ...prop }
});
86 changes: 86 additions & 0 deletions src/components/BottomPanel.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import React, { Component } from "react";
import { connect } from "react-redux";
// import PropTypes from 'prop-types';
import {
handleClose,
deleteCompProp,
addCompProp
} from "../actions/components";
// import Snackbars from '../components/Snackbars.jsx';
import RightTabs from "./RightTabs.jsx";

const IPC = require("electron").ipcRenderer;

const mapDispatchToProps = dispatch => ({
handleNotificationClose: () => dispatch(handleClose()),
deleteProp: ({ id, index }) => dispatch(deleteCompProp({ id, index })),
addProp: prop => dispatch(addCompProp(prop))
});

const mapStateToProps = store => ({
successOpen: store.workspace.successOpen,
errorOpen: store.workspace.errorOpen,
appDir: store.workspace.appDir
});

class BottomPanel extends Component {
state = {
successOpen: false,
errorOpen: false
};

viewAppDir = () => {
IPC.send("view_app_dir", this.props.appDir);
};

render() {
const {
components,
successOpen,
errorOpen,
handleNotificationClose,
appDir,
focusComponent,
deleteProp,
addProp
// rightColumnOpen
} = this.props;

return (
<div className="bottom-panel" style={{ width: "100%" }}>
<RightTabs
components={components}
focusComponent={focusComponent}
deleteProp={deleteProp}
addProp={addProp}
// rightColumnOpen={rightColumnOpen}
/>
{/* <Snackbars
successOpen={successOpen}
errorOpen={errorOpen}
handleNotificationClose={handleNotificationClose}
msg={appDir}
viewAppDir={this.viewAppDir}
/> */}
</div>
);
}
}

// RightContainer.propTypes = {
// components: PropTypes.array.isRequired,
// successOpen: PropTypes.bool.isRequired,
// appDir: PropTypes.string,
// errorOpen: PropTypes.bool.isRequired,
// focusComponent: PropTypes.object.isRequired,
// handleNotificationClose: PropTypes.func.isRequired,
// deleteProp: PropTypes.func.isRequired,
// addProp: PropTypes.func.isRequired,
// width: PropTypes.number.isRequired,
// rightColumnOpen: PropTypes.bool.isRequired,
// };

export default connect(
mapStateToProps,
mapDispatchToProps
)(BottomPanel);
76 changes: 73 additions & 3 deletions src/components/GrandchildRectangle.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,80 @@
import React, { Component, Fragment } from 'react';
import { Rect } from 'react-konva';
import React, { Component } from 'react';
import { Rect, Group } from 'react-konva';
// import PropTypes from 'prop-types';

class GrandchildRectangle extends Component {
getComponentColor(componentId) {
const color = this.props.components.find(comp => comp.id == componentId).color;
return color;
}

render() {
return <Rect />;
const {
x,
y,
scaleX,
scaleY,
childId,
componentId,
childComponentName,
childComponentId,
width,
height,
focusChild,
components,
} = this.props;

// the Group is responsible for dragging of all children
// the Rect emits changes to child width and height with help from Transformer
return (
<Group
draggable={false}
x={x}
y={y}
scaleX={scaleX}
scaleY={scaleY}
width={width}
height={height}
>
<Rect
name={`${childId}`}
x={0}
y={0}
// absolutePosition={{ x, y }}
// childId={childId}
componentId={componentId}
scaleX={1}
scaleY={1}
width={width}
height={height}
stroke={this.getComponentColor(childComponentId)}
// fill={color}
// opacity={0.8}
strokeWidth={4}
strokeScaleEnabled={false}
draggable={false}
/>
{components
.find(comp => comp.title === childComponentName)
.childrenArray.map((grandchild, i) => (
<GrandchildRectangle
key={i}
components={components}
componentId={componentId}
childComponentName={grandchild.componentName}
childComponentId={grandchild.childComponentId}
focusChild={focusChild}
// childId={grandchild.childId}
x={grandchild.position.x * (width / (window.innerWidth / 2))}
y={grandchild.position.y * (height / window.innerHeight)}
scaleX={1}
scaleY={1}
width={grandchild.position.width * (width / (window.innerWidth / 2))}
height={grandchild.position.height * (height / window.innerHeight)}
/>
))}
</Group>
);
}
}

Expand Down
Loading