Skip to content

Commit 8c4b3cd

Browse files
authored
Merge pull request #38 from rande/update_gui
Update gui
2 parents eba258e + 406ee7b commit 8c4b3cd

28 files changed

+4650
-2808
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ gui/node_modules
66
build
77
assets/bindata.go
88
vendor
9-
var/
9+
var/
10+
gui/.cache
11+
gui/dist

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cache:
99
install:
1010
# from http://austinpray.com/ops/2015/09/20/change-travis-node-version.html
1111
- make install-backend
12-
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install 4.4.5
12+
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install 8.12.0
1313
- npm -g install yarn
1414
- make install-frontend
1515

Makefile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.PHONY: help format test install update build release assets
22

3-
GO_BINDATA_PREFIX = $(shell pwd)/gui/build
4-
GO_BINDATA_PATHS = $(shell pwd)/gui/build
3+
GO_BINDATA_PREFIX = $(shell pwd)/gui/dist
4+
GO_BINDATA_PATHS = $(shell pwd)/gui/dist
55
GO_BINDATA_IGNORE = "(.*)\.(go|DS_Store)"
66
GO_BINDATA_OUTPUT = $(shell pwd)/assets/bindata.go
77
GO_BINDATA_PACKAGE = assets
@@ -15,13 +15,16 @@ SHA1=$(shell git rev-parse HEAD)
1515
help: ## Display this help
1616
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
1717

18+
19+
format: format-frontend format-backend
20+
echo "Done!"
21+
1822
format-frontend: ## Format code to respect CS
19-
./gui/node_modules/.bin/eslint --fix -c ./gui/.eslintrc $(JS_FILES)
23+
cd gui && yarn prettier --single-quote --trailing-comma es5 --write "src/**/*.js"
2024

2125
format-backend: ## Format code to respect CS
22-
goimports -w $(GO_FILES)
26+
`go env GOPATH`/bin/goimports -w $(GO_FILES)
2327
gofmt -l -w -s $(GO_FILES)
24-
go fix $(GO_PROJECTS_PATHS)
2528
go vet $(GO_PROJECTS_PATHS)
2629

2730
coverage-backend: ## run coverage tests
@@ -75,12 +78,12 @@ bin: assets ## Generate bin assets file
7578
`go env GOPATH`/bin/go-bindata -o $(GO_BINDATA_OUTPUT) -prefix $(GO_BINDATA_PREFIX) -pkg $(GO_BINDATA_PACKAGE) -ignore $(GO_BINDATA_IGNORE) $(GO_BINDATA_PATHS)
7679

7780
assets: ## build assets
78-
rm -rf gui/build/*
79-
cd gui && NODE_ENV=production node_modules/.bin/webpack --config webpack-production.config.js --progress --colors
81+
rm -rf gui/dist/*
82+
cd gui && yarn parcel build src/static/index.html --no-source-maps
8083

8184
watch: ## build assets
8285
rm -rf gui/build/*
83-
cd gui && node_modules/.bin/webpack-dev-server --config webpack-dev-server.config.js --progress --inline --colors
86+
cd gui && yarn parcel watch src/static/index.html
8487

8588
build: bin ## build binaries
8689
GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.RefLog=$(SHA1) -X main.Version=$(TRAVIS_TAG) -s -w" -o build/darwin-amd64-pkgmirror cli/main.go

assets/assets_app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
)
1414

1515
// required by go-bindata
16-
var rootDir = "./gui/build"
16+
var rootDir = "./gui/dist"
1717

1818
func ConfigureApp(config *pkgmirror.Config, l *goapp.Lifecycle) {
1919
l.Prepare(func(app *goapp.App) error {

glide.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

glide.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import:
2323
subpackages:
2424
- core/vault
2525
- package: goji.io
26-
version: ^1.0.0
26+
version: ^1.1.0
2727
subpackages:
2828
- pat
2929
- pattern

gui/.eslintrc

Lines changed: 0 additions & 29 deletions
This file was deleted.

gui/.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
trailingComma: "es5"
2+
tabWidth: 4
3+
semi: false
4+
singleQuote: true

gui/package.json

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
},
99
"private": true,
1010
"dependencies": {
11+
"material-ui": "0.16.0",
12+
"prettier": "^1.14.3",
1113
"react": "15.3.2",
1214
"react-dom": "15.3.2",
1315
"react-markdown": "2.4.2",
1416
"react-redux": "4.4.5",
1517
"react-router": "2.8.1",
1618
"react-router-redux": "4.0.6",
1719
"react-tap-event-plugin": "1.0.0",
18-
"material-ui": "0.16.0",
1920
"redux": "3.6.0"
2021
},
2122
"devDependencies": {
@@ -25,19 +26,10 @@
2526
"babel-preset-es2015": "6.16.0",
2627
"babel-preset-react": "6.16.0",
2728
"babel-preset-stage-0": "6.16.0",
28-
"eslint": "3.7.1",
29-
"eslint-config-airbnb": "12.0.0",
30-
"eslint-plugin-import": "1.16.0",
31-
"eslint-plugin-jsx-a11y": "2.2.3",
32-
"eslint-plugin-react": "6.4.1",
33-
"html-webpack-plugin": "2.22.0",
3429
"json-loader": "0.5.4",
30+
"parcel-bundler": "^1.10.1",
3531
"react-hot-loader": "1.3.0",
3632
"react-transmit": "3.2.0",
37-
"transfer-webpack-plugin": "0.1.4",
38-
"webpack": "1.13.2",
39-
"webpack-dev-server": "1.16.2",
40-
"whatwg-fetch": "1.0.0",
41-
"write-file-webpack-plugin": "3.3.0"
33+
"whatwg-fetch": "1.0.0"
4234
}
4335
}

gui/src/Main.js

Lines changed: 55 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,70 +3,73 @@
33
// Use of this source code is governed by an MIT-style
44
// license that can be found in the LICENSE file.
55

6-
import React from 'react';
7-
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
8-
import AppBar from 'material-ui/AppBar';
9-
import Drawer from 'material-ui/Drawer';
10-
import { SMALL } from 'material-ui/utils/withWidth';
11-
import { connect } from 'react-redux';
12-
import { Router, Route, IndexRoute } from 'react-router';
13-
import { push } from 'react-router-redux';
6+
import React from 'react'
7+
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'
8+
import AppBar from 'material-ui/AppBar'
9+
import Drawer from 'material-ui/Drawer'
10+
import { SMALL } from 'material-ui/utils/withWidth'
11+
import { connect } from 'react-redux'
12+
import { Router, Route, IndexRoute } from 'react-router'
13+
import { push } from 'react-router-redux'
1414

15-
import { MirrorList, MenuList, CardMirror } from './redux/containers';
16-
import { toggleDrawer, hideDrawer } from './redux/apps/guiApp';
17-
import About from './components/About';
15+
import { MirrorList, MenuList, CardMirror } from './redux/containers'
16+
import { toggleDrawer, hideDrawer } from './redux/apps/guiApp'
17+
import About from './components/About'
1818

19-
const Container = props => (
20-
<div>{props.children}</div>
21-
);
19+
const Container = props => <div>{props.children}</div>
2220

2321
Container.propTypes = {
2422
children: React.PropTypes.any,
25-
};
23+
}
2624

27-
const Main = (props) => {
28-
let DrawerOpen = false;
29-
let marginLeft = 0;
25+
const Main = props => {
26+
let DrawerOpen = false
27+
let marginLeft = 0
3028
if (props.width === SMALL && props.DrawerOpen) {
31-
DrawerOpen = true;
29+
DrawerOpen = true
3230
}
3331

3432
if (props.width !== SMALL) {
35-
DrawerOpen = true;
36-
marginLeft = 300;
33+
DrawerOpen = true
34+
marginLeft = 300
3735
}
3836

39-
return (<MuiThemeProvider muiTheme={props.Theme}>
40-
<div>
41-
<AppBar
42-
title={props.Title}
43-
iconClassNameRight="muidocs-icon-navigation-expand-more"
44-
onLeftIconButtonTouchTap={props.toggleDrawer}
45-
showMenuIconButton={props.width === SMALL}
46-
/>
47-
48-
<Drawer open={DrawerOpen} docked width={300}>
37+
return (
38+
<MuiThemeProvider muiTheme={props.Theme}>
39+
<div>
4940
<AppBar
5041
title={props.Title}
42+
iconClassNameRight="muidocs-icon-navigation-expand-more"
5143
onLeftIconButtonTouchTap={props.toggleDrawer}
5244
showMenuIconButton={props.width === SMALL}
5345
/>
5446

55-
<MenuList />
56-
</Drawer>
47+
<Drawer open={DrawerOpen} docked width={300}>
48+
<AppBar
49+
title={props.Title}
50+
onLeftIconButtonTouchTap={props.toggleDrawer}
51+
showMenuIconButton={props.width === SMALL}
52+
/>
53+
54+
<MenuList />
55+
</Drawer>
5756

58-
<div className="foobar" style={{ marginLeft: `${marginLeft}px` }}>
59-
<Router history={props.history} >
60-
<Route path="/" component={Container}>
61-
<IndexRoute component={MirrorList} />
62-
<Route path="mirror/:id" component={CardMirror} />
63-
<Route path="about" component={About} />
64-
</Route>
65-
</Router>
57+
<div
58+
className="foobar"
59+
style={{ marginLeft: `${marginLeft}px` }}
60+
>
61+
<Router history={props.history}>
62+
<Route path="/" component={Container}>
63+
<IndexRoute component={MirrorList} />
64+
<Route path="mirror/:id" component={CardMirror} />
65+
<Route path="about" component={About} />
66+
</Route>
67+
</Router>
68+
</div>
6669
</div>
67-
</div>
68-
</MuiThemeProvider>);
69-
};
70+
</MuiThemeProvider>
71+
)
72+
}
7073

7174
Main.propTypes = {
7275
Theme: React.PropTypes.object,
@@ -75,14 +78,17 @@ Main.propTypes = {
7578
toggleDrawer: React.PropTypes.func,
7679
history: React.PropTypes.object,
7780
width: React.PropTypes.number.isRequired,
78-
};
81+
}
7982

80-
const mapStateToProps = state => ({ ...state.guiApp });
83+
const mapStateToProps = state => ({ ...state.guiApp })
8184

8285
const mapDispatchToProps = dispatch => ({
8386
toggleDrawer: () => {
84-
dispatch(toggleDrawer());
87+
dispatch(toggleDrawer())
8588
},
86-
});
89+
})
8790

88-
export default connect(mapStateToProps, mapDispatchToProps)(Main);
91+
export default connect(
92+
mapStateToProps,
93+
mapDispatchToProps
94+
)(Main)

0 commit comments

Comments
 (0)