diff --git a/.gitignore b/.gitignore index dfded74..bfbad8a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,34 @@ -*.iml +# Distribution Files +dist/ +build/ + +# IDE & Editors .idea -node_modules \ No newline at end of file +.vscode + +# OSX +*.DS_Store +.AppleDouble +.LSOverride +._* + +# Windows +Thumbs.db +ehthumbs.db +Desktop.ini +*.lnk + +*.iml + +node_modules + +# Debug log from npm +npm-debug.log +yarn-error.log + +*.map +*. +package-lock.json + +yarn.lock +react-loadable.json \ No newline at end of file diff --git a/package.json b/package.json index 0d154bd..5a5a89d 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "start": "NODE_ENV=development webpack-dev-server", "build": "NODE_ENV=production webpack --config webpack.build.config.js", "server-build": "NODE_ENV=production webpack --config webpack.server.config.js", + "build-all": "npm run build && npm run server-build", "prod": "node server.js" }, "dependencies": { @@ -41,14 +42,14 @@ "extract-text-webpack-plugin": "^4.0.0-beta.0", "html-webpack-plugin": "^3.2.0", "node-sass": "^4.8.3", - "react": "^16.3.1", - "react-dom": "^16.3.1", + "react": "^16.8.6", + "react-dom": "^16.8.6", "react-helmet": "^5.2.1", "react-loadable": "^5.3.1", - "react-redux": "^5.0.7", - "react-router-config": "^1.0.0-beta.4", - "redux": "^3.7.2", - "redux-thunk": "^2.2.0", + "react-redux": "7.1.0", + "react-router-config": "^5.0.1", + "redux": "^4.0.1", + "redux-thunk": "^2.3.0", "sass-loader": "^7.0.1", "style-loader": "^0.20.3", "webpack-node-externals": "^1.7.2", @@ -61,7 +62,7 @@ "@babel/plugin-transform-runtime": "^7.0.0", "@babel/preset-env": "^7.0.0", "@babel/runtime-corejs2": "^7.0.0", - "react-router-dom": "^4.2.2", + "react-router-dom": "^5.0.1", "webpack": "^4.20.2", "webpack-cli": "^3.1.1", "webpack-dev-server": "^3.1.3" diff --git a/react-loadable.json b/react-loadable.json deleted file mode 100644 index fc4d559..0000000 --- a/react-loadable.json +++ /dev/null @@ -1,1160 +0,0 @@ -{ - "../scss/main.scss": [ - { - "id": "./scss/main.scss", - "name": "./scss/main.scss", - "file": "app.js" - }, - { - "id": "./scss/main.scss", - "name": "./scss/main.scss", - "file": "styles.css" - } - ], - "../action/types": [ - { - "id": "./src/action/types.js", - "name": "./src/action/types.js", - "file": "app.js" - }, - { - "id": "./src/action/types.js", - "name": "./src/action/types.js", - "file": "styles.css" - } - ], - "./src/index.js": [ - { - "id": "./src/index.js", - "name": "./src/index.js", - "file": "app.js" - }, - { - "id": "./src/index.js", - "name": "./src/index.js", - "file": "styles.css" - } - ], - "./Country": [ - { - "id": "./src/reducers/Country.js", - "name": "./src/reducers/Country.js", - "file": "app.js" - }, - { - "id": "./src/reducers/Country.js", - "name": "./src/reducers/Country.js", - "file": "styles.css" - } - ], - "./countries": [ - { - "id": "./src/reducers/countries.js", - "name": "./src/reducers/countries.js", - "file": "app.js" - }, - { - "id": "./src/reducers/countries.js", - "name": "./src/reducers/countries.js", - "file": "styles.css" - } - ], - "./reducers": [ - { - "id": "./src/reducers/index.js", - "name": "./src/reducers/index.js", - "file": "app.js" - }, - { - "id": "./src/reducers/index.js", - "name": "./src/reducers/index.js", - "file": "styles.css" - } - ], - "./Routes": [ - { - "id": "./src/router/Routes.js", - "name": "./src/router/Routes.js", - "file": "app.js" - }, - { - "id": "./src/router/Routes.js", - "name": "./src/router/Routes.js", - "file": "styles.css" - } - ], - "./router": [ - { - "id": "./src/router/index.js", - "name": "./src/router/index.js", - "file": "app.js" - }, - { - "id": "./src/router/index.js", - "name": "./src/router/index.js", - "file": "styles.css" - } - ], - "./store": [ - { - "id": "./src/store.js", - "name": "./src/store.js", - "file": "app.js" - }, - { - "id": "./src/store.js", - "name": "./src/store.js", - "file": "styles.css" - } - ], - "../../action/countries": [ - { - "id": "./src/action/countries.js", - "name": "./src/action/countries.js", - "file": "0.js" - }, - { - "id": "./src/action/countries.js", - "name": "./src/action/countries.js", - "file": "1.js" - } - ], - "./Loading": [ - { - "id": "./src/common/Loading.js", - "name": "./src/common/Loading.js", - "file": "0.js" - }, - { - "id": "./src/common/Loading.js", - "name": "./src/common/Loading.js", - "file": "1.js" - } - ], - "../../common": [ - { - "id": "./src/common/index.js", - "name": "./src/common/index.js", - "file": "0.js" - }, - { - "id": "./src/common/index.js", - "name": "./src/common/index.js", - "file": "1.js" - } - ], - "./CountriesItem": [ - { - "id": "./src/components/Countries/CountriesItem.js", - "name": "./src/components/Countries/CountriesItem.js", - "file": "0.js" - } - ], - "../components/Countries": [ - { - "id": "./src/components/Countries/index.js", - "name": "./src/components/Countries/index.js", - "file": "0.js" - } - ], - "../components/Country": [ - { - "id": "./src/components/Country/index.js", - "name": "./src/components/Country/index.js", - "file": "1.js" - } - ], - "axios": [ - { - "id": "./node_modules/axios/index.js", - "name": "./node_modules/axios/index.js", - "file": "vendor.js" - } - ], - "./adapters/xhr": [ - { - "id": "./node_modules/axios/lib/adapters/xhr.js", - "name": "./node_modules/axios/lib/adapters/xhr.js", - "file": "vendor.js" - } - ], - "./lib/axios": [ - { - "id": "./node_modules/axios/lib/axios.js", - "name": "./node_modules/axios/lib/axios.js", - "file": "vendor.js" - } - ], - "./cancel/Cancel": [ - { - "id": "./node_modules/axios/lib/cancel/Cancel.js", - "name": "./node_modules/axios/lib/cancel/Cancel.js", - "file": "vendor.js" - } - ], - "./cancel/CancelToken": [ - { - "id": "./node_modules/axios/lib/cancel/CancelToken.js", - "name": "./node_modules/axios/lib/cancel/CancelToken.js", - "file": "vendor.js" - } - ], - "./cancel/isCancel": [ - { - "id": "./node_modules/axios/lib/cancel/isCancel.js", - "name": "./node_modules/axios/lib/cancel/isCancel.js", - "file": "vendor.js" - } - ], - "./core/Axios": [ - { - "id": "./node_modules/axios/lib/core/Axios.js", - "name": "./node_modules/axios/lib/core/Axios.js", - "file": "vendor.js" - } - ], - "./InterceptorManager": [ - { - "id": "./node_modules/axios/lib/core/InterceptorManager.js", - "name": "./node_modules/axios/lib/core/InterceptorManager.js", - "file": "vendor.js" - } - ], - "../core/createError": [ - { - "id": "./node_modules/axios/lib/core/createError.js", - "name": "./node_modules/axios/lib/core/createError.js", - "file": "vendor.js" - } - ], - "./dispatchRequest": [ - { - "id": "./node_modules/axios/lib/core/dispatchRequest.js", - "name": "./node_modules/axios/lib/core/dispatchRequest.js", - "file": "vendor.js" - } - ], - "./enhanceError": [ - { - "id": "./node_modules/axios/lib/core/enhanceError.js", - "name": "./node_modules/axios/lib/core/enhanceError.js", - "file": "vendor.js" - } - ], - "./../core/settle": [ - { - "id": "./node_modules/axios/lib/core/settle.js", - "name": "./node_modules/axios/lib/core/settle.js", - "file": "vendor.js" - } - ], - "./transformData": [ - { - "id": "./node_modules/axios/lib/core/transformData.js", - "name": "./node_modules/axios/lib/core/transformData.js", - "file": "vendor.js" - } - ], - "./defaults": [ - { - "id": "./node_modules/axios/lib/defaults.js", - "name": "./node_modules/axios/lib/defaults.js", - "file": "vendor.js" - } - ], - "./helpers/bind": [ - { - "id": "./node_modules/axios/lib/helpers/bind.js", - "name": "./node_modules/axios/lib/helpers/bind.js", - "file": "vendor.js" - } - ], - "./../helpers/btoa": [ - { - "id": "./node_modules/axios/lib/helpers/btoa.js", - "name": "./node_modules/axios/lib/helpers/btoa.js", - "file": "vendor.js" - } - ], - "./../helpers/buildURL": [ - { - "id": "./node_modules/axios/lib/helpers/buildURL.js", - "name": "./node_modules/axios/lib/helpers/buildURL.js", - "file": "vendor.js" - } - ], - "./../helpers/combineURLs": [ - { - "id": "./node_modules/axios/lib/helpers/combineURLs.js", - "name": "./node_modules/axios/lib/helpers/combineURLs.js", - "file": "vendor.js" - } - ], - "./../helpers/cookies": [ - { - "id": "./node_modules/axios/lib/helpers/cookies.js", - "name": "./node_modules/axios/lib/helpers/cookies.js", - "file": "vendor.js" - } - ], - "./../helpers/isAbsoluteURL": [ - { - "id": "./node_modules/axios/lib/helpers/isAbsoluteURL.js", - "name": "./node_modules/axios/lib/helpers/isAbsoluteURL.js", - "file": "vendor.js" - } - ], - "./../helpers/isURLSameOrigin": [ - { - "id": "./node_modules/axios/lib/helpers/isURLSameOrigin.js", - "name": "./node_modules/axios/lib/helpers/isURLSameOrigin.js", - "file": "vendor.js" - } - ], - "./helpers/normalizeHeaderName": [ - { - "id": "./node_modules/axios/lib/helpers/normalizeHeaderName.js", - "name": "./node_modules/axios/lib/helpers/normalizeHeaderName.js", - "file": "vendor.js" - } - ], - "./../helpers/parseHeaders": [ - { - "id": "./node_modules/axios/lib/helpers/parseHeaders.js", - "name": "./node_modules/axios/lib/helpers/parseHeaders.js", - "file": "vendor.js" - } - ], - "./helpers/spread": [ - { - "id": "./node_modules/axios/lib/helpers/spread.js", - "name": "./node_modules/axios/lib/helpers/spread.js", - "file": "vendor.js" - } - ], - "./utils": [ - { - "id": "./node_modules/axios/lib/utils.js", - "name": "./node_modules/axios/lib/utils.js", - "file": "vendor.js" - } - ], - "babel-runtime/regenerator": [ - { - "id": "./node_modules/babel-runtime/regenerator/index.js", - "name": "./node_modules/babel-runtime/regenerator/index.js", - "file": "vendor.js" - } - ], - "fbjs/lib/ExecutionEnvironment": [ - { - "id": "./node_modules/fbjs/lib/ExecutionEnvironment.js", - "name": "./node_modules/fbjs/lib/ExecutionEnvironment.js", - "file": "vendor.js" - } - ], - "./camelize": [ - { - "id": "./node_modules/fbjs/lib/camelize.js", - "name": "./node_modules/fbjs/lib/camelize.js", - "file": "vendor.js" - } - ], - "fbjs/lib/camelizeStyleName": [ - { - "id": "./node_modules/fbjs/lib/camelizeStyleName.js", - "name": "./node_modules/fbjs/lib/camelizeStyleName.js", - "file": "vendor.js" - } - ], - "fbjs/lib/containsNode": [ - { - "id": "./node_modules/fbjs/lib/containsNode.js", - "name": "./node_modules/fbjs/lib/containsNode.js", - "file": "vendor.js" - } - ], - "fbjs/lib/emptyFunction": [ - { - "id": "./node_modules/fbjs/lib/emptyFunction.js", - "name": "./node_modules/fbjs/lib/emptyFunction.js", - "file": "vendor.js" - } - ], - "fbjs/lib/emptyObject": [ - { - "id": "./node_modules/fbjs/lib/emptyObject.js", - "name": "./node_modules/fbjs/lib/emptyObject.js", - "file": "vendor.js" - } - ], - "fbjs/lib/getActiveElement": [ - { - "id": "./node_modules/fbjs/lib/getActiveElement.js", - "name": "./node_modules/fbjs/lib/getActiveElement.js", - "file": "vendor.js" - } - ], - "./hyphenate": [ - { - "id": "./node_modules/fbjs/lib/hyphenate.js", - "name": "./node_modules/fbjs/lib/hyphenate.js", - "file": "vendor.js" - } - ], - "fbjs/lib/hyphenateStyleName": [ - { - "id": "./node_modules/fbjs/lib/hyphenateStyleName.js", - "name": "./node_modules/fbjs/lib/hyphenateStyleName.js", - "file": "vendor.js" - } - ], - "fbjs/lib/invariant": [ - { - "id": "./node_modules/fbjs/lib/invariant.js", - "name": "./node_modules/fbjs/lib/invariant.js", - "file": "vendor.js" - } - ], - "./isNode": [ - { - "id": "./node_modules/fbjs/lib/isNode.js", - "name": "./node_modules/fbjs/lib/isNode.js", - "file": "vendor.js" - } - ], - "./isTextNode": [ - { - "id": "./node_modules/fbjs/lib/isTextNode.js", - "name": "./node_modules/fbjs/lib/isTextNode.js", - "file": "vendor.js" - } - ], - "fbjs/lib/shallowEqual": [ - { - "id": "./node_modules/fbjs/lib/shallowEqual.js", - "name": "./node_modules/fbjs/lib/shallowEqual.js", - "file": "vendor.js" - } - ], - "fbjs/lib/warning": [ - { - "id": "./node_modules/fbjs/lib/warning.js", - "name": "./node_modules/fbjs/lib/warning.js", - "file": "vendor.js" - } - ], - "./DOMUtils": [ - { - "id": "./node_modules/history/DOMUtils.js", - "name": "./node_modules/history/DOMUtils.js", - "file": "vendor.js" - }, - { - "id": "./node_modules/history/es/DOMUtils.js", - "name": "./node_modules/history/es/DOMUtils.js", - "file": "vendor.js" - } - ], - "./LocationUtils": [ - { - "id": "./node_modules/history/LocationUtils.js", - "name": "./node_modules/history/LocationUtils.js", - "file": "vendor.js" - }, - { - "id": "./node_modules/history/es/LocationUtils.js", - "name": "./node_modules/history/es/LocationUtils.js", - "file": "vendor.js" - } - ], - "./PathUtils": [ - { - "id": "./node_modules/history/PathUtils.js", - "name": "./node_modules/history/PathUtils.js", - "file": "vendor.js" - }, - { - "id": "./node_modules/history/es/PathUtils.js", - "name": "./node_modules/history/es/PathUtils.js", - "file": "vendor.js" - } - ], - "history/createBrowserHistory": [ - { - "id": "./node_modules/history/createBrowserHistory.js", - "name": "./node_modules/history/createBrowserHistory.js", - "file": "vendor.js" - } - ], - "history/createHashHistory": [ - { - "id": "./node_modules/history/createHashHistory.js", - "name": "./node_modules/history/createHashHistory.js", - "file": "vendor.js" - } - ], - "history/createMemoryHistory": [ - { - "id": "./node_modules/history/createMemoryHistory.js", - "name": "./node_modules/history/createMemoryHistory.js", - "file": "vendor.js" - } - ], - "./createTransitionManager": [ - { - "id": "./node_modules/history/createTransitionManager.js", - "name": "./node_modules/history/createTransitionManager.js", - "file": "vendor.js" - }, - { - "id": "./node_modules/history/es/createTransitionManager.js", - "name": "./node_modules/history/es/createTransitionManager.js", - "file": "vendor.js" - } - ], - "./createBrowserHistory": [ - { - "id": "./node_modules/history/es/createBrowserHistory.js", - "name": "./node_modules/history/es/createBrowserHistory.js", - "file": "vendor.js" - } - ], - "./createHashHistory": [ - { - "id": "./node_modules/history/es/createHashHistory.js", - "name": "./node_modules/history/es/createHashHistory.js", - "file": "vendor.js" - } - ], - "./createMemoryHistory": [ - { - "id": "./node_modules/history/es/createMemoryHistory.js", - "name": "./node_modules/history/es/createMemoryHistory.js", - "file": "vendor.js" - } - ], - "history": [ - { - "id": "./node_modules/history/es/index.js", - "name": "./node_modules/history/es/index.js", - "file": "vendor.js" - } - ], - "hoist-non-react-statics": [ - { - "id": "./node_modules/hoist-non-react-statics/index.js", - "name": "./node_modules/hoist-non-react-statics/index.js", - "file": "vendor.js" - } - ], - "invariant": [ - { - "id": "./node_modules/invariant/browser.js", - "name": "./node_modules/invariant/browser.js", - "file": "vendor.js" - } - ], - "is-buffer": [ - { - "id": "./node_modules/is-buffer/index.js", - "name": "./node_modules/is-buffer/index.js", - "file": "vendor.js" - } - ], - "./_Symbol.js": [ - { - "id": "./node_modules/lodash-es/_Symbol.js", - "name": "./node_modules/lodash-es/_Symbol.js", - "file": "vendor.js" - } - ], - "./_baseGetTag.js": [ - { - "id": "./node_modules/lodash-es/_baseGetTag.js", - "name": "./node_modules/lodash-es/_baseGetTag.js", - "file": "vendor.js" - } - ], - "./_freeGlobal.js": [ - { - "id": "./node_modules/lodash-es/_freeGlobal.js", - "name": "./node_modules/lodash-es/_freeGlobal.js", - "file": "vendor.js" - } - ], - "./_getPrototype.js": [ - { - "id": "./node_modules/lodash-es/_getPrototype.js", - "name": "./node_modules/lodash-es/_getPrototype.js", - "file": "vendor.js" - } - ], - "./_getRawTag.js": [ - { - "id": "./node_modules/lodash-es/_getRawTag.js", - "name": "./node_modules/lodash-es/_getRawTag.js", - "file": "vendor.js" - } - ], - "./_objectToString.js": [ - { - "id": "./node_modules/lodash-es/_objectToString.js", - "name": "./node_modules/lodash-es/_objectToString.js", - "file": "vendor.js" - } - ], - "./_overArg.js": [ - { - "id": "./node_modules/lodash-es/_overArg.js", - "name": "./node_modules/lodash-es/_overArg.js", - "file": "vendor.js" - } - ], - "./_root.js": [ - { - "id": "./node_modules/lodash-es/_root.js", - "name": "./node_modules/lodash-es/_root.js", - "file": "vendor.js" - } - ], - "./isObjectLike.js": [ - { - "id": "./node_modules/lodash-es/isObjectLike.js", - "name": "./node_modules/lodash-es/isObjectLike.js", - "file": "vendor.js" - } - ], - "lodash-es/isPlainObject": [ - { - "id": "./node_modules/lodash-es/isPlainObject.js", - "name": "./node_modules/lodash-es/isPlainObject.js", - "file": "vendor.js" - } - ], - "object-assign": [ - { - "id": "./node_modules/object-assign/index.js", - "name": "./node_modules/object-assign/index.js", - "file": "vendor.js" - } - ], - "./../../process/browser.js": [ - { - "id": "./node_modules/process/browser.js", - "name": "./node_modules/process/browser.js", - "file": "vendor.js" - } - ], - "prop-types/checkPropTypes": [ - { - "id": "./node_modules/prop-types/checkPropTypes.js", - "name": "./node_modules/prop-types/checkPropTypes.js", - "file": "vendor.js" - } - ], - "./factoryWithTypeCheckers": [ - { - "id": "./node_modules/prop-types/factoryWithTypeCheckers.js", - "name": "./node_modules/prop-types/factoryWithTypeCheckers.js", - "file": "vendor.js" - } - ], - "prop-types": [ - { - "id": "./node_modules/prop-types/index.js", - "name": "./node_modules/prop-types/index.js", - "file": "vendor.js" - } - ], - "./lib/ReactPropTypesSecret": [ - { - "id": "./node_modules/prop-types/lib/ReactPropTypesSecret.js", - "name": "./node_modules/prop-types/lib/ReactPropTypesSecret.js", - "file": "vendor.js" - } - ], - "./cjs/react-dom.development.js": [ - { - "id": "./node_modules/react-dom/cjs/react-dom.development.js", - "name": "./node_modules/react-dom/cjs/react-dom.development.js", - "file": "vendor.js" - } - ], - "react-dom": [ - { - "id": "./node_modules/react-dom/index.js", - "name": "./node_modules/react-dom/index.js", - "file": "vendor.js" - } - ], - "react-loadable": [ - { - "id": "./node_modules/react-loadable/lib/index.js", - "name": "./node_modules/react-loadable/lib/index.js", - "file": "vendor.js" - } - ], - "./components/Provider": [ - { - "id": "./node_modules/react-redux/es/components/Provider.js", - "name": "./node_modules/react-redux/es/components/Provider.js", - "file": "vendor.js" - } - ], - "./components/connectAdvanced": [ - { - "id": "./node_modules/react-redux/es/components/connectAdvanced.js", - "name": "./node_modules/react-redux/es/components/connectAdvanced.js", - "file": "vendor.js" - } - ], - "./connect/connect": [ - { - "id": "./node_modules/react-redux/es/connect/connect.js", - "name": "./node_modules/react-redux/es/connect/connect.js", - "file": "vendor.js" - } - ], - "./mapDispatchToProps": [ - { - "id": "./node_modules/react-redux/es/connect/mapDispatchToProps.js", - "name": "./node_modules/react-redux/es/connect/mapDispatchToProps.js", - "file": "vendor.js" - } - ], - "./mapStateToProps": [ - { - "id": "./node_modules/react-redux/es/connect/mapStateToProps.js", - "name": "./node_modules/react-redux/es/connect/mapStateToProps.js", - "file": "vendor.js" - } - ], - "./mergeProps": [ - { - "id": "./node_modules/react-redux/es/connect/mergeProps.js", - "name": "./node_modules/react-redux/es/connect/mergeProps.js", - "file": "vendor.js" - } - ], - "./selectorFactory": [ - { - "id": "./node_modules/react-redux/es/connect/selectorFactory.js", - "name": "./node_modules/react-redux/es/connect/selectorFactory.js", - "file": "vendor.js" - } - ], - "./verifySubselectors": [ - { - "id": "./node_modules/react-redux/es/connect/verifySubselectors.js", - "name": "./node_modules/react-redux/es/connect/verifySubselectors.js", - "file": "vendor.js" - } - ], - "./wrapMapToProps": [ - { - "id": "./node_modules/react-redux/es/connect/wrapMapToProps.js", - "name": "./node_modules/react-redux/es/connect/wrapMapToProps.js", - "file": "vendor.js" - } - ], - "react-redux": [ - { - "id": "./node_modules/react-redux/es/index.js", - "name": "./node_modules/react-redux/es/index.js", - "file": "vendor.js" - } - ], - "../utils/PropTypes": [ - { - "id": "./node_modules/react-redux/es/utils/PropTypes.js", - "name": "./node_modules/react-redux/es/utils/PropTypes.js", - "file": "vendor.js" - } - ], - "../utils/Subscription": [ - { - "id": "./node_modules/react-redux/es/utils/Subscription.js", - "name": "./node_modules/react-redux/es/utils/Subscription.js", - "file": "vendor.js" - } - ], - "../utils/shallowEqual": [ - { - "id": "./node_modules/react-redux/es/utils/shallowEqual.js", - "name": "./node_modules/react-redux/es/utils/shallowEqual.js", - "file": "vendor.js" - } - ], - "../utils/verifyPlainObject": [ - { - "id": "./node_modules/react-redux/es/utils/verifyPlainObject.js", - "name": "./node_modules/react-redux/es/utils/verifyPlainObject.js", - "file": "vendor.js" - } - ], - "../utils/warning": [ - { - "id": "./node_modules/react-redux/es/utils/warning.js", - "name": "./node_modules/react-redux/es/utils/warning.js", - "file": "vendor.js" - } - ], - "react-router-config": [ - { - "id": "./node_modules/react-router-config/es/index.js", - "name": "./node_modules/react-router-config/es/index.js", - "file": "vendor.js" - } - ], - "./matchRoutes": [ - { - "id": "./node_modules/react-router-config/es/matchRoutes.js", - "name": "./node_modules/react-router-config/es/matchRoutes.js", - "file": "vendor.js" - } - ], - "./renderRoutes": [ - { - "id": "./node_modules/react-router-config/es/renderRoutes.js", - "name": "./node_modules/react-router-config/es/renderRoutes.js", - "file": "vendor.js" - } - ], - "./BrowserRouter": [ - { - "id": "./node_modules/react-router-dom/es/BrowserRouter.js", - "name": "./node_modules/react-router-dom/es/BrowserRouter.js", - "file": "vendor.js" - } - ], - "./HashRouter": [ - { - "id": "./node_modules/react-router-dom/es/HashRouter.js", - "name": "./node_modules/react-router-dom/es/HashRouter.js", - "file": "vendor.js" - } - ], - "./Link": [ - { - "id": "./node_modules/react-router-dom/es/Link.js", - "name": "./node_modules/react-router-dom/es/Link.js", - "file": "vendor.js" - } - ], - "./MemoryRouter": [ - { - "id": "./node_modules/react-router-dom/es/MemoryRouter.js", - "name": "./node_modules/react-router-dom/es/MemoryRouter.js", - "file": "vendor.js" - } - ], - "./NavLink": [ - { - "id": "./node_modules/react-router-dom/es/NavLink.js", - "name": "./node_modules/react-router-dom/es/NavLink.js", - "file": "vendor.js" - } - ], - "./Prompt": [ - { - "id": "./node_modules/react-router-dom/es/Prompt.js", - "name": "./node_modules/react-router-dom/es/Prompt.js", - "file": "vendor.js" - } - ], - "./Redirect": [ - { - "id": "./node_modules/react-router-dom/es/Redirect.js", - "name": "./node_modules/react-router-dom/es/Redirect.js", - "file": "vendor.js" - } - ], - "./Route": [ - { - "id": "./node_modules/react-router-dom/es/Route.js", - "name": "./node_modules/react-router-dom/es/Route.js", - "file": "vendor.js" - } - ], - "./Router": [ - { - "id": "./node_modules/react-router-dom/es/Router.js", - "name": "./node_modules/react-router-dom/es/Router.js", - "file": "vendor.js" - } - ], - "./StaticRouter": [ - { - "id": "./node_modules/react-router-dom/es/StaticRouter.js", - "name": "./node_modules/react-router-dom/es/StaticRouter.js", - "file": "vendor.js" - } - ], - "./Switch": [ - { - "id": "./node_modules/react-router-dom/es/Switch.js", - "name": "./node_modules/react-router-dom/es/Switch.js", - "file": "vendor.js" - } - ], - "react-router-dom": [ - { - "id": "./node_modules/react-router-dom/es/index.js", - "name": "./node_modules/react-router-dom/es/index.js", - "file": "vendor.js" - } - ], - "./matchPath": [ - { - "id": "./node_modules/react-router-dom/es/matchPath.js", - "name": "./node_modules/react-router-dom/es/matchPath.js", - "file": "vendor.js" - } - ], - "./withRouter": [ - { - "id": "./node_modules/react-router-dom/es/withRouter.js", - "name": "./node_modules/react-router-dom/es/withRouter.js", - "file": "vendor.js" - } - ], - "react-router/Route": [ - { - "id": "./node_modules/react-router/Route.js", - "name": "./node_modules/react-router/Route.js", - "file": "vendor.js" - } - ], - "react-router/Router": [ - { - "id": "./node_modules/react-router/Router.js", - "name": "./node_modules/react-router/Router.js", - "file": "vendor.js" - } - ], - "react-router/Switch": [ - { - "id": "./node_modules/react-router/Switch.js", - "name": "./node_modules/react-router/Switch.js", - "file": "vendor.js" - } - ], - "react-router/es/MemoryRouter": [ - { - "id": "./node_modules/react-router/es/MemoryRouter.js", - "name": "./node_modules/react-router/es/MemoryRouter.js", - "file": "vendor.js" - } - ], - "react-router/es/Prompt": [ - { - "id": "./node_modules/react-router/es/Prompt.js", - "name": "./node_modules/react-router/es/Prompt.js", - "file": "vendor.js" - } - ], - "react-router/es/Redirect": [ - { - "id": "./node_modules/react-router/es/Redirect.js", - "name": "./node_modules/react-router/es/Redirect.js", - "file": "vendor.js" - } - ], - "react-router/es/Route": [ - { - "id": "./node_modules/react-router/es/Route.js", - "name": "./node_modules/react-router/es/Route.js", - "file": "vendor.js" - } - ], - "react-router/es/Router": [ - { - "id": "./node_modules/react-router/es/Router.js", - "name": "./node_modules/react-router/es/Router.js", - "file": "vendor.js" - } - ], - "react-router/es/StaticRouter": [ - { - "id": "./node_modules/react-router/es/StaticRouter.js", - "name": "./node_modules/react-router/es/StaticRouter.js", - "file": "vendor.js" - } - ], - "react-router/es/Switch": [ - { - "id": "./node_modules/react-router/es/Switch.js", - "name": "./node_modules/react-router/es/Switch.js", - "file": "vendor.js" - } - ], - "react-router/es/matchPath": [ - { - "id": "./node_modules/react-router/es/matchPath.js", - "name": "./node_modules/react-router/es/matchPath.js", - "file": "vendor.js" - } - ], - "react-router/es/withRouter": [ - { - "id": "./node_modules/react-router/es/withRouter.js", - "name": "./node_modules/react-router/es/withRouter.js", - "file": "vendor.js" - } - ], - "react-router/matchPath": [ - { - "id": "./node_modules/react-router/matchPath.js", - "name": "./node_modules/react-router/matchPath.js", - "file": "vendor.js" - } - ], - "isarray": [ - { - "id": "./node_modules/react-router/node_modules/isarray/index.js", - "name": "./node_modules/react-router/node_modules/isarray/index.js", - "file": "vendor.js" - } - ], - "path-to-regexp": [ - { - "id": "./node_modules/react-router/node_modules/path-to-regexp/index.js", - "name": "./node_modules/react-router/node_modules/path-to-regexp/index.js", - "file": "vendor.js" - } - ], - "./cjs/react.development.js": [ - { - "id": "./node_modules/react/cjs/react.development.js", - "name": "./node_modules/react/cjs/react.development.js", - "file": "vendor.js" - } - ], - "react": [ - { - "id": "./node_modules/react/index.js", - "name": "./node_modules/react/index.js", - "file": "vendor.js" - } - ], - "redux-thunk": [ - { - "id": "./node_modules/redux-thunk/lib/index.js", - "name": "./node_modules/redux-thunk/lib/index.js", - "file": "vendor.js" - } - ], - "./applyMiddleware": [ - { - "id": "./node_modules/redux/es/applyMiddleware.js", - "name": "./node_modules/redux/es/applyMiddleware.js", - "file": "vendor.js" - } - ], - "./bindActionCreators": [ - { - "id": "./node_modules/redux/es/bindActionCreators.js", - "name": "./node_modules/redux/es/bindActionCreators.js", - "file": "vendor.js" - } - ], - "./combineReducers": [ - { - "id": "./node_modules/redux/es/combineReducers.js", - "name": "./node_modules/redux/es/combineReducers.js", - "file": "vendor.js" - } - ], - "./compose": [ - { - "id": "./node_modules/redux/es/compose.js", - "name": "./node_modules/redux/es/compose.js", - "file": "vendor.js" - } - ], - "./createStore": [ - { - "id": "./node_modules/redux/es/createStore.js", - "name": "./node_modules/redux/es/createStore.js", - "file": "vendor.js" - } - ], - "redux": [ - { - "id": "./node_modules/redux/es/index.js", - "name": "./node_modules/redux/es/index.js", - "file": "vendor.js" - } - ], - "./utils/warning": [ - { - "id": "./node_modules/redux/es/utils/warning.js", - "name": "./node_modules/redux/es/utils/warning.js", - "file": "vendor.js" - } - ], - "regenerator-runtime": [ - { - "id": "./node_modules/regenerator-runtime/runtime-module.js", - "name": "./node_modules/regenerator-runtime/runtime-module.js", - "file": "vendor.js" - } - ], - "./runtime": [ - { - "id": "./node_modules/regenerator-runtime/runtime.js", - "name": "./node_modules/regenerator-runtime/runtime.js", - "file": "vendor.js" - } - ], - "resolve-pathname": [ - { - "id": "./node_modules/resolve-pathname/index.js", - "name": "./node_modules/resolve-pathname/index.js", - "file": "vendor.js" - } - ], - "symbol-observable": [ - { - "id": "./node_modules/symbol-observable/es/index.js", - "name": "./node_modules/symbol-observable/es/index.js", - "file": "vendor.js" - } - ], - "./ponyfill.js": [ - { - "id": "./node_modules/symbol-observable/es/ponyfill.js", - "name": "./node_modules/symbol-observable/es/ponyfill.js", - "file": "vendor.js" - } - ], - "value-equal": [ - { - "id": "./node_modules/value-equal/index.js", - "name": "./node_modules/value-equal/index.js", - "file": "vendor.js" - } - ], - "warning": [ - { - "id": "./node_modules/warning/browser.js", - "name": "./node_modules/warning/browser.js", - "file": "vendor.js" - } - ], - "./../../webpack/buildin/global.js": [ - { - "id": "./node_modules/webpack/buildin/global.js", - "name": "./node_modules/webpack/buildin/global.js", - "file": "vendor.js" - } - ], - "./../../webpack/buildin/harmony-module.js": [ - { - "id": "./node_modules/webpack/buildin/harmony-module.js", - "name": "./node_modules/webpack/buildin/harmony-module.js", - "file": "vendor.js" - } - ] -} \ No newline at end of file diff --git a/src/components/Countries/index.js b/src/components/Countries/index.js index ee9522b..e076542 100644 --- a/src/components/Countries/index.js +++ b/src/components/Countries/index.js @@ -3,39 +3,61 @@ import { connect } from 'react-redux'; import { fetchCountries } from "../../action/countries"; import { Loading } from '../../common'; import CountriesItem from './CountriesItem'; +import Meta from "../../Utils/Meta"; -const m = ({ countries }) => ({ countries }); +class Countries extends Component { -@connect(m, { fetchCountries }) -export default class Countries extends Component { - - static fetching ({ dispatch }) { - return [dispatch(fetchCountries())]; + // static fetching({ dispatch }) { + // return [dispatch(fetchCountries())]; + // } + componentWillMount() { + this.props.dispatch(fetchCountries()); } componentDidMount() { - const { countries: { data } } = this.props; + const { Countries: { data } } = this.props; if (!data || data.length === 0) { - this.props.fetchCountries(); + this.props.dispatch(fetchCountries()); } } render() { - const { countries: { isFetching, data } } = this.props; + const { Countries: { isFetching, data } } = this.props; - if(isFetching) { + if (isFetching) { return } - return( -
-
- {data.map((item, i) => )} + const metaData = { + authors: "Authors", + title: "Home Title: Countries", + description: "countries description", + lastModified: "some date", + altTitle: "some alt-title", + canonical: "http://countries-canonical-url.com" + }; + + return ( + + +
+
+ {data.map((item, i) => )} +
-
+ ); } -}; \ No newline at end of file +}; +const mapStateToProps = state => { + return { + Countries: state.Countries + }; +}; + +export default connect( + mapStateToProps +)(Countries); \ No newline at end of file diff --git a/src/components/Country/index.js b/src/components/Country/index.js index 825523b..0324885 100644 --- a/src/components/Country/index.js +++ b/src/components/Country/index.js @@ -5,21 +5,21 @@ import { Loading } from "../../common"; import Meta from "../../Utils/Meta"; -const m = ({ country }) => ({ country }); +class Country extends Component { -@connect(m, { fetchCountry }) -export default class Country extends Component { - - static fetching({ dispatch, path }) { - return [dispatch(fetchCountry(path.substr(1)))]; + // static fetching({ dispatch, path }) { + // return [this.props.dispatch(fetchCountry(path.substr(1)))]; + // } + componentWillMount() { + this.props.dispatch(fetchCountry(this.props.match.params.name)); } componentDidMount() { - this.props.fetchCountry(this.props.match.params.name); + this.props.dispatch(fetchCountry(this.props.match.params.name)); } render() { - const { country: { isFetching, flag, name, nativeName, capital, region, population, languages } } = this.props; + const { Country: { isFetching, flag, name, nativeName, capital, region, population, languages } } = this.props; if (isFetching) { return ; @@ -28,10 +28,10 @@ export default class Country extends Component { const metaData = { authors: "Authors", title: name, - description: "some description", + description: "country description", lastModified: "some date", altTitle: "some alt-title", - canonical: "http://some-canonical-url.com" + canonical: "http://country-canonical-url.com" }; return ( @@ -74,4 +74,13 @@ export default class Country extends Component { ); } -} \ No newline at end of file +} +const mapStateToProps = state => { + return { + Country: state.Country + }; +}; + +export default connect( + mapStateToProps +)(Country); diff --git a/src/reducers/countries.js b/src/reducers/countries.js index cedc3c2..862897e 100644 --- a/src/reducers/countries.js +++ b/src/reducers/countries.js @@ -9,7 +9,7 @@ const INITIAL_STATE = { lastUpdate: Date.now() }; -export default (state = INITIAL_STATE, action) => { +const Countries = (state = INITIAL_STATE, action) => { switch (action.type) { case REQUEST_COUNTRIES: { return { ...state, isFetching: true }; @@ -20,4 +20,5 @@ export default (state = INITIAL_STATE, action) => { default: return state; } -}; \ No newline at end of file +}; +export default Countries; \ No newline at end of file diff --git a/src/reducers/country.js b/src/reducers/country.js index f3b2699..d4b69ea 100644 --- a/src/reducers/country.js +++ b/src/reducers/country.js @@ -15,8 +15,8 @@ const INITIAL_STATE = { lastUpdate: Date.now() }; -export default(state = INITIAL_STATE, action) => { - switch(action.type) { +const Country = (state = INITIAL_STATE, action) => { + switch (action.type) { case REQUEST_COUNTRY: { return { ...state, isFetching: true }; } @@ -25,4 +25,5 @@ export default(state = INITIAL_STATE, action) => { } default: return state; } -}; \ No newline at end of file +}; +export default Country; \ No newline at end of file diff --git a/src/reducers/index.js b/src/reducers/index.js index c17988e..5b76a7f 100644 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -3,6 +3,6 @@ import Countries from "./countries"; import Country from "./country"; export default combineReducers({ - countries: Countries, - country: Country, + Countries, + Country, }); \ No newline at end of file