diff --git a/common/actions/auth.js b/common/actions/auth.js
deleted file mode 100644
index eb3c4cb3..00000000
--- a/common/actions/auth.js
+++ /dev/null
@@ -1,27 +0,0 @@
-import {
- login_API,
- setLocalToken,
- resetLocalToken
-} from 'api/AuthSvc';
-import {resultOK} from 'api/utils';
-
-export const LOGIN_AUTH_SUCCESS = 'LOGIN_AUTH_SUCCESS'
-export const LOGIN_AUTH_FAIL = 'LOGIN_AUTH_FAIL'
-
-export const LOGOUT_AUTH_SUCCESS = 'LOGOUT_AUTH_SUCCESS'
-
-export function LOGIN_AUTH(data) {
- return async () => {
- let result = await login_API(data)
- if (!resultOK(result)) {
- return {type: LOGIN_AUTH_FAIL, error: result.data}
- }
- setLocalToken(result.token)
- return {type: LOGIN_AUTH_SUCCESS, result: result.data}
- }
-}
-
-export function LOGOUT_AUTH() {
- resetLocalToken()
- return {type: LOGOUT_AUTH_SUCCESS}
-}
diff --git a/common/actions/dashboard.js b/common/actions/dashboard.js
deleted file mode 100644
index dd17847f..00000000
--- a/common/actions/dashboard.js
+++ /dev/null
@@ -1,16 +0,0 @@
-//import api service
-import {getStatistics_API} from 'api/StatisticsSvc'
-//import request management utils
-import {resultOK} from 'api/utils'
-
-//define action types
-export const GET_STATISTICS_SUCCESS = 'GET_STATISTICS_SUCCESS'
-export const GET_STATISTICS_FAIL = 'GET_STATISTICS_FAIL'
-
-export const GET_STATISTICS = async () => {
- let result = await getStatistics_API()
- if (!resultOK(result)) {
- return {type: GET_STATISTICS_FAIL, error: result.data}
- }
- return {type: GET_STATISTICS_SUCCESS, result: result.data}
-}
diff --git a/common/actions/inbox.js b/common/actions/inbox.js
deleted file mode 100644
index 33c4350c..00000000
--- a/common/actions/inbox.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import {resultOK} from 'api/utils'
-import {getInbox_API} from 'api/InboxSvc'
-
-export const GET_INBOX_SUCCESS = 'GET_INBOX_SUCCESS'
-export const GET_INBOX_FAIL = 'GET_INBOX_FAIL'
-
-export const GET_INBOX = async () => {
- let result = await getInbox_API()
- if (!resultOK(result)) {
- return {type: GET_INBOX_FAIL, error: result.data}
- }
- return {type: GET_INBOX_SUCCESS, result: result.data}
-}
diff --git a/common/actions/layout.js b/common/actions/layout.js
deleted file mode 100644
index 66b4add5..00000000
--- a/common/actions/layout.js
+++ /dev/null
@@ -1,25 +0,0 @@
-export const UI_OPEN_SIDEBAR = 'UI_OPEN_SIDEBAR';
-export const UI_CLOSE_SIDEBAR = 'UI_CLOSE_SIDEBAR';
-export const UI_ACTIVATE_OBFUSCATOR = 'UI_ACTIVATE_OBFUSCATOR';
-export const UI_DEACTIVATE_OBFUSCATOR = 'UI_DEACTIVATE_OBFUSCATOR';
-export const UI_WINDOW_RESIZE = 'UI_WINDOW_RESIZE';
-
-export const CLOSE_SIDEBAR = () => ({
- type: UI_CLOSE_SIDEBAR
-})
-
-export const OPEN_SIDEBAR = () => ({
- type: UI_OPEN_SIDEBAR
-})
-
-export const ACTIVATE_OBFUSCATOR = () => ({
- type: UI_ACTIVATE_OBFUSCATOR
-})
-
-export const DEACTIVATE_OBFUSCATOR = () => ({
- type: UI_DEACTIVATE_OBFUSCATOR
-})
-
-export const WINDOW_RESIZE = () => ({
- type: UI_WINDOW_RESIZE
-})
diff --git a/common/api/AuthSvc.js b/common/api/AuthSvc.js
deleted file mode 100644
index 7adf0c7e..00000000
--- a/common/api/AuthSvc.js
+++ /dev/null
@@ -1,29 +0,0 @@
-import {post} from './utils';
-import * as store from 'store2'
-
-export function getLocalToken() {
- return store.get('auth_token')
-}
-
-export function resetLocalToken() {
- // console.log('remove local token')
- store.remove('auth_token')
-}
-export function setLocalToken(token) {
- // console.log('set new local token')
- store.set('auth_token', token)
-}
-
-export function isLoggedIn() {
- return getLocalToken() === null ? false : true
-}
-
-export async function login_API(data) {
- if (process.env.BUILD_GH_PAGES) {
- return {
- ok: true,
- token: 'Just_for_demo'
- }
- }
- return await post('/auth', data)
-}
diff --git a/common/api/InboxSvc.js b/common/api/InboxSvc.js
deleted file mode 100644
index 349fdb5d..00000000
--- a/common/api/InboxSvc.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import {get} from './utils';
-
-export async function getInbox_API() {
- return await get('https://jsonplaceholder.typicode.com/users')
-}
diff --git a/common/api/StatisticsSvc.js b/common/api/StatisticsSvc.js
deleted file mode 100644
index ed9b7329..00000000
--- a/common/api/StatisticsSvc.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import {get} from './utils'
-
-export async function getStatistics_API() {
- return await get('https://jsonplaceholder.typicode.com/posts?userId=1&userId=2')
-}
diff --git a/common/api/validate.js b/common/api/validate.js
deleted file mode 100644
index 4f687fc6..00000000
--- a/common/api/validate.js
+++ /dev/null
@@ -1,61 +0,0 @@
-// Functions for validation,
-// FEEL FREE TO REMOVE THIS FILE AND components/InputComponent.jsx,
-export function maxSize(num, error = 'Value is too long') {
- return function (value) {
- if (value) {
- return value.length > num ? error : true
- }
- }
-}
-
-export function noSpace(str) {
- // trully can't get why do we need this check,
- // but without it on /profile/settings page we get error
- if (str !== undefined) {
- return true;
- }
- return str.match(/[^-\s]/g) ? true : false
-}
-
-export function isRequired(str, field) {
- if (str && str.length === 0) {
- return `Please, enter your ${field}`
- }
- return true
-}
-
-export function latin(str) {
- return str.match(/[a-zA-Z0-9]+/g) ? true : false
-}
-
-export function number(str) {
- return str.match(/\d+/g) ? true : false
-}
-
-export function email() {
-}
-
-export function phone() {
-}
-
-export function composition(array) {
- return function (value, field) {
- for (let i = 0; i < array.length; i++) {
- if (array[i](value, field) !== true) {
- return array[i](value, field)
- }
- }
- return false
- }
-}
-
-export default {
- isRequired,
- phone,
- email,
- noSpace,
- number,
- latin,
- maxSize,
- composition
-}
diff --git a/common/components/common/InputComponent.jsx b/common/components/common/InputComponent.jsx
deleted file mode 100644
index cbb9aa9f..00000000
--- a/common/components/common/InputComponent.jsx
+++ /dev/null
@@ -1,118 +0,0 @@
-import React, {Component} from 'react';
-import {Input, Form, Label} from 'semantic-ui-react';
-import {omit} from 'lodash';
-import PropTypes from 'prop-types';
-
-//
-export default class InputComponent extends Component {
-
- constructor(props) {
- super(props)
- this.state = {
- value: this.props.value
- }
- }
-
- static propTypes = {
- validate: PropTypes.func,
- connectToParent: PropTypes.func,
- value: PropTypes.any,
- error: PropTypes.string,
- labelText: PropTypes.string,
- label: PropTypes.string,
- placeholder: PropTypes.string,
- name: PropTypes.string,
- type: PropTypes.string,
- as: PropTypes.node,
- action: PropTypes.any
- }
-
- handleChange(event) {
- let state = {
- value: event.target.value
- }
- let {validate, name} = this.props;
- if (validate) {
- state.error = validate(state.value, name) // if valid, then false!
- this.props.connectToParent({name, ...state})
- }
- this.setState(state)
- }
-
- // We have similar code in `handleChange()`
- componentWillMount() {
- let {validate, value, name} = this.props
- let error;
- if (validate) {
- error = validate(value, name)
- }
-
- this.setState({...this.state, error, value})
- }
-
- componentWillReceiveProps() {
- // PROPS ERROR TO STATE ERROR
- let {error} = this.props;
- if (error && error[0]) {
- this.setState({
- error: error || null
- })
- }
- }
-
- render() {
- // STATE ERROR
- let {error, value} = this.state
- let {as} = this.props
- // prop `as`
- let propsToOmit = ['validate', 'error', 'connectToParent', 'as']
-
- let propsForInput = {
- ...this.props,
- onChange: this.handleChange.bind(this),
- value
- }
-
- let RenderComponentAsProp
- let propAsElemExists = false
-
- if (as) {
- propAsElemExists = true
- RenderComponentAsProp = as
- }
-
- let propsForField
- if (error) {
- propsForField = {error: true}
- }
- propsForInput = omit(propsForInput, propsToOmit)
-
- // labelText(custom) - is a TEXT label
- // label - is a BUTTON label
- // check semantic-react docs
- let labelTextComponent = null
- if (propsForInput.labelText) {
- labelTextComponent = ()
- delete propsForInput.labelText
- }
-
-
- return (
-
- // in semantic if input is a part of form, we can make it error-visible
- // only throught the Form.Field error
-
- {labelTextComponent}
-
- {propAsElemExists ?
- :
-
- }
-
- {/* display tooltip with error */}
- {error && }
-
-
- )
- }
-}
diff --git a/common/reducers/auth.js b/common/reducers/auth.js
deleted file mode 100644
index 267970f0..00000000
--- a/common/reducers/auth.js
+++ /dev/null
@@ -1,36 +0,0 @@
-import {isLoggedIn} from 'api/AuthSvc'
-import {
- LOGIN_AUTH_FAIL,
- LOGIN_AUTH_SUCCESS,
- LOGOUT_AUTH_SUCCESS
-} from 'actions/auth'
-
-let initialState = {
- loggedIn: isLoggedIn()
-}
-
-export function auth(state = initialState, action) {
- switch (action.type) {
- case LOGOUT_AUTH_SUCCESS: {
- return {
- ...state,
- loggedIn: false
- }
- }
-
- case LOGIN_AUTH_FAIL: {
- return {
- ...state,
- loggedIn: false
- }
- }
- case LOGIN_AUTH_SUCCESS: {
- return {
- ...state,
- loggedIn: true
- }
- }
- default:
- return state
- }
-}
diff --git a/common/reducers/dashboard.js b/common/reducers/dashboard.js
deleted file mode 100644
index f238e6f5..00000000
--- a/common/reducers/dashboard.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import {GET_STATISTICS_SUCCESS, GET_STATISTICS_FAIL} from 'actions/dashboard'
-import {LOCATION_CHANGE} from 'actions/common'
-
-const initialState = {
- statistics: []
-}
-
-export function dashboard(state = initialState, action) {
- switch (action.type) {
- case GET_STATISTICS_SUCCESS:
- return {
- ...state,
- statistics: action.result
- }
- case GET_STATISTICS_FAIL:
- return state
- case LOCATION_CHANGE: {
- if (action.payload.pathname !== '/') {
- return initialState
- }
- return state
- }
- default:
- return state
- }
-}
diff --git a/common/reducers/inbox.js b/common/reducers/inbox.js
deleted file mode 100644
index 7711e71c..00000000
--- a/common/reducers/inbox.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import {GET_INBOX_SUCCESS, GET_INBOX_FAIL} from 'actions/inbox'
-import {LOCATION_CHANGE} from 'actions/common'
-
-const initialState = {
- isDataLoading: true,
- errorLoadingConversations: false,
- conversations: []
-}
-
-export function inbox(state = initialState, action) {
- switch (action.type) {
- case GET_INBOX_SUCCESS:
- return {
- ...state,
- conversations: action.result
- }
- case GET_INBOX_FAIL:
- return {
- ...state,
- errorLoadingConversations: true,
- conversations: []
- }
- case LOCATION_CHANGE: {
- if (action.payload.pathname !== '/inbox') {
- return initialState
- }
- return state
- }
- default:
- return state
- }
-}
diff --git a/common/reducers/layout.js b/common/reducers/layout.js
deleted file mode 100644
index 13e2c011..00000000
--- a/common/reducers/layout.js
+++ /dev/null
@@ -1,49 +0,0 @@
-import {UI_OPEN_SIDEBAR, UI_CLOSE_SIDEBAR, UI_WINDOW_RESIZE} from 'actions/layout'
-import {LOCATION_CHANGE, APP_INIT} from 'actions/common';
-// UI_ACTIVATE_OBFUSCATOR, UI_DEACTIVATE_OBFUSCATOR
-const initialState = {
- sidebarOpened: false,
- obfuscatorActive: false,
- isMobile: false
-}
-
-export function layout(state = initialState, action) {
- switch (action.type) {
- case APP_INIT: {
- let {innerWidth} = window
- let isMobile = innerWidth < 1025 // 1024px - is the main breakpoint in ui
- return {
- ...state,
- isMobile
- }
- }
- case UI_WINDOW_RESIZE: {
- let {innerWidth} = window
- let isMobile = innerWidth < 1025 // 1024px - is the main breakpoint in ui
- return {
- ...state,
- isMobile
- }
- }
- case UI_OPEN_SIDEBAR:
- return {
- ...state,
- sidebarOpened: true,
- obfuscatorActive: true
- }
- case UI_CLOSE_SIDEBAR:
- return {
- ...state,
- sidebarOpened: false,
- obfuscatorActive: false
- }
- case LOCATION_CHANGE:
- return {
- ...state,
- sidebarOpened: false,
- obfuscatorActive: false
- }
- default:
- return state
- }
-}
diff --git a/common/reducers/loginCR.js b/common/reducers/loginCR.js
deleted file mode 100644
index 036e7437..00000000
--- a/common/reducers/loginCR.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import {LOGIN_AUTH_FAIL, LOGIN_AUTH_SUCCESS} from 'actions/auth';
-
-const initialState = {
- loginError: false,
- loginSuccess: false
-}
-
-export function loginCR(state = initialState, action) {
- switch (action.type) {
- case LOGIN_AUTH_FAIL:
- return {
- ...state,
- loginError: action.error,
- loginSuccess: false
- }
- case LOGIN_AUTH_SUCCESS:
- return {
- ...state,
- loginError: false,
- loginSuccess: true
- }
- default:
- return state
- }
-}
diff --git a/package.json b/package.json
index b83d0a1e..be97ba23 100644
--- a/package.json
+++ b/package.json
@@ -14,8 +14,6 @@
"redux-form": "^6.6.3",
"redux-logger": "^3.0.1",
"redux-thunk": "^2.2.0",
- "semantic-ui-css": "^2.2.9",
- "semantic-ui-react": "^0.67.2",
"store2": "^2.5.0",
"whatwg-fetch": "^2.0.2"
},
diff --git a/spec/actions/config.spec.js b/spec/actions/config.spec.js
new file mode 100644
index 00000000..e69de29b
diff --git a/webpack_config/config.js b/webpack_config/config.js
index 5f8b2a34..0014ced1 100644
--- a/webpack_config/config.js
+++ b/webpack_config/config.js
@@ -3,12 +3,12 @@ const path = require('path')
module.exports = {
port: 3000,
- title: 'React-Semantic.UI-starter',
+ title: 'MEW',
publicPath: process.env.BUILD_GH_PAGES ? '/react-semantic.ui-starter/' : '/',
srcPath: path.join(__dirname, './../common'),
// add these dependencies to a standalone vendor bundle
vendor: [
- 'react', 'react-dom', 'react-router', 'redux', 'react-router-redux', 'redux-thunk', 'semantic-ui-react', 'whatwg-fetch', 'semantic-ui-css/semantic.css'
+ 'react', 'react-dom', 'react-router', 'redux', 'react-router-redux', 'redux-thunk', 'whatwg-fetch'
],
// enable babelrc
babel: {
diff --git a/webpack_config/webpack.base.js b/webpack_config/webpack.base.js
index fa6abf37..9b5f26e4 100644
--- a/webpack_config/webpack.base.js
+++ b/webpack_config/webpack.base.js
@@ -53,7 +53,8 @@ module.exports = {
test: /\.(js|jsx)$/,
loaders: ['babel-loader'],
exclude: [/node_modules/]
- }, {
+ },
+ {
test: /\.(ico|jpg|png|gif|eot|otf|webp|ttf|woff|woff2)(\?.*)?$/,
loader: 'file-loader?limit=100000'
}, {