Skip to content

Commit 1cd59ae

Browse files
Merge pull request #43 from parallaxinc/overlay-cleanup
Sure up the UI and add downloading to BS2
2 parents 650af69 + 633ee24 commit 1cd59ae

File tree

16 files changed

+440
-265
lines changed

16 files changed

+440
-265
lines changed

assets/logo.png

2.22 KB
Loading

gulpfile.babel.js

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
'use strict';
22

3-
const path = require('path');
4-
53
const del = require('del');
64
const gulp = require('gulp');
75
const chalk = require('chalk');
86
const zip = require('gulp-zip');
97
const gutil = require('gulp-util');
108
const webpack = require('webpack');
119

12-
const shouldWatch = (process.argv.indexOf('--watch') !== -1);
10+
const webpackConfig = require('./webpack.config');
1311

1412
const files = {
1513
release: [
@@ -22,55 +20,6 @@ const files = {
2220
]
2321
};
2422

25-
const webpackConfig = {
26-
entry: './client.js',
27-
output: {
28-
path: __dirname,
29-
filename: 'bundle.js'
30-
},
31-
module: {
32-
loaders: [
33-
{
34-
test: /\.css$/,
35-
loader: 'style-loader!css-loader'
36-
},
37-
{
38-
test: /\.html$/,
39-
loader: 'html-loader'
40-
},
41-
{
42-
test: /\.json$/,
43-
loader: 'json-loader'
44-
},
45-
{
46-
test: /\.js$/,
47-
exclude: /node_modules/,
48-
loaders: [
49-
'babel-loader?optional=runtime'
50-
]
51-
}
52-
]
53-
},
54-
resolveLoader: {
55-
// this is a workaround for loaders being applied
56-
// to linked modules
57-
root: path.join(__dirname, 'node_modules')
58-
},
59-
resolve: {
60-
// this is a workaround for aliasing a top level dependency
61-
// inside a symlinked subdependency
62-
root: path.join(__dirname, 'node_modules'),
63-
alias: {
64-
// replacing `fs` with a browser-compatible version
65-
fs: 'browserify-fs',
66-
memdown: 'level-js',
67-
serialport: 'browser-serialport'
68-
}
69-
},
70-
bail: true,
71-
watch: shouldWatch
72-
};
73-
7423
function js(cb){
7524
webpack(webpackConfig, function(err){
7625
gutil.log(chalk.green('Webpack - JS Rebuilt'));

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
"react-mfb-iceddev": "^0.1.0",
1818
"react-select": "^0.4.0",
1919
"react-style": "^0.4.0",
20-
"skrim": "0.0.1",
21-
"snacks": "^0.2.0"
20+
"skrim": "0.0.2",
21+
"snacks": "^0.2.0",
22+
"when": "^3.7.2"
2223
},
2324
"devDependencies": {
2425
"babel": "^4.5.1",
@@ -42,14 +43,16 @@
4243
"phantomjs": "git://github.com/phated/phantomjs",
4344
"style-loader": "^0.8.3",
4445
"webpack": "^1.7.2",
46+
"webpack-dev-server": "^1.7.0",
4547
"zuul": "^2.1.1"
4648
},
4749
"scripts": {
4850
"test": "zuul test/*.js --local --open",
4951
"ci": "zuul test/*.js --phantom",
5052
"build": "gulp",
5153
"release": "gulp gh-release",
52-
"postinstall": "gulp postinstall"
54+
"postinstall": "gulp postinstall",
55+
"serve": "webpack-dev-server"
5356
},
5457
"repository": {
5558
"type": "git",

plugins/appbar/component.js

Lines changed: 6 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -1,146 +1,19 @@
11
'use strict';
22

33
const React = require('react');
4-
const Card = require('react-material/components/Card');
5-
const List = require('react-material/components/List');
6-
const ListItem = require('react-material/components/ListItem');
74
const AppBar = require('react-material/components/AppBar');
8-
const Overlay = require('react-material/components/Overlay');
9-
const SideNavigation = require('react-material/components/SideNavigation');
10-
const Button = require('react-material/components/Button');
11-
const TextField = require('react-material/components/TextField');
12-
const Icon = require('react-material/components/Icon');
135

14-
const IconButton = require('./icon-button');
156
const styles = require('./styles');
167

17-
const TopBar = React.createClass({
18-
getInitialState: function(){
19-
return {
20-
show: false,
21-
chooserType: '',
22-
projectName: ''
23-
};
24-
},
25-
showSidebar: function(){
26-
this.setState({
27-
show: true
28-
});
29-
},
30-
hideSidebar: function(){
31-
this.setState({
32-
show: false,
33-
chooserType: ''
34-
});
35-
},
36-
showNewChooser: function(){
37-
this.setState({
38-
chooserType: 'new'
39-
});
40-
},
41-
showOpenChooser: function(){
42-
this.setState({
43-
chooserType: 'open'
44-
});
45-
},
46-
hideChooser: function(){
47-
this.setState({
48-
chooserType: ''
49-
});
50-
},
51-
updateName: function(evt){
52-
evt.stopPropagation();
53-
evt.preventDefault();
54-
55-
this.setState({
56-
projectName: evt.target.value
57-
});
58-
},
59-
openDir: function(name){
60-
this.setState({
61-
projectName: name
62-
}, this.changeProject);
63-
},
64-
deleteDir: function(name, evt){
65-
const space = this.props.app.workspace;
66-
67-
evt.stopPropagation();
68-
evt.preventDefault();
69-
70-
space.deleteDir(name, function(){
71-
console.log('dir deleted', name);
72-
});
73-
},
74-
changeProject: function(){
75-
const space = this.props.app.workspace;
76-
77-
space.changeDir(this.state.projectName, () => {
78-
this.props.app.userConfig.set('cwd', this.state.projectName);
79-
// TODO: handle error
80-
this.setState({ projectName: '' }, this.hideSidebar)
81-
});
82-
},
83-
renderChooser: function(){
84-
const space = this.props.app.workspace;
85-
86-
if(!this.state.chooserType){
87-
return null;
88-
}
89-
90-
if(this.state.chooserType === 'new'){
91-
return (
92-
<Card styles={styles.chooser} title="New Project">
93-
<TextField
94-
placeHolder="Enter Project Name"
95-
floatingLabel
96-
styles={styles.textField}
97-
value={this.state.projectName}
98-
onChange={this.updateName} />
99-
<div style={styles.buttonGroup}>
100-
<Button raised onClick={this.hideChooser}>Cancel</Button>
101-
<Button raised styles={styles.createButton} onClick={this.changeProject}>Create Project</Button>
102-
</div>
103-
</Card>
104-
)
105-
}
106-
107-
if(this.state.chooserType === 'open'){
108-
return (
109-
<Card styles={styles.chooser} title="Open Project">
110-
<List>
111-
{space.projects.map((dirname) => (
112-
<ListItem icon="folder" key={dirname} onClick={() => this.openDir(dirname)}>
113-
{dirname}
114-
{
115-
dirname !== space.cwd.deref().substr(1)
116-
? <IconButton icon="delete" onClick={(evt) => this.deleteDir(dirname, evt)} />
117-
: ''
118-
}
119-
</ListItem>
120-
)).toJS()}
121-
</List>
122-
</Card>
123-
);
124-
}
125-
},
126-
render: function(){
127-
const { title } = this.props;
128-
const { show } = this.state;
8+
class TopBar extends React.Component {
1299

10+
render(){
13011
return (
131-
<div>
132-
<AppBar title={title} onNavButtonClick={this.showSidebar} />
133-
<Overlay show={show} onClick={this.hideSidebar} />
134-
<SideNavigation show={show} styles={styles.sideNav}>
135-
<List>
136-
<ListItem icon onClick={this.showNewChooser}><Icon icon="folder" /> New Project</ListItem>
137-
<ListItem icon onClick={this.showOpenChooser}><Icon icon="folder-open" /> Open Project</ListItem>
138-
</List>
139-
</SideNavigation>
140-
{this.renderChooser()}
141-
</div>
12+
<AppBar styles={styles.appbar}>
13+
<img src="/assets/logo.png" style={styles.logo} />
14+
</AppBar>
14215
);
14316
}
144-
});
17+
}
14518

14619
module.exports = TopBar;

plugins/appbar/styles.js

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,18 @@
33
const StyleSheet = require('react-style');
44

55
const styles = {
6-
sideNav: StyleSheet.create({
7-
zIndex: 5,
8-
width: '13rem'
9-
}),
10-
chooser: StyleSheet.create({
11-
zIndex: 6,
12-
width: '100%',
13-
maxWidth: '30rem',
14-
margin: 'auto',
15-
display: 'flex',
16-
flexDirection: 'column'
17-
}),
18-
textField: {
19-
containerStyling: StyleSheet.create({
20-
width: '100%'
6+
appbar: {
7+
normalAppBarStyle: StyleSheet.create({
8+
backgroundColor: '#2c83d8'
219
})
2210
},
23-
createButton: StyleSheet.create({
24-
marginLeft: '10px'
25-
}),
26-
buttonGroup: {
27-
alignSelf: 'flex-end',
28-
marginTop: 'auto'
29-
},
30-
deleteButton: {
31-
border: 0,
32-
background: 'none',
33-
padding: 0,
34-
float: 'right',
35-
position: 'relative',
36-
zIndex: 7
37-
},
38-
buttonIcon: StyleSheet.create({
39-
display: 'inline-block',
40-
padding: 0,
41-
width: '30px',
42-
verticalAlign: 'middle',
43-
pointerEvents: 'none',
44-
})
11+
logo: {
12+
boxSizing: 'border-box',
13+
height: '100%',
14+
position: 'absolute',
15+
right: 0,
16+
padding: 8
17+
}
4518
};
4619

4720
module.exports = styles;

0 commit comments

Comments
 (0)