Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First round of improvements #42

Merged
merged 11 commits into from
Sep 19, 2015
Merged
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ $ npm i
$ npm start
```

This launches the app and runs it in your menu bar. Click the IPFS icon to open a console. For example (in OSX):

![](https://ipfs.io/ipfs/QmU5AghSAezpYFNyuYZ7gX1zcHCheQndPtBMj1MHr5QpWL/cap.png)

# packaging

will be written to ./dist
Expand Down
2 changes: 0 additions & 2 deletions app/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,3 @@ var altMenu = require('./controls/alt-menu')
require('./controls/open-browser')
require('./controls/open-console')
require('./controls/open-settings')


7 changes: 4 additions & 3 deletions app/js/alt-menubar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,11 @@ var Menu = React.createClass({
{(_.map(self.state.stats, function (value, name) {
return (
<tr key={name}>
<td>{name}</td>
<td className='value'>{value}</td>
<td>{name}</td>
<td className='value'>{value}</td>
</tr>
)}))}
)
}))}
</table>
</div>
</div>
Expand Down
44 changes: 44 additions & 0 deletions app/js/components/files.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
var React = require('react')
var _ = require('lodash')

module.exports = React.createClass({
displayName: 'Files',

propTypes: {
values: React.PropTypes.object
},

getDefaultProps: function () {
return {
values: []
}
},

_renderFile (value, name) {
if (value.uploaded) {
var nameTrimmed = value.Name.slice(0, 10) + '...'
var hashTrimmed = value.Hash.slice(0, 6) + '...'
return (
<h5>{nameTrimmed} + {hashTrimmed}</h5>
)
}

return (
<div className='progress'>
<div className='progress-bar progress-bar-striped active' role='progressbar' aria-valuenow='100' aria-valuemin='0' aria-valuemax='100' style={{width: '100%'}}>
<span className='sr-only'>Uploading {value.Name}</span>
</div>
</div>
)
},

render () {
var self = this

return (
<div className='row'>
{_.map(self.props.values, self._renderFile)}
</div>
)
}
})
38 changes: 38 additions & 0 deletions app/js/components/open-links.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
var React = require('react')

module.exports = React.createClass({
displayName: 'OpenLinks',

propTypes: {
onConsoleClick: React.PropTypes.func,
onBrowserClick: React.PropTypes.func
},

getDefaultProps: function () {
return {
onConsoleClick: function () {},
onBrowserClick: function () {}
}
},

render () {
var self = this

return (
<div className='row panel panel-default'>
<div className='list-group'>
<a href='#'
className='list-group-item'
onClick={self.props.onConsoleClick}>
Open Console
</a>
<a href='#'
className='list-group-item'
onClick={self.props.onBrowserClick}>
Open in Browser
</a>
</div>
</div>
)
}
})
30 changes: 30 additions & 0 deletions app/js/components/quit.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
var React = require('react')

module.exports = React.createClass({
displayName: 'Quit',

propTypes: {
onClick: React.PropTypes.func
},

getDefaultProps: function () {
return {
onClick: function () {}
}
},

render () {
var self = this

return (
<div className='row'>
<div className='panel panel-default version'>
<a href='#'
onClick={self.props.onClick}>
Quit
</a>
</div>
</div>
)
}
})
30 changes: 30 additions & 0 deletions app/js/components/settings.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
var React = require('react')

module.exports = React.createClass({
displayName: 'Settings',

propTypes: {
onClick: React.PropTypes.func
},

getDefaultProps: function () {
return {
onClick: function () {}
}
},

render () {
var self = this

return (
<div className='row'>
<div className='panel panel-default version'>
<a href='#'
onClick={self.props.onClick}>
Settings
</a>
</div>
</div>
)
}
})
41 changes: 41 additions & 0 deletions app/js/components/stats.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
var React = require('react')
var _ = require('lodash')

module.exports = React.createClass({
displayName: 'Stats',

propTypes: {
values: React.PropTypes.object
},

getDefaultProps: function () {
return {
values: []
}
},

_renderStat (value, name) {
return (
<tr key={name}>
<td>{name}</td>
<td className='value'>{value}</td>
</tr>
)
},

render () {
var self = this

return (
<div className='row stats'>
<div className='panel panel-default'>
<div className='panel-body'>
<table className='table nomarginbottom'>
{_.map(self.props.values, self._renderStat)}
</table>
</div>
</div>
</div>
)
}
})
25 changes: 25 additions & 0 deletions app/js/components/status.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var React = require('react')

module.exports = React.createClass({
displayName: 'Status',

propTypes: {
status: React.PropTypes.string
},

getDefaultProps: function () {
return {
state: ''
}
},

render () {
var self = this

return (
<div className='row status'>
{ self.props.status }
</div>
)
}
})
27 changes: 27 additions & 0 deletions app/js/components/version.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
var React = require('react')

module.exports = React.createClass({
displayName: 'Version',

propTypes: {
value: React.PropTypes.string
},

getDefaultProps: function () {
return {
value: ''
}
},

render () {
var self = this

return (
<div className='row'>
<div className='panel panel-default version'>
{self.props.value}
</div>
</div>
)
}
})
6 changes: 3 additions & 3 deletions app/js/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

var ipc = require('ipc')

function initialize () {
ipc.emit('initialize-node')
}
// function initialize () {
// ipc.emit('initialize-node')
// }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this comment out now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was never called (linting complained) but I wasn't sure if I could remove it


ipc.on('err', function (err) {
if (err) {
Expand Down
4 changes: 2 additions & 2 deletions app/js/menubar-toggle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var React = require('react')
var $ = require('jquery-bf')
var bf = require('bootstrap-toggle-bf')
require('bootstrap-toggle-bf')

var Toggle = React.createClass({
// -- Initialize
Expand All @@ -17,7 +17,7 @@ var Toggle = React.createClass({
var input = $(React.findDOMNode(this)).find('input')

input.bootstrapToggle()

input.change(function () {
self.props.toggle($(this).prop('checked'))
})
Expand Down
Loading