Skip to content

Commit bb605c3

Browse files
committed
2 parents d1d7ddd + a157dde commit bb605c3

File tree

6 files changed

+194
-96
lines changed

6 files changed

+194
-96
lines changed

src/components/BottomPanel.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { connect } from 'react-redux';
33
import { handleClose, deleteProp, addProp } from '../actions/components';
44
import BottomTabs from './BottomTabs';
55
import { PropsInt, PropInt } from '../utils/Interfaces';
6+
import { changeFocusComponent } from '../utils/componentReducer.util';
67

78
const IPC = require('electron').ipcRenderer;
89

@@ -20,11 +21,19 @@ const mapStateToProps = (store: any) => ({
2021
interface BottomPanelPropsInt extends PropsInt {
2122
deleteProp(id: number): void;
2223
addProp(prop: PropInt): void;
24+
changeFocusComponent(arg: { title: string }): void;
2325
}
2426

2527
class BottomPanel extends Component<BottomPanelPropsInt> {
2628
render() {
27-
const { components, focusComponent, deleteProp, addProp, focusChild } = this.props;
29+
const {
30+
components,
31+
focusComponent,
32+
deleteProp,
33+
addProp,
34+
focusChild,
35+
changeFocusComponent
36+
} = this.props;
2837

2938
return (
3039
<div className="bottom-panel" style={{ width: '100%' }}>
@@ -34,6 +43,7 @@ class BottomPanel extends Component<BottomPanelPropsInt> {
3443
deleteProp={deleteProp}
3544
addProp={addProp}
3645
focusChild={focusChild}
46+
changeFocusComponent={changeFocusComponent}
3747
/>
3848
</div>
3949
);

src/components/BottomTabs.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ interface BottomTabsPropsInt extends PropsInt {
1818
deleteProp(id: number): void;
1919
addProp(prop: PropInt): void;
2020
classes: any;
21+
changeFocusComponent(arg: { title: string }): void;
2122
}
2223

2324
// interface TreeInt {
@@ -108,6 +109,10 @@ class BottomTabs extends Component<BottomTabsPropsInt, StateInt> {
108109
this.setState({ value });
109110
};
110111

112+
handleClick = (event: any, node: any) => {
113+
this.props.changeFocusComponent({ title: event.name });
114+
};
115+
111116
generateComponentTree(componentId: number, components: ComponentsInt) {
112117
const component = components.find(comp => comp.id === componentId);
113118
const tree: any = { name: component.title, attributes: {}, children: [] };
@@ -195,6 +200,7 @@ class BottomTabs extends Component<BottomTabsPropsInt, StateInt> {
195200
separation={{ siblings: 0.3, nonSiblings: 0.3 }}
196201
transitionDuration={0}
197202
translate={this.state.translate}
203+
onClick={this.handleClick}
198204
styles={{
199205
nodes: {
200206
node: {

0 commit comments

Comments
 (0)