Skip to content

Commit 7334768

Browse files
author
jasonford
committed
cleanup
1 parent 6ea6a9b commit 7334768

File tree

6 files changed

+27
-88
lines changed

6 files changed

+27
-88
lines changed

TODO.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ order from below:
1212
X progress metadata
1313
X email user auth
1414
X typing outside of input selects child in current view that starts with that title
15-
sensible rendering of progress (child progress takes presidence over own reported progress)
16-
different color for own progress and show blocks for combined progress??
1715
user root nodes
1816
note metadata
1917
visual feedback for add right/left, edit and drag into
2018
move elements between levels of hierarchy
2119
dropping in middle of child copies element into that element
2220
dropping on a breadcrumb copies dropped element into that parent (or copies within current)
23-
21+
types
2422

2523
Metadata for each node:
2624
X title

src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ let App = React.createClass({
77
}
88
})
99

10-
export default App;
10+
export default App;

src/TreeChart.css

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
right : 0;
99
bottom : 0;
1010
overflow: hidden;
11-
background: rgba(128,128,128,0.05);
11+
background: white;
1212
color : #444444;
1313
font-family: Helvetica, sans-serif;
1414
}
@@ -19,8 +19,12 @@
1919
display : flex;
2020
flex-flow: row;
2121
justify-content: space-between;
22+
box-shadow: 0px 0px 5px #888888;
23+
background: white;
24+
z-index: 1;
2225
}
2326

27+
2428
.TreeChartChildren
2529
{
2630
width : 100%;
@@ -40,7 +44,6 @@
4044
min-width : 1px;
4145
position: relative;
4246
overflow: hidden;
43-
background: rgba(128,128,128,0.01);
4447
}
4548

4649
.TreeChartRowDivider
@@ -53,6 +56,7 @@
5356
.TreeChartChild
5457
{
5558
transition: flex-grow 0.3s, height 0.3s;
59+
background : white;
5660
}
5761

5862
.TreeChartChildInner,
@@ -67,14 +71,15 @@
6771
flex-direction: column;
6872
justify-content: center;
6973
align-items: center;
74+
background : #EEEEEE;
7075
}
7176

72-
.TreeChartChildTitle.Top { top : 0;}
73-
.TreeChartChildTitle.Left { left : 0;}
74-
.TreeChartChildTitle.Right { right : 0; }
75-
.TreeChartChildTitle.Bottom { bottom : 0; }
77+
.TreeChartChildInner.Top { top : 0;}
78+
.TreeChartChildInner.Left { left : 0;}
79+
.TreeChartChildInner.Right { right : 0; }
80+
.TreeChartChildInner.Bottom { bottom : 0; }
7681

77-
.TreeChartChildTitle
82+
.TreeChartChildInner
7883
{
7984
left : 1px;
8085
top : 1px;

src/TreeChart.js

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ let TreeChart = React.createClass({
122122
title : null,
123123
index : index,
124124
importance : 1,
125-
progress : null,
125+
type : 'TreeChart',
126126
notes : '',
127127
elements : []
128128
});
@@ -232,6 +232,7 @@ let TreeChart = React.createClass({
232232
childIndex={childIndex}
233233
move={self.moveChild}
234234
remove={remove}/>);
235+
235236
childIndex += 1;
236237
});
237238
});
@@ -241,7 +242,8 @@ let TreeChart = React.createClass({
241242
}
242243

243244
let header = <div className="TreeChartHeader">
244-
<BreadCrumbs focus={this.focus} path={this.state.focus || this.state.path}/>
245+
<BreadCrumbs focus={this.focus}
246+
path={this.state.focus || this.state.path}/>
245247
<div className="TreeChartLogin">
246248
<LoginTag />
247249
</div>
@@ -253,46 +255,8 @@ let TreeChart = React.createClass({
253255
{this.state.editing && !this.props.preview ? <TreeChartChildEditor path={this.state.editing} remove={stopEditing}/> : null}
254256
{childElements}
255257
</div>
256-
<ProgressBar path={this.props.path} depth={this.depth()}/>
257258
</div>;
258259
}
259260
});
260261

261-
262-
263-
let ProgressBar = React.createClass({
264-
mixins : [ReactFireMixin],
265-
componentWillMount() {
266-
this.setState({
267-
path : this.props.path,
268-
focus : this.props.path,
269-
element : { // start with empty element designed to show loading
270-
elements : {}
271-
}
272-
});
273-
let ref = firebase.database().ref(this.props.path);
274-
this.bindAsObject(ref, "element");
275-
},
276-
render() {
277-
let parts = [];
278-
if (!isNaN(this.state.element.progress)) {
279-
let style = {
280-
width : this.state.element.progress + '%'
281-
};
282-
parts.push(<div className="TreeChartProgressBarPart" style={style} key={this.props.path}></div>)
283-
}
284-
else {
285-
286-
}
287-
let style = {
288-
height : this.props.depth === 0 || this.props.depth === 1 ? '16px' : 0
289-
};
290-
return <div ref="progressBar" style={style} className="TreeChartProgressBar" key={this.props.path}>
291-
{parts}
292-
</div>
293-
}
294-
});
295-
296-
297-
298262
export default TreeChart;

src/TreeChartChild.js

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -79,27 +79,15 @@ let TreeChartChild = React.createClass({
7979
};
8080
}
8181

82-
let titleClasses = "TreeChartChildTitle";
83-
if (this.props.location.top ) titleClasses += " Top";
84-
if (this.props.location.left ) titleClasses += " Left";
85-
if (this.props.location.right ) titleClasses += " Right";
86-
if (this.props.location.bottom) titleClasses += " Bottom";
87-
88-
let content;
89-
if (this.props.focused) {
90-
content = <div className={titleClasses}>
91-
<TreeChart path={this.props.path} isChild={true} focus={this.props.focus} depth={this.props.depth} />
92-
</div>
93-
}
94-
else {
95-
content = <div className={titleClasses}>
96-
<TreeChart path={this.props.path} preview={true} isChild={true} focus={this.props.focus} depth={this.props.depth}/>
97-
</div>
98-
}
82+
let innerClasses = "TreeChartChildInner";
83+
if (this.props.location.top ) innerClasses += " Top";
84+
if (this.props.location.left ) innerClasses += " Left";
85+
if (this.props.location.right ) innerClasses += " Right";
86+
if (this.props.location.bottom) innerClasses += " Bottom";
9987

10088
return <div ref="root" className="TreeChartChild" style={style}>
101-
<div className="TreeChartChildInner">
102-
{content}
89+
<div className={innerClasses}>
90+
<TreeChart path={this.props.path} preview={!this.props.focused} isChild={true} focus={this.props.focus} depth={this.props.depth}/>
10391
{this.props.focused || this.props.preview ? null : <div className="TreeChartChildTitle">{this.state.element.title || this.props.childIndex+1}</div>}
10492
</div>
10593
</div>

src/TreeChartChildEditor.js

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,12 @@ import React from 'react';
22
import firebase from 'firebase';
33
import ReactFireMixin from 'reactfire';
44

5-
let types = ['none', 'TreeChart', 'Progress', 'Link', 'HTML'];
5+
let types = ['TreeChart', 'Task', 'Link', 'HTML'];
66

77
let TreeChartChildEditor = React.createClass({
88
mixins : [ReactFireMixin],
99
componentWillMount() {
10-
this.setState({
11-
path : this.props.path,
12-
element : {
13-
importance : 0
14-
}
15-
});
10+
this.setState({path : this.props.path});
1611
let ref = firebase.database().ref(this.props.path).orderByChild("index");
1712
this.bindAsObject(ref, "element");
1813
},
@@ -41,10 +36,6 @@ let TreeChartChildEditor = React.createClass({
4136
}
4237
},
4338
render() {
44-
let progressEnabled = this.state.element.progress === 0 || this.state.element.progress > 0;
45-
let progressBar = <span>
46-
<input type="range" onChange={this.update('progress', parseInt)} value={this.state.element.progress}/>{this.state.element.progress}
47-
</span>
4839
return <div ref="root" className="TreeChartChildEditor">
4940
<input type="text" className="TreeChartChildEditorTitle" value={this.state.element.title} onChange={this.update('title')}/>
5041
<select className="TreeChartChildEditorImportance" default={this.state.element.importance} value={this.state.element.importance} onChange={this.update('importance', parseInt)}>
@@ -57,13 +48,6 @@ let TreeChartChildEditor = React.createClass({
5748
onChange={this.update('type')}>
5849
{types.map((type)=>{return <option key={type} value={type}>{type}</option>})}
5950
</select>
60-
<div>
61-
<input
62-
type="checkbox"
63-
checked={progressEnabled}
64-
onChange={this.update('progress', (val)=>{return val ? 0 : null})}/>
65-
{progressEnabled ? progressBar : null}
66-
</div>
6751
</div>;
6852
}
6953
});

0 commit comments

Comments
 (0)