diff --git a/Dashboard/app/renderer/actions/user.js b/Dashboard/app/renderer/actions/user.js deleted file mode 100644 index 0eaa8a4..0000000 --- a/Dashboard/app/renderer/actions/user.js +++ /dev/null @@ -1,6 +0,0 @@ -import { createAction } from 'redux-actions'; - -export default { - login: createAction('USER_LOGIN'), - logout: createAction('USER_LOGOUT'), -}; diff --git a/Dashboard/app/renderer/components/LoggedIn.js b/Dashboard/app/renderer/components/LoggedIn.js deleted file mode 100644 index ce24c0a..0000000 --- a/Dashboard/app/renderer/components/LoggedIn.js +++ /dev/null @@ -1,24 +0,0 @@ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; - -export default class LoggedIn extends Component { - static propTypes = { - onLogout: PropTypes.func.isRequired, - }; - - handleLogout = () => { - this.props.onLogout({ - username: '', - loggedIn: false, - }); - }; - - render() { - return ( -
-

Logged in as {this.props.user.username}

- -
- ); - } -} diff --git a/Dashboard/app/renderer/components/Login.js b/Dashboard/app/renderer/components/Login.js deleted file mode 100644 index 7976126..0000000 --- a/Dashboard/app/renderer/components/Login.js +++ /dev/null @@ -1,42 +0,0 @@ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import SerialPort from 'serialport'; - -export default class Login extends Component { - static propTypes = { - onLogin: PropTypes.func.isRequired, - }; - - state = { - username: '', - }; - - handleLogin = () => { - this.props.onLogin({ - username: this.state.username, - loggedIn: true, - }); - }; - - handleChange = (e) => { - this.setState({ - username: e.target.value, - }); - }; - - render() { - const port = new SerialPort('COM3'); - const triggerOn = () => { - port.write('on'); - }; - const triggerOff = () => { - port.write('off'); - }; - return ( -
- - -
- ); - } -} diff --git a/Dashboard/app/renderer/containers/LoggedInPage.js b/Dashboard/app/renderer/containers/LoggedInPage.js deleted file mode 100644 index 7b17f85..0000000 --- a/Dashboard/app/renderer/containers/LoggedInPage.js +++ /dev/null @@ -1,21 +0,0 @@ -import { connect } from 'react-redux'; -import { push } from 'connected-react-router'; -import { bindActionCreators } from 'redux'; -import LoggedIn from '../components/LoggedIn'; -import userActions from '../actions/user'; - -const mapStateToProps = (state) => { - return state; -}; - -const mapDispatchToProps = (dispatch) => { - const user = bindActionCreators(userActions, dispatch); - return { - onLogout: (data) => { - user.logout(data); - dispatch(push('/')); - }, - }; -}; - -export default connect(mapStateToProps, mapDispatchToProps)(LoggedIn); diff --git a/Dashboard/app/renderer/containers/LoginPage.js b/Dashboard/app/renderer/containers/LoginPage.js deleted file mode 100644 index c40f714..0000000 --- a/Dashboard/app/renderer/containers/LoginPage.js +++ /dev/null @@ -1,21 +0,0 @@ -import { connect } from 'react-redux'; -import { push } from 'connected-react-router'; -import { bindActionCreators } from 'redux'; -import Login from '../components/Login'; -import userActions from '../actions/user'; - -const mapStateToProps = (state) => { - return state; -}; - -const mapDispatchToProps = (dispatch) => { - const user = bindActionCreators(userActions, dispatch); - return { - onLogin: (data) => { - user.login(data); - dispatch(push('/loggedin')); - }, - }; -}; - -export default connect(mapStateToProps, mapDispatchToProps)(Login); diff --git a/Dashboard/app/renderer/reducers/user.js b/Dashboard/app/renderer/reducers/user.js deleted file mode 100644 index f79d736..0000000 --- a/Dashboard/app/renderer/reducers/user.js +++ /dev/null @@ -1,14 +0,0 @@ -import { handleActions } from 'redux-actions'; -import actions from '../actions/user'; - -export default handleActions( - { - [actions.login]: (state, action) => { - return { ...state, ...action.payload }; - }, - [actions.logout]: (state, action) => { - return { ...state, ...action.payload }; - }, - }, - {}, -); diff --git a/Dashboard/app/renderer/routes.js b/Dashboard/app/renderer/routes.js deleted file mode 100644 index 2412e3d..0000000 --- a/Dashboard/app/renderer/routes.js +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react'; -import { Switch, Route } from 'react-router'; - -import LoginPage from './containers/LoginPage'; -import LoggedInPage from './containers/LoggedInPage'; - -export default ( - - - - -); diff --git a/Dashboard/app/renderer/store.js b/Dashboard/app/renderer/store.js deleted file mode 100644 index e0649cc..0000000 --- a/Dashboard/app/renderer/store.js +++ /dev/null @@ -1,36 +0,0 @@ -import { createStore, applyMiddleware, combineReducers, compose } from 'redux'; -import { connectRouter, routerMiddleware, push } from 'connected-react-router'; -import persistState from 'redux-localstorage'; -import thunk from 'redux-thunk'; - -import user from './reducers/user'; -import userActions from './actions/user'; - -export default function configureStore(initialState, routerHistory) { - const router = routerMiddleware(routerHistory); - - const actionCreators = { - ...userActions, - push, - }; - - const reducers = { - router: connectRouter(routerHistory), - user, - }; - - const middlewares = [thunk, router]; - - const composeEnhancers = (() => { - const compose_ = window && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__; - if (process.env.NODE_ENV === 'development' && compose_) { - return compose_({ actionCreators }); - } - return compose; - })(); - - const enhancer = composeEnhancers(applyMiddleware(...middlewares), persistState()); - const rootReducer = combineReducers(reducers); - - return createStore(rootReducer, initialState, enhancer); -}