From 554842a3fb34f9eec7fda462d5a159e1a21e6bb6 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Sun, 13 Apr 2014 22:32:36 -0700 Subject: [PATCH] First stab of React based app. 2/3rds of the panel are stubbed out. --- static/index.html | 2 ++ static/js/app.js | 15 +++++++++++ static/js/folder.js | 64 +++++++++++++++++++++++++++++++++++++++++++++ static/js/unread.js | 18 ++++++++----- 4 files changed, 92 insertions(+), 7 deletions(-) create mode 100644 static/js/app.js create mode 100644 static/js/folder.js diff --git a/static/index.html b/static/index.html index 75796a3..47eda7c 100755 --- a/static/index.html +++ b/static/index.html @@ -173,5 +173,7 @@ + + diff --git a/static/js/app.js b/static/js/app.js new file mode 100644 index 0000000..ff6272b --- /dev/null +++ b/static/js/app.js @@ -0,0 +1,15 @@ +/** @jsx React.DOM */ + +var App = React.createClass({ + render: function() { + return React.DOM.div({className: ''}); + } +}); + +React.renderComponent( + React.DOM.div({id: 'layout', className: 'content pure-g'}, + , + // TODO make '[all]' be set by clicking folders. + ), + $('body').get(0) +); diff --git a/static/js/folder.js b/static/js/folder.js new file mode 100644 index 0000000..6f95062 --- /dev/null +++ b/static/js/folder.js @@ -0,0 +1,64 @@ +/** @jsx React.DOM */ + +/* + +*/ + +var FolderView = React.createClass({ + getInitialState: function() { + return { + list: {} + }; + }, + + componentDidMount: function() { + $.get(this.props.source, function(result) { + console.log('FolderView $.get', result); + this.setState({list: result}); + }.bind(this)); + }, + + render: function() { + // TODO: + // - fill this out with data + // - make unread conditional + // - remove profile pic + // - drop message excerpt + // - trim 'Re:' from messages and group/thread them. + return ( +
+
+
+ Tilo Mitra's avatar +
+ +
+
Tilo Mitra
+

Hello from Toronto

+

+ Hey, I just wanted to check in with you from Toronto. I got here earlier today. +

+
+
+
+); + } +}); + +React.renderComponent( + // TODO make '[all]' be set by clicking folders. + , + $('#list').get(0) +); diff --git a/static/js/unread.js b/static/js/unread.js index 18ccffd..7f3a3f2 100644 --- a/static/js/unread.js +++ b/static/js/unread.js @@ -1,5 +1,7 @@ /** @jsx React.DOM */ +// TODO rename this nav. + var UnreadCount = React.createClass({ getInitialState: function() { return { @@ -9,7 +11,7 @@ var UnreadCount = React.createClass({ componentDidMount: function() { $.get(this.props.source, function(result) { - console.log('$.get', result); + console.log('UnreadCount $.get', result); this.setState({unreadCount: result}); }.bind(this)); }, @@ -28,11 +30,13 @@ var UnreadCount = React.createClass({ lis.push(dom); } console.log('Found', lis); - return React.DOM.ul({}, lis); + // TODO rewrite as JSX template? How to handle repreating fields? + return React.DOM.div({id: 'nav', className: 'pure-u'}, + React.DOM.div({className: 'nav-inner'}, + React.DOM.div({ + id: 'unread-list', + className: 'pure-menu pure-menu-open' + }, React.DOM.ul({}, + lis)))); } }); - -React.renderComponent( - , - $('#unread-list').get(0) -);