Skip to content

Commit c025d9a

Browse files
author
Sascha Pfeiffer
committed
added prettier
Signed-off-by: Sascha Pfeiffer <sascha.pfeiffer@psono.com>
1 parent 1880f32 commit c025d9a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+4658
-2264
lines changed

.eslintrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "react-app",
3+
"rules": {
4+
"indent": ["error", 2]
5+
}
6+
}

package.json

+10
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
"chartist": "^0.10.1",
1616
"clientjs": "^0.1.11",
1717
"ecma-nacl": "^2.4.2",
18+
"husky": "^0.14.3",
1819
"js-sha256": "^0.9.0",
1920
"js-sha512": "^0.7.1",
21+
"lint-staged": "^7.0.0",
2022
"material-ui": "1.0.0-beta.30",
2123
"material-ui-icons": "1.0.0-beta.17",
2224
"npm-run-all": "^4.1.1",
2325
"perfect-scrollbar": "^1.3.0",
26+
"prettier": "^1.11.0",
2427
"react": "^16.2.0",
2528
"react-chartist": "^0.13.1",
2629
"react-dom": "^16.2.0",
@@ -37,7 +40,14 @@
3740
"redux-thunk": "^2.2.0",
3841
"uuid-js": "^0.7.5"
3942
},
43+
"lint-staged": {
44+
"src/**/*.{js,jsx,json,css}": [
45+
"prettier --single-quote --write --tab-width 4",
46+
"git add"
47+
]
48+
},
4049
"scripts": {
50+
"precommit": "lint-staged",
4151
"start": "react-scripts start",
4252
"build": "react-scripts build",
4353
"test": "react-scripts test --env=jsdom",

src/actions/actionCreators.js

+21-21
Original file line numberDiff line numberDiff line change
@@ -6,64 +6,65 @@ import {
66
LOGOUT,
77
SET_SERVER_URL,
88
SET_SERVER_INFO,
9-
SET_CLIENT_URL,
10-
} from './actionTypes'
11-
9+
SET_CLIENT_URL
10+
} from './actionTypes';
1211

1312
function set_user_info_1(username, remember_me, trust_device) {
14-
return (dispatch) => {
13+
return dispatch => {
1514
dispatch({
1615
type: SET_USER_INFO_1,
1716
username,
1817
remember_me,
19-
trust_device,
18+
trust_device
2019
});
21-
2220
};
2321
}
24-
function set_user_info_2(user_private_key, user_public_key, session_secret_key, token, user_sauce) {
25-
return (dispatch) => {
22+
function set_user_info_2(
23+
user_private_key,
24+
user_public_key,
25+
session_secret_key,
26+
token,
27+
user_sauce
28+
) {
29+
return dispatch => {
2630
dispatch({
2731
type: SET_USER_INFO_2,
2832
user_private_key,
2933
user_public_key,
3034
session_secret_key,
3135
token,
32-
user_sauce,
36+
user_sauce
3337
});
34-
3538
};
3639
}
3740
function set_user_info_3(user_id, user_email, user_secret_key) {
38-
return (dispatch) => {
41+
return dispatch => {
3942
dispatch({
4043
type: SET_USER_INFO_3,
4144
user_id,
4245
user_email,
4346
user_secret_key
4447
});
45-
4648
};
4749
}
4850

4951
function logout() {
50-
return (dispatch) => {
51-
52+
return dispatch => {
5253
dispatch({
5354
type: LOGOUT
5455
});
5556
};
5657
}
5758

5859
function set_server_info(info) {
59-
return (dispatch) => {
60+
return dispatch => {
6061
info.type = SET_SERVER_INFO;
6162
dispatch(info);
6263
};
6364
}
6465

6566
function set_server_url(url) {
66-
return (dispatch) => {
67+
return dispatch => {
6768
dispatch({
6869
type: SET_SERVER_URL,
6970
url: url
@@ -72,7 +73,7 @@ function set_server_url(url) {
7273
}
7374

7475
function set_client_url(url) {
75-
return (dispatch) => {
76+
return dispatch => {
7677
dispatch({
7778
type: SET_CLIENT_URL,
7879
url: url
@@ -81,7 +82,7 @@ function set_client_url(url) {
8182
}
8283

8384
function set_known_hosts(known_hosts) {
84-
return (dispatch) => {
85+
return dispatch => {
8586
dispatch({
8687
type: SET_KNOWN_HOSTS,
8788
known_hosts: known_hosts
@@ -97,8 +98,7 @@ const actionCreators = {
9798
set_server_info,
9899
set_server_url,
99100
set_client_url,
100-
set_known_hosts,
101+
set_known_hosts
101102
};
102103

103-
export default actionCreators
104-
104+
export default actionCreators;

src/actions/boundActionCreators.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import store from '../services/store'
2-
import actionCreators from './actionCreators'
3-
import {bindActionCreators} from 'redux';
1+
import store from '../services/store';
2+
import actionCreators from './actionCreators';
3+
import { bindActionCreators } from 'redux';
44

5-
6-
export default bindActionCreators(actionCreators, store.dispatch)
5+
export default bindActionCreators(actionCreators, store.dispatch);

src/assets/css/material-dashboard-react.css

+33-18
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
stroke-dasharray: 2px;
2020
}
2121

22-
.ct-series-a .ct-point, .ct-series-a .ct-line, .ct-series-a .ct-bar, .ct-series-a .ct-slice-donut {
22+
.ct-series-a .ct-point,
23+
.ct-series-a .ct-line,
24+
.ct-series-a .ct-bar,
25+
.ct-series-a .ct-slice-donut {
2326
stroke: rgba(255, 255, 255, 0.8);
2427
}
2528

@@ -40,7 +43,8 @@
4043
color: rgba(255, 255, 255, 0.7);
4144
}
4245

43-
.ct-chart-line .ct-label, .ct-chart-bar .ct-label {
46+
.ct-chart-line .ct-label,
47+
.ct-chart-bar .ct-label {
4448
display: block;
4549
display: -webkit-box;
4650
display: -moz-box;
@@ -58,15 +62,16 @@ html * {
5862
-moz-osx-font-smoothing: grayscale;
5963
}
6064
body {
61-
background-color: #EEEEEE;
62-
color: #3C4858;
65+
background-color: #eeeeee;
66+
color: #3c4858;
6367
margin: 0;
6468
font-family: Roboto, Helvetica, Arial, sans-serif;
6569
font-weight: 300;
6670
line-height: 1.5em;
6771
}
6872

69-
blockquote footer:before, blockquote small:before {
73+
blockquote footer:before,
74+
blockquote small:before {
7075
content: '\2014 \00A0';
7176
}
7277

@@ -103,16 +108,22 @@ h6 {
103108
}
104109

105110
body {
106-
background-color: #EEEEEE;
107-
color: #3C4858;
111+
background-color: #eeeeee;
112+
color: #3c4858;
108113
}
109114

110115
blockquote p {
111116
font-style: italic;
112117
}
113118

114-
body, h1, h2, h3, h4, h5, h6 {
115-
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
119+
body,
120+
h1,
121+
h2,
122+
h3,
123+
h4,
124+
h5,
125+
h6 {
126+
font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
116127
font-weight: 300;
117128
line-height: 1.5em;
118129
}
@@ -122,7 +133,8 @@ a {
122133
text-decoration: none;
123134
}
124135

125-
a:hover, a:focus {
136+
a:hover,
137+
a:focus {
126138
color: #89229b;
127139
text-decoration: none;
128140
}
@@ -140,14 +152,17 @@ legend {
140152
outline: 0;
141153
}
142154

143-
a:focus, a:active,
144-
button:active, button:focus, button:hover,
155+
a:focus,
156+
a:active,
157+
button:active,
158+
button:focus,
159+
button:hover,
145160
button::-moz-focus-inner,
146-
input[type="reset"]::-moz-focus-inner,
147-
input[type="button"]::-moz-focus-inner,
148-
input[type="submit"]::-moz-focus-inner,
161+
input[type='reset']::-moz-focus-inner,
162+
input[type='button']::-moz-focus-inner,
163+
input[type='submit']::-moz-focus-inner,
149164
select::-moz-focus-inner,
150-
input[type="file"] > input[type="button"]::-moz-focus-inner {
165+
input[type='file'] > input[type='button']::-moz-focus-inner {
151166
outline: 0 !important;
152167
}
153168

@@ -165,7 +180,7 @@ output {
165180
label {
166181
font-size: 14px;
167182
line-height: 1.42857;
168-
color: #AAAAAA;
183+
color: #aaaaaa;
169184
font-weight: 400;
170185
}
171186

@@ -214,7 +229,7 @@ footer ul li a:hover {
214229
top: 0;
215230
left: auto;
216231
right: 260px;
217-
content: "";
232+
content: '';
218233
z-index: 9999;
219234
overflow-x: hidden;
220235
}

src/components/Cards/ChartCard.jsx

+54-10
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,45 @@
11
import React from 'react';
22
import {
3-
withStyles, Card, CardContent, CardHeader, CardActions, Typography
3+
withStyles,
4+
Card,
5+
CardContent,
6+
CardHeader,
7+
CardActions,
8+
Typography
49
} from 'material-ui';
510
import PropTypes from 'prop-types';
611

712
import { chartCardStyle } from '../../variables/styles';
813

9-
class ChartCard extends React.Component{
10-
render(){
11-
const { classes, chartColor, statIconColor, chart, title, text, statLink, statText } = this.props;
14+
class ChartCard extends React.Component {
15+
render() {
16+
const {
17+
classes,
18+
chartColor,
19+
statIconColor,
20+
chart,
21+
title,
22+
text,
23+
statLink,
24+
statText
25+
} = this.props;
1226
return (
1327
<Card className={classes.card}>
1428
<CardHeader
1529
classes={{
16-
root: (classes.cardHeader + " " + classes[chartColor+"CardHeader"]),
30+
root:
31+
classes.cardHeader +
32+
' ' +
33+
classes[chartColor + 'CardHeader']
1734
}}
1835
subheader={chart}
1936
/>
2037
<CardContent className={classes.cardContent}>
21-
<Typography type="title" component="h4" className={classes.cardTitle}>
38+
<Typography
39+
type="title"
40+
component="h4"
41+
className={classes.cardTitle}
42+
>
2243
{title}
2344
</Typography>
2445
<Typography component="p" className={classes.cardCategory}>
@@ -27,8 +48,23 @@ class ChartCard extends React.Component{
2748
</CardContent>
2849
<CardActions className={classes.cardActions}>
2950
<div className={classes.cardStats}>
30-
<this.props.statIcon className={classes.cardStatsIcon + " " + classes[statIconColor+"CardStatsIcon"]} />{' '}
31-
{statLink !== undefined ? (<a href={statLink.href} className={classes.cardStatsLink}>{statLink.text}</a>):(statText !== undefined ? (statText):null)}
51+
<this.props.statIcon
52+
className={
53+
classes.cardStatsIcon +
54+
' ' +
55+
classes[statIconColor + 'CardStatsIcon']
56+
}
57+
/>{' '}
58+
{statLink !== undefined ? (
59+
<a
60+
href={statLink.href}
61+
className={classes.cardStatsLink}
62+
>
63+
{statLink.text}
64+
</a>
65+
) : statText !== undefined ? (
66+
statText
67+
) : null}
3268
</div>
3369
</CardActions>
3470
</Card>
@@ -47,8 +83,16 @@ ChartCard.propTypes = {
4783
title: PropTypes.node,
4884
text: PropTypes.node,
4985
statIcon: PropTypes.func.isRequired,
50-
statIconColor: PropTypes.oneOf(['warning','primary','danger','success','info','rose','gray']),
51-
chartColor: PropTypes.oneOf(['orange','green','red','blue','purple']),
86+
statIconColor: PropTypes.oneOf([
87+
'warning',
88+
'primary',
89+
'danger',
90+
'success',
91+
'info',
92+
'rose',
93+
'gray'
94+
]),
95+
chartColor: PropTypes.oneOf(['orange', 'green', 'red', 'blue', 'purple']),
5296
statLink: PropTypes.object,
5397
statText: PropTypes.node
5498
};

0 commit comments

Comments
 (0)