diff --git a/js/app.js b/js/app.js index a052f804c..1c3a6fa7f 100644 --- a/js/app.js +++ b/js/app.js @@ -4,14 +4,11 @@ var App = React.createClass({ var match, param, val, viewingPage, drawerOpenRaw = sessionStorage.getItem('drawerOpen'); - [match, param, val] = window.location.search.match(/\??([^=]*)(?:=(.*))?/); + [match, viewingPage, val] = window.location.search.match(/\??([^=]*)(?:=(.*))?/); - if (param && ['settings', 'discover', 'help', 'start', 'watch', 'report', 'files', 'claim', 'show', 'wallet', 'publish'].indexOf(param) != -1) { - viewingPage = param; - } return { - viewingPage: viewingPage ? viewingPage : 'discover', + viewingPage: viewingPage, drawerOpen: drawerOpenRaw !== null ? JSON.parse(drawerOpenRaw) : true, pageArgs: val, }; @@ -72,12 +69,28 @@ var App = React.createClass({ pageArgs: term }); }, + getHeaderLinks: function() + { + switch(this.state.viewingPage) + { + case 'wallet': + case 'send': + case 'receive': + case 'claim': + return { + '?wallet' : 'Overview', + '?send' : 'Send', + '?receive' : 'Receive', + '?claim' : 'Claim Beta Code' + }; + default: + return null; + } + }, getMainContent: function() { switch(this.state.viewingPage) { - case 'discover': - return ; case 'settings': return ; case 'help': @@ -93,23 +106,33 @@ var App = React.createClass({ case 'claim': return ; case 'wallet': - return ; + case 'send': + case 'receive': + return ; + case 'send': + return ; + case 'receive': + return ; case 'show': return ; case 'publish': return ; + case 'discover': + default: + return ; } }, render: function() { - var mainContent = this.getMainContent(); + var mainContent = this.getMainContent(), + headerLinks = this.getHeaderLinks(); return ( this.state.viewingPage == 'watch' ? mainContent :
-
-
+
+
{mainContent}
diff --git a/js/component/common.js b/js/component/common.js index 9a5fd57e4..861685fa5 100644 --- a/js/component/common.js +++ b/js/component/common.js @@ -77,9 +77,10 @@ var CurrencySymbol = React.createClass({ var CreditAmount = React.createClass({ propTypes: { amount: React.PropTypes.number, + precision: React.PropTypes.number }, render: function() { - var formattedAmount = lbry.formatCredits(this.props.amount); + var formattedAmount = lbry.formatCredits(this.props.amount, this.props.precision ? this.props.precision : 1); return ( {formattedAmount} {parseFloat(formattedAmount) == 1.0 ? 'credit' : 'credits'} diff --git a/js/component/header.js b/js/component/header.js index 38ea57a40..4022f4019 100644 --- a/js/component/header.js +++ b/js/component/header.js @@ -44,14 +44,41 @@ var Header = React.createClass({ }, render: function() { return ( -