Skip to content

Commit dec8662

Browse files
author
jasonford
committed
added todo
1 parent 8ac3623 commit dec8662

File tree

3 files changed

+52
-39
lines changed

3 files changed

+52
-39
lines changed

TODO.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
doubleclick to add in place
2+
drop to move to place
3+
edit metadata of element after holding it
4+
tap child to focus completely
5+
update breadcrumbs
6+
clicking breadcrumbs refocuses
7+
add child types:
8+
TreeChart
9+
Progress
10+
Link
11+
HTML

src/TreeChart.js

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,9 @@ import firebase from 'firebase';
33
import ReactFireMixin from 'reactfire';
44
import BreadCrumbs from './BreadCrumbs.js';
55
import TreeChartChild from './TreeChartChild.js';
6+
import makeRows from './makeRows.js'
67
import './TreeChart.css';
78

8-
function makeRows(items) {
9-
// get total importance so we have a metric for the average row importance
10-
let totalImportance = 0;
11-
items.forEach((item)=>{
12-
totalImportance += item.importance;
13-
});
14-
15-
// for a square viewport, ideally a the square of the total importance will be the average importance of a row
16-
let averageRowImportance = Math.pow(totalImportance, 1/2)
17-
18-
let currentRow = {
19-
importance : 0,
20-
height : 0,
21-
columns : []
22-
};
23-
24-
let rows = [currentRow];
25-
items.forEach((item, index) => {
26-
27-
// add item to row and update row properties
28-
currentRow.columns.push(item);
29-
currentRow.importance += item.importance;
30-
currentRow.totalImportance = totalImportance;
31-
currentRow.height = currentRow.importance/totalImportance*100 + '%';
32-
33-
// decide to advance to next row or not
34-
// biased toward accepting more on a row (screens usually wider than tall)
35-
if (currentRow.importance > averageRowImportance && index < items.length - 1) {
36-
currentRow = {
37-
importance : 0,
38-
columns : [],
39-
height : 0
40-
}
41-
rows.push(currentRow);
42-
}
43-
});
44-
return rows;
45-
}
46-
479
let TreeChart = React.createClass({
4810
mixins : [ReactFireMixin],
4911
componentWillMount() {

src/makeRows.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
function makeRows(items) {
2+
// get total importance so we have a metric for the average row importance
3+
let totalImportance = 0;
4+
items.forEach((item)=>{
5+
totalImportance += item.importance;
6+
});
7+
8+
// for a square viewport, ideally a the square of the total importance will be the average importance of a row
9+
let averageRowImportance = Math.pow(totalImportance, 1/2)
10+
11+
let currentRow = {
12+
importance : 0,
13+
height : 0,
14+
columns : []
15+
};
16+
17+
let rows = [currentRow];
18+
items.forEach((item, index) => {
19+
20+
// add item to row and update row properties
21+
currentRow.columns.push(item);
22+
currentRow.importance += item.importance;
23+
currentRow.totalImportance = totalImportance;
24+
currentRow.height = currentRow.importance/totalImportance*100 + '%';
25+
26+
// decide to advance to next row or not
27+
// biased toward accepting more on a row (screens usually wider than tall)
28+
if (currentRow.importance > averageRowImportance && index < items.length - 1) {
29+
currentRow = {
30+
importance : 0,
31+
columns : [],
32+
height : 0
33+
}
34+
rows.push(currentRow);
35+
}
36+
});
37+
return rows;
38+
}
39+
40+
export default makeRows;

0 commit comments

Comments
 (0)