├── src ├── app │ ├── views │ │ ├── home │ │ │ ├── home.scss │ │ │ ├── index.js │ │ │ └── Home.js │ │ ├── about │ │ │ ├── about.scss │ │ │ ├── index.js │ │ │ └── About.js │ │ ├── login │ │ │ ├── login.scss │ │ │ └── index.js │ │ ├── protected │ │ │ ├── protected.scss │ │ │ ├── index.js │ │ │ └── Protected.js │ │ ├── pageNotFound │ │ │ ├── pageNotFound.scss │ │ │ ├── index.js │ │ │ └── PageNotFound.js │ │ └── index.js │ ├── containers │ │ ├── index.js │ │ └── app │ │ │ ├── index.js │ │ │ └── App.js │ ├── mock │ │ ├── fakeAPI.json │ │ └── userInfosMock.json │ ├── style │ │ ├── _vars.scss │ │ ├── index.scss │ │ ├── common.scss │ │ └── _mixins.scss │ ├── config │ │ ├── index.js │ │ └── navigation.json │ ├── services │ │ ├── index.js │ │ ├── auth │ │ │ └── type.js │ │ ├── universal.js │ │ ├── utils │ │ │ └── getLocationOrigin.js │ │ └── API │ │ │ ├── example.js │ │ │ └── fetchTools.js │ ├── redux │ │ ├── store │ │ │ ├── configureStore.js │ │ │ ├── configureStore.prod.js │ │ │ └── configureStore.dev.js │ │ ├── modules │ │ │ ├── reducers.js │ │ │ ├── immutableRoute.js │ │ │ └── fakeModuleWithFetch.js │ │ └── middleware │ │ │ └── fetchMiddleware.js │ ├── components │ │ ├── index.js │ │ ├── jumbotron │ │ │ └── Jumbotron.js │ │ ├── navigation │ │ │ ├── humburger │ │ │ │ └── Humburger.js │ │ │ ├── leftNav │ │ │ │ ├── leftNavButton │ │ │ │ │ └── LeftNavButton.js │ │ │ │ └── LeftNav.js │ │ │ ├── rightNav │ │ │ │ ├── rightNavButton │ │ │ │ │ └── RightNavButton.js │ │ │ │ └── RightNav.js │ │ │ └── NavigationBar.js │ │ ├── backToTop │ │ │ ├── backToTopButton │ │ │ │ ├── UpIcon.js │ │ │ │ └── BackToTopButton.js │ │ │ ├── lib │ │ │ │ └── smoothScroll.js │ │ │ └── BackToTop.js │ │ ├── animatedView │ │ │ └── AnimatedView.js │ │ ├── logoutRoute │ │ │ └── LogoutRoute.js │ │ ├── routes │ │ │ ├── logoutRoute │ │ │ │ └── LogoutRoute.js │ │ │ └── privateRoute │ │ │ │ └── PrivateRoute.js │ │ ├── scrollToTop │ │ │ └── ScrollToTop.js │ │ └── privateRoute │ │ │ └── PrivateRoute.js │ ├── routes │ │ └── MainRoutes.js │ ├── index.js │ └── Root.js └── server │ └── SPA │ └── index.js ├── preview └── preview.png ├── test ├── redux │ ├── README.md │ ├── actions │ │ └── views.spec.js │ └── reducers │ │ └── views.spec.js ├── .setup.js ├── views │ ├── pageNotFound │ │ └── PageNotFound.spec.js │ ├── home │ │ └── Home.spec.js │ └── about │ │ └── About.spec.js ├── components │ ├── jumbotron │ │ └── Jumbotron.spec.js │ ├── NavigationBar │ │ ├── humburger │ │ │ └── Humburger.spec.js │ │ ├── leftNav │ │ │ └── leftNavButton │ │ │ │ └── LeftNavButton.spec.js │ │ ├── rightNav │ │ │ └── rightNavButton │ │ │ │ └── RightNavButton.spec.js │ │ └── NavigationBar.spec.js │ └── backToTop │ │ ├── backToTopButton │ │ ├── UpIcon.spec.js │ │ └── BackToTopButton.spec.js │ │ └── BackToTop.spec.js └── containers │ ├── app │ └── App.spec.js │ ├── about │ └── About.spec.js │ └── home │ └── Home.spec.js ├── .gitignore ├── docs ├── public │ └── assets │ │ ├── fontawesome-webfont.eot │ │ └── fontawesome-webfont.ttf └── index.html ├── jsconfig.json ├── .flowconfig ├── postcss.config.js ├── flow-typed ├── npm │ ├── flow-bin_v0.x.x.js │ ├── classnames_v2.x.x.js │ ├── font-awesome_vx.x.x.js │ ├── pretty-error_v2.x.x.js │ ├── react-modal_v1.x.x.js │ ├── helmet_vx.x.x.js │ ├── animate.css_vx.x.x.js │ ├── redux-mock-store_v1.2.x.js │ ├── url-loader_vx.x.x.js │ ├── compression_vx.x.x.js │ ├── file-loader_vx.x.x.js │ ├── json-loader_vx.x.x.js │ ├── expose-loader_vx.x.x.js │ ├── postcss-focus_vx.x.x.js │ ├── babel-preset-flow_vx.x.x.js │ ├── babel-preset-react_vx.x.x.js │ ├── babel-preset-es2015_vx.x.x.js │ ├── babel-preset-stage-0_vx.x.x.js │ ├── babel-preset-stage-2_vx.x.x.js │ ├── postcss-load-config_vx.x.x.js │ ├── serialize-javascript_vx.x.x.js │ ├── webpack-node-externals_vx.x.x.js │ ├── babel-preset-react-optimize_vx.x.x.js │ ├── rimraf_vx.x.x.js │ ├── chalk_vx.x.x.js │ ├── babel-plugin-transform-regenerator_vx.x.x.js │ ├── babel-plugin-transform-async-to-generator_vx.x.x.js │ ├── babel-preset-babili_vx.x.x.js │ ├── precss_vx.x.x.js │ ├── prop-types_v15.x.x.js │ ├── babel-register_vx.x.x.js │ ├── postcss-loader_vx.x.x.js │ ├── body-parser_v1.x.x.js │ ├── postcss-reporter_vx.x.x.js │ ├── webpack-dev-middleware_vx.x.x.js │ ├── redux-thunk_vx.x.x.js │ ├── cross-env_vx.x.x.js │ ├── dirty-chai_vx.x.x.js │ ├── react-tap-event-plugin_vx.x.x.js │ ├── style-loader_vx.x.x.js │ ├── redux-logger_vx.x.x.js │ ├── redux-devtools-extension_vx.x.x.js │ ├── babel-loader_vx.x.x.js │ ├── babel-polyfill_vx.x.x.js │ ├── sass-loader_vx.x.x.js │ ├── postcss-import_vx.x.x.js │ ├── js-base64_vx.x.x.js │ ├── react-addons-test-utils_v15.x.x.js │ ├── jwt-decode_vx.x.x.js │ ├── webpack-hot-middleware_vx.x.x.js │ ├── redux-immutable_vx.x.x.js │ ├── postcss-cssnext_vx.x.x.js │ ├── extract-text-webpack-plugin_vx.x.x.js │ ├── babel-eslint_vx.x.x.js │ ├── css-loader_vx.x.x.js │ ├── react-redux_v4.x.x.js │ ├── nyc_vx.x.x.js │ └── babel-cli_vx.x.x.js └── interface │ └── global.js ├── .editorconfig ├── typings.json ├── .travis.yml ├── .babelrc ├── typings ├── globals │ ├── node │ │ └── typings.json │ ├── axios │ │ └── typings.json │ ├── redux │ │ └── typings.json │ ├── jquery │ │ └── typings.json │ ├── moment │ │ └── typings.json │ ├── classnames │ │ ├── typings.json │ │ └── index.d.ts │ ├── immutable │ │ └── typings.json │ ├── react-router │ │ ├── typings.json │ │ └── index.d.ts │ ├── redux-thunk │ │ ├── typings.json │ │ └── index.d.ts │ └── react-router-dom │ │ ├── typings.json │ │ └── index.d.ts ├── modules │ ├── react │ │ └── typings.json │ ├── react-redux │ │ └── typings.json │ ├── react-motion │ │ └── typings.json │ └── react-bootstrap │ │ └── typings.json └── index.d.ts ├── index.html ├── server.hot.reload.js ├── webpack.hot.reload.config.js ├── webpack.server.ssr.config.js └── webpack.dev.config.js /src/app/views/home/home.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/views/about/about.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/views/login/login.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/views/protected/protected.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/views/pageNotFound/pageNotFound.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/containers/index.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | export { default as App } from './app/App'; 4 | -------------------------------------------------------------------------------- /preview/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MacKentoch/react-redux-immutable-webpack-ssr-starter/HEAD/preview/preview.png -------------------------------------------------------------------------------- /src/app/views/pageNotFound/index.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | import PageNotFound from './PageNotFound'; 3 | 4 | export default PageNotFound; 5 | -------------------------------------------------------------------------------- /test/redux/README.md: -------------------------------------------------------------------------------- 1 | # testing redux 2 | 3 | how to test redux :[redux.js.org](http://redux.js.org/docs/recipes/WritingTests.html) 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .vscode/ 3 | .idea/ 4 | *.log 5 | 6 | build/ 7 | dist/ 8 | public/assets/ 9 | /coverage 10 | /.nyc_output 11 | -------------------------------------------------------------------------------- /src/app/mock/fakeAPI.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 1, 4 | "label": "item 1" 5 | }, 6 | { 7 | "id": 2, 8 | "label": "item 2" 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /docs/public/assets/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MacKentoch/react-redux-immutable-webpack-ssr-starter/HEAD/docs/public/assets/fontawesome-webfont.eot -------------------------------------------------------------------------------- /docs/public/assets/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MacKentoch/react-redux-immutable-webpack-ssr-starter/HEAD/docs/public/assets/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "typeAcquisition": { 3 | "include": [ 4 | "react", 5 | "redux", 6 | "react-router", 7 | "immutable" 8 | ] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/app/style/_vars.scss: -------------------------------------------------------------------------------- 1 | $MAIN_COLOR : #000; 2 | 3 | // container definition 4 | $CONTAINER_CUSTOM_PADDING_LEFT : 2%; 5 | $CONTAINER_CUSTOM_PADDING_RIGHT : $CONTAINER_CUSTOM_PADDING_LEFT; 6 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | ./interfaces/global.js 7 | 8 | [options] 9 | module.name_mapper='.*\(.css\)' -> 'CSSModule' 10 | module.system=haste 11 | strip_root=true 12 | -------------------------------------------------------------------------------- /src/app/config/index.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | export const appConfig = { 4 | DEV_MODE: true, // flag to fetch mock or real fetch 5 | 6 | api: { 7 | fakeEndPoint: 'api/somewhere' 8 | } 9 | }; 10 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | module.exports = { 4 | plugins: { 5 | 'postcss-import': {}, 6 | 'postcss-cssnext': { 7 | browsers: ['last 2 versions', '>5%'] 8 | } 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /src/app/services/index.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import * as fetchTools from './API/fetchTools'; 4 | import {getSomething} from './API/example'; 5 | 6 | export { 7 | fetchTools, 8 | getSomething 9 | }; 10 | -------------------------------------------------------------------------------- /flow-typed/npm/flow-bin_v0.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 6a5610678d4b01e13bbfbbc62bdaf583 2 | // flow-typed version: 3817bc6980/flow-bin_v0.x.x/flow_>=v0.25.x 3 | 4 | declare module "flow-bin" { 5 | declare module.exports: string; 6 | } 7 | -------------------------------------------------------------------------------- /src/app/redux/store/configureStore.js: -------------------------------------------------------------------------------- 1 | /* eslint no-process-env:0 */ 2 | if (process.env.NODE_ENV === 'production') { 3 | module.exports = require('./configureStore.prod'); 4 | } else { 5 | module.exports = require('./configureStore.dev'); 6 | } 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | insert_final_newline = true 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /src/app/services/auth/type.js: -------------------------------------------------------------------------------- 1 | 2 | // @flow 3 | 4 | export type STORES_TYPES = 5 | | 'localStorage' 6 | | 'sessionStorage'; 7 | 8 | export type Storage = STORES_TYPES 9 | export type TokenKey = string; 10 | export type UserInfoKey = string; 11 | -------------------------------------------------------------------------------- /src/app/components/index.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | export { default as Jumbotron } from './jumbotron/Jumbotron'; 4 | export { default as NavigationBar } from './navigation/NavigationBar'; 5 | export { default as BackToTop } from './backToTop/BackToTop'; 6 | -------------------------------------------------------------------------------- /typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-redux-immutable-webpack-starter", 3 | "dependencies": {}, 4 | "globalDependencies": { 5 | "node": "registry:dt/node#7.0.0+20170322231424", 6 | "react-router-dom": "registry:dt/react-router-dom#4.0.0+20170323201651" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/app/style/index.scss: -------------------------------------------------------------------------------- 1 | // common 2 | @import "./common"; 3 | // views: 4 | @import "../views/home/home"; 5 | @import "../views/about/about"; 6 | @import "../views/login/login"; 7 | @import "../views/protected/protected"; 8 | @import "../views/pageNotFound/pageNotFound" 9 | 10 | // components: 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: node_js 3 | node_js: 4 | - 6 5 | - 8 6 | sudo: false 7 | cache: 8 | directories: 9 | - node_modules 10 | before_install: 11 | - export DISPLAY=:99.0 12 | - sh -e /etc/init.d/xvfb start 13 | before_script: 14 | - npm install 15 | after_success: npm run coverage 16 | -------------------------------------------------------------------------------- /src/app/services/universal.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | 4 | /** 5 | * when in a universal application, this function will help telling you if you can use window object (not server side) 6 | * 7 | * @export 8 | * @returns 9 | */ 10 | export function isBrowserSide(): boolean { 11 | return typeof window === 'object'; 12 | } 13 | -------------------------------------------------------------------------------- /src/app/views/index.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | export { default as About } from './about/About'; 4 | export { default as Home } from './home/Home'; 5 | export { default as PageNotFound } from './pageNotFound/PageNotFound'; 6 | export { default as Login } from './login'; 7 | export { default as Protected } from './protected'; 8 | -------------------------------------------------------------------------------- /src/app/style/common.scss: -------------------------------------------------------------------------------- 1 | @import "./_vars"; 2 | @import "./_mixins"; 3 | 4 | .containersCustom { 5 | padding-left: $CONTAINER_CUSTOM_PADDING_LEFT; 6 | padding-right: $CONTAINER_CUSTOM_PADDING_RIGHT; 7 | } 8 | 9 | .invisible { 10 | opacity: 0; 11 | } 12 | 13 | .view-enter { 14 | @include fade-in(0s, 0.7s, ease-in); 15 | z-index: 9999; 16 | } 17 | -------------------------------------------------------------------------------- /flow-typed/interface/global.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-unused-vars */ 2 | 3 | // for import 'somestyle.css': 4 | declare module CSSModule { 5 | declare var exports: { [key: string]: string }; 6 | } 7 | 8 | // for module.hot.reload: 9 | declare var module : { 10 | hot : { 11 | accept(path:string, callback:() => void): void; 12 | }; 13 | }; 14 | 15 | // for jQuery: 16 | declare var $: any; 17 | -------------------------------------------------------------------------------- /src/app/services/utils/getLocationOrigin.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | export const getLocationOrigin: () => string = () => { 4 | if (!window.location.origin) { 5 | window.location.origin = `${window.location.protocol}//${window.location.hostname}${window.location.port ? ':' + window.location.port : ''}`; 6 | } 7 | return window.location.origin; 8 | }; 9 | 10 | export default getLocationOrigin; 11 | -------------------------------------------------------------------------------- /src/app/components/jumbotron/Jumbotron.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React from 'react'; 4 | import PropTypes from 'prop-types'; 5 | 6 | const Jumbotron = ({ 7 | children 8 | }) => ( 9 |
10 | { children } 11 |
12 | ); 13 | 14 | Jumbotron.propTypes = { 15 | children: PropTypes.node 16 | }; 17 | 18 | export default Jumbotron; 19 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["es2015"], 4 | "react", 5 | "stage-2", 6 | "flow" 7 | ], 8 | "plugins": [ 9 | "react-hot-loader/babel", 10 | "transform-regenerator", 11 | "transform-async-to-generator" 12 | ], 13 | "env": { 14 | "production": { 15 | "presets": [ 16 | "react-optimize" 17 | ], 18 | "comments": false 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /typings/globals/node/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/a4a912a0cd1849fa7df0e5d909c8625fba04e49d/node/index.d.ts", 5 | "raw": "registry:dt/node#7.0.0+20170322231424", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/a4a912a0cd1849fa7df0e5d909c8625fba04e49d/node/index.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/globals/axios/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/e6215d4444ef44a38cd760817e955ce19b522032/axios/axios.d.ts", 5 | "raw": "registry:dt/axios#0.9.1+20161016142654", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/e6215d4444ef44a38cd760817e955ce19b522032/axios/axios.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/globals/redux/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/15ddcf312782faf9e7fdfe724a3a29382a5825d7/redux/redux.d.ts", 5 | "raw": "registry:dt/redux#3.5.2+20160703092728", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/15ddcf312782faf9e7fdfe724a3a29382a5825d7/redux/redux.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/modules/react/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6ffca66c9d1edfdfa1f42f8d82db59e4297e302b/react/index.d.ts", 5 | "raw": "registry:dt/react#15.0.0+20170324160437", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6ffca66c9d1edfdfa1f42f8d82db59e4297e302b/react/index.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/globals/jquery/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/f4fdcaca9c94f90442dcedb0c8a84399c47e731f/jquery/index.d.ts", 5 | "raw": "registry:dt/jquery#1.10.0+20170310222111", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/f4fdcaca9c94f90442dcedb0c8a84399c47e731f/jquery/index.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/app/redux/modules/reducers.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import { combineReducers } from 'redux-immutable'; 4 | import routerReducer from './immutableRoute'; 5 | import views from './views'; 6 | import userAuth from './userAuth'; 7 | 8 | export const reducers = { 9 | views, 10 | userAuth 11 | }; 12 | 13 | export default combineReducers({ 14 | ...reducers, 15 | routing: routerReducer 16 | }); 17 | -------------------------------------------------------------------------------- /typings/globals/moment/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/637e7d6df755e785387d5269cb9287cdc51b8cb7/moment/moment.d.ts", 5 | "raw": "registry:dt/moment#2.11.1+20161010105546", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/637e7d6df755e785387d5269cb9287cdc51b8cb7/moment/moment.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/globals/classnames/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/cf21303edea9abd919ecdab84698c6ab8513b1c2/classnames/index.d.ts", 5 | "raw": "registry:dt/classnames#0.0.0+20161113184211", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/cf21303edea9abd919ecdab84698c6ab8513b1c2/classnames/index.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/globals/immutable/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/a37e6d24dcf6fbac1018317777fa5811eb6c8ddb/immutable/immutable.d.ts", 5 | "raw": "registry:dt/immutable#3.8.1+20161028131303", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/a37e6d24dcf6fbac1018317777fa5811eb6c8ddb/immutable/immutable.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/modules/react-redux/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/2cd144e34366074840e96a48bb99690270775079/react-redux/index.d.ts", 5 | "raw": "registry:dt/react-redux#4.4.0+20170315101812", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/2cd144e34366074840e96a48bb99690270775079/react-redux/index.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/globals/react-router/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/984933df7c89afcb97e42adbe37b6df5dd7b253c/react-router/index.d.ts", 5 | "raw": "registry:dt/react-router#4.0.0+20170323201651", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/984933df7c89afcb97e42adbe37b6df5dd7b253c/react-router/index.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/modules/react-motion/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9b5329839558a78550bf078c3e5f323c2f0f3b86/react-motion/index.d.ts", 5 | "raw": "registry:dt/react-motion#0.0.0+20170123203653", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9b5329839558a78550bf078c3e5f323c2f0f3b86/react-motion/index.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/globals/redux-thunk/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/d417f687ab0c81ed72bffbc5dace5f643369bb70/redux-thunk/redux-thunk.d.ts", 5 | "raw": "registry:dt/redux-thunk#2.1.0+20160703120921", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/d417f687ab0c81ed72bffbc5dace5f643369bb70/redux-thunk/redux-thunk.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/modules/react-bootstrap/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/0f535159029908a2b5e068391b399e4d9a562d69/react-bootstrap/index.d.ts", 5 | "raw": "registry:dt/react-bootstrap#0.0.0+20170317163524", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/0f535159029908a2b5e068391b399e4d9a562d69/react-bootstrap/index.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/globals/react-router-dom/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/984933df7c89afcb97e42adbe37b6df5dd7b253c/react-router-dom/index.d.ts", 5 | "raw": "registry:dt/react-router-dom#4.0.0+20170323201651", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/984933df7c89afcb97e42adbe37b6df5dd7b253c/react-router-dom/index.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/app/views/pageNotFound/PageNotFound.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React, { 4 | PureComponent 5 | } from 'react'; 6 | import {Jumbotron} from '../../components'; 7 | 8 | class PageNotFound extends PureComponent { 9 | render() { 10 | return( 11 |
12 | 13 |

14 | Sorry this page does not exists... 15 |

16 |
17 |
18 | ); 19 | } 20 | } 21 | 22 | export default PageNotFound; 23 | -------------------------------------------------------------------------------- /src/app/mock/userInfosMock.json: -------------------------------------------------------------------------------- 1 | { 2 | "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJkZW1vIiwiaWF0IjoxNTAyMzA3MzU0LCJleHAiOjE3MjMyMzIxNTQsImF1ZCI6ImRlbW8tZGVtbyIsInN1YiI6ImRlbW8iLCJHaXZlbk5hbWUiOiJKb2huIiwiU3VybmFtZSI6IkRvZSIsIkVtYWlsIjoiam9obi5kb2VAZXhhbXBsZS5jb20iLCJSb2xlIjpbIlN1cGVyIGNvb2wgZGV2IiwibWFnaWMgbWFrZXIiXX0.6FjgLCypaqmRp4tDjg_idVKIzQw16e-z_rjA3R94IqQ", 3 | "user": { 4 | "id": 111, 5 | "login": "john.doe@fake.mail", 6 | "firstname": "John", 7 | "lastname": "Doe", 8 | "isAdmin": true 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /flow-typed/npm/classnames_v2.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 04e310e8c98cdb5de377193da621970b 2 | // flow-typed version: 7fd0a6404e/classnames_v2.x.x/flow_>=v0.25.x 3 | 4 | type $npm$classnames$Classes = 5 | | string 6 | | { [className: string]: * } 7 | | Array 8 | | false 9 | | void 10 | | null; 11 | 12 | declare module 'classnames' { 13 | declare function exports(...classes: Array<$npm$classnames$Classes>): string; 14 | } 15 | 16 | declare module 'classnames/bind' { 17 | declare module.exports: $Exports<'classnames'>; 18 | } 19 | -------------------------------------------------------------------------------- /src/app/components/navigation/humburger/Humburger.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React from 'react'; 4 | 5 | const Humburger = () => ( 6 | 18 | ); 19 | 20 | export default Humburger; 21 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ReactJS Redux Immutable Starter 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /flow-typed/npm/font-awesome_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 09dadd446089dd3640453bf3a5d37fd1 2 | // flow-typed version: <>/font-awesome_v^4.7.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'font-awesome' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'font-awesome' { 17 | declare module.exports: any; 18 | } 19 | -------------------------------------------------------------------------------- /test/.setup.js: -------------------------------------------------------------------------------- 1 | require('babel-register')(); 2 | 3 | const { jsdom } = require('jsdom'); 4 | 5 | const exposedProperties = ['window', 'navigator', 'document']; 6 | 7 | global.document = jsdom(''); 8 | global.window = document.defaultView; 9 | Object.keys(document.defaultView).forEach((property) => { 10 | if (typeof global[property] === 'undefined') { 11 | exposedProperties.push(property); 12 | global[property] = document.defaultView[property]; 13 | } 14 | }); 15 | 16 | global.navigator = { 17 | userAgent: 'node.js' 18 | }; 19 | 20 | var documentRef; 21 | documentRef = document; 22 | -------------------------------------------------------------------------------- /src/app/redux/modules/immutableRoute.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import { fromJS } from 'immutable'; 4 | 5 | // this constant comes from react-redux-router (we are just overriding the reducer) 6 | import { LOCATION_CHANGE } from 'react-router-redux'; 7 | 8 | // ///////////////// 9 | // reducer 10 | // ///////////////// 11 | const initialState = fromJS({ 12 | locationBeforeTransitions: null 13 | }); 14 | 15 | export default function (state = initialState, action) { 16 | if (action.type === LOCATION_CHANGE) { 17 | return state.set('locationBeforeTransitions', action.payload); 18 | } 19 | 20 | return state; 21 | } 22 | -------------------------------------------------------------------------------- /src/app/redux/store/configureStore.prod.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import { 4 | createStore, 5 | applyMiddleware, 6 | compose 7 | } from 'redux'; 8 | import thunkMiddleware from 'redux-thunk'; 9 | import reducer from '../modules/reducers'; 10 | import fetchMiddleware from '../middleware/fetchMiddleware'; 11 | 12 | // createStore : enhancer 13 | const enhancer = compose( 14 | applyMiddleware( 15 | thunkMiddleware, 16 | fetchMiddleware 17 | ) 18 | ); 19 | 20 | export default function configureStore(initialState) { 21 | return createStore(reducer, initialState, enhancer); 22 | } 23 | -------------------------------------------------------------------------------- /typings/globals/classnames/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/cf21303edea9abd919ecdab84698c6ab8513b1c2/classnames/index.d.ts 3 | declare type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null | false; 4 | 5 | interface ClassDictionary { 6 | [id: string]: boolean | undefined | null; 7 | } 8 | 9 | interface ClassArray extends Array { } 10 | 11 | interface ClassNamesFn { 12 | (...classes: ClassValue[]): string; 13 | } 14 | 15 | declare var classNames: ClassNamesFn; 16 | 17 | declare module "classnames" { 18 | export = classNames 19 | } 20 | -------------------------------------------------------------------------------- /typings/globals/redux-thunk/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/d417f687ab0c81ed72bffbc5dace5f643369bb70/redux-thunk/redux-thunk.d.ts 3 | declare namespace Redux { 4 | type ThunkAction = (dispatch: Dispatch, getState: () => S, extraArgument: E) => R; 5 | 6 | interface Dispatch { 7 | (asyncAction: ThunkAction): R; 8 | } 9 | } 10 | 11 | declare module "redux-thunk" { 12 | import { Middleware } from "redux"; 13 | 14 | const thunk: Middleware & { 15 | withExtraArgument(extraArgument: any): Middleware; 16 | }; 17 | 18 | export default thunk; 19 | } 20 | -------------------------------------------------------------------------------- /test/views/pageNotFound/PageNotFound.spec.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import chai, {expect} from 'chai'; 3 | import {shallow} from 'enzyme'; 4 | import PageNotFound from '../../../src/app/views/pageNotFound/PageNotFound'; 5 | import dirtyChai from 'dirty-chai'; 6 | 7 | chai.use(dirtyChai); 8 | 9 | describe('PageNotFound (PageNotFound view) ', () => { 10 | it('should render "PageNotFound" view', () => { 11 | const wrapper = shallow(); 12 | 13 | expect(wrapper.node).to.exist(); 14 | expect(wrapper.containsMatchingElement(

Sorry this page does not exists...

)); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /test/components/jumbotron/Jumbotron.spec.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { 3 | shallow 4 | } from 'enzyme'; 5 | import chai, {expect} from 'chai'; 6 | import dirtyChai from 'dirty-chai'; 7 | 8 | import { Jumbotron } from '../../../src/app/components'; 9 | 10 | // avoid to eslint-disable for chai no-unsued-expressions 11 | chai.use(dirtyChai); 12 | 13 | describe('', () => { 14 | const props = {children:

test

}; 15 | 16 | it('should render a children', () => { 17 | const wrapper = shallow(); 18 | expect(wrapper.containsMatchingElement(

test

)).to.equal(true); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /src/app/containers/app/index.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import { connect } from 'react-redux'; 4 | import { bindActionCreators } from 'redux'; 5 | import * as viewsActions from '../../redux/modules/views'; 6 | import App from './App'; 7 | 8 | const mapStateToProps = (state) => { 9 | return { 10 | currentView: state.getIn(['views', 'currentView']) 11 | }; 12 | }; 13 | 14 | const mapDispatchToProps = (dispatch) => { 15 | return { 16 | actions : bindActionCreators( 17 | { 18 | ...viewsActions 19 | }, 20 | dispatch) 21 | }; 22 | }; 23 | 24 | export default connect( 25 | mapStateToProps, 26 | mapDispatchToProps 27 | )(App); 28 | -------------------------------------------------------------------------------- /src/app/services/API/example.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import axios from 'axios'; 4 | import { 5 | getMethod, 6 | jsonHeader, 7 | defaultOptions, 8 | getLocationOrigin 9 | } from './fetchTools'; 10 | 11 | export const getSomething = (endpoint = 'api/getSomethingByDefault') => { 12 | const method = getMethod.method; 13 | const headers = jsonHeader; 14 | const url = `${getLocationOrigin()}/${endpoint}`; 15 | const options = {...defaultOptions}; 16 | 17 | return axios.request({ 18 | method, 19 | url, 20 | withCredentials: true, 21 | ...headers, 22 | ...options 23 | }) 24 | .then(data => data) 25 | .catch(error => Promise.reject(error)); 26 | }; 27 | -------------------------------------------------------------------------------- /src/app/views/home/index.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import { connect } from 'react-redux'; 4 | import { bindActionCreators } from 'redux'; 5 | import * as viewsActions from '../../redux/modules/views'; 6 | import Home from './Home'; 7 | 8 | const mapStateToProps = (state) => { 9 | return { 10 | currentView: state.getIn(['views', 'currentView']) 11 | }; 12 | }; 13 | 14 | const mapDispatchToProps = (dispatch) => { 15 | return bindActionCreators( 16 | { 17 | enterHome: viewsActions.enterHome, 18 | leaveHome: viewsActions.leaveHome 19 | }, 20 | dispatch 21 | ); 22 | }; 23 | 24 | export default connect( 25 | mapStateToProps, 26 | mapDispatchToProps 27 | )(Home); 28 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ReactJS Redux Immutable Starter 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/app/views/about/index.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import { connect } from 'react-redux'; 4 | import { bindActionCreators } from 'redux'; 5 | import * as viewsActions from '../../redux/modules/views'; 6 | import About from './About'; 7 | 8 | 9 | const mapStateToProps = (state) => { 10 | return { 11 | currentView: state.getIn(['views', 'currentView']) 12 | }; 13 | }; 14 | 15 | const mapDispatchToProps = (dispatch) => { 16 | return bindActionCreators( 17 | { 18 | enterAbout: viewsActions.enterAbout, 19 | leaveAbout: viewsActions.leaveAbout 20 | }, 21 | dispatch 22 | ); 23 | }; 24 | 25 | export default connect( 26 | mapStateToProps, 27 | mapDispatchToProps 28 | )(About); 29 | -------------------------------------------------------------------------------- /flow-typed/npm/pretty-error_v2.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 83d75e86e6973012d1ae78bc77eb1fc4 2 | // flow-typed version: b43dff3e0e/pretty-error_v2.x.x/flow_>=v0.16.x 3 | 4 | declare module 'pretty-error' { 5 | declare class PrettyError { 6 | static constructor(): PrettyError; 7 | static start(): void; 8 | alias(toBeAliased: string, alias: string): void; 9 | appendStyle(style: Object): void; 10 | render(error: Error): void; 11 | skip(skipFn: (traceline: Object, lineNumber: number) => bool): void; 12 | skipNodeFiles(): void; 13 | skipPackage(...packages: string[]): void; 14 | skipPath(path: string): void; 15 | start(): void; 16 | withoutColors(): void; 17 | } 18 | declare var exports: Class; 19 | } 20 | -------------------------------------------------------------------------------- /src/app/components/backToTop/backToTopButton/UpIcon.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | 4 | const UpIcon = ({ 5 | color 6 | }) => ( 7 | 12 | 14 | 15 | ); 16 | 17 | 18 | UpIcon.propTypes = { 19 | color: PropTypes.string 20 | }; 21 | 22 | UpIcon.defaultProps = { 23 | color: '#F1F1F1' 24 | }; 25 | 26 | export default UpIcon; 27 | -------------------------------------------------------------------------------- /src/app/config/navigation.json: -------------------------------------------------------------------------------- 1 | { 2 | "brand": "React Redux Immutable webpack ssr Starter", 3 | "leftLinks": [], 4 | "rightLinks": [ 5 | { 6 | "label": "Home", 7 | "link": "/", 8 | "view": "home", 9 | "isRouteBtn": true 10 | }, 11 | { 12 | "label": "Protected", 13 | "link": "/protected", 14 | "view": "protected", 15 | "isRouteBtn": true 16 | }, 17 | { 18 | "label": "About", 19 | "link": "/about", 20 | "view": "about", 21 | "isRouteBtn": true 22 | }, 23 | { 24 | "label": "Disconnect", 25 | "link": "/login", 26 | "view": "login", 27 | "isRouteBtn": true 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /src/app/routes/MainRoutes.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React from 'react'; 4 | import { 5 | Route, 6 | Switch 7 | } from 'react-router'; 8 | import Home from '../views/home'; 9 | import About from '../views/about'; 10 | import Protected from '../views/protected'; 11 | import PrivateRoute from '../components/privateRoute/PrivateRoute'; 12 | 13 | 14 | const MainRoutes = () => { 15 | return ( 16 | 17 | 18 | 19 | {/* private views: need user to be authenticated */} 20 | 21 | 22 | ); 23 | }; 24 | 25 | export default MainRoutes; 26 | -------------------------------------------------------------------------------- /src/app/views/protected/index.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import { connect } from 'react-redux'; 4 | import { bindActionCreators } from 'redux'; 5 | import * as viewsActions from '../../redux/modules/views'; 6 | import Protected from './Protected'; 7 | 8 | 9 | const mapStateToProps = (state) => { 10 | return { 11 | // views 12 | currentView: state.getIn(['views', 'currentView']) 13 | }; 14 | }; 15 | 16 | const mapDispatchToProps = (dispatch) => { 17 | return bindActionCreators( 18 | { 19 | // views 20 | enterProtected: viewsActions.enterProtected, 21 | leaveProtected: viewsActions.leaveProtected 22 | }, 23 | dispatch 24 | ); 25 | }; 26 | 27 | export default connect( 28 | mapStateToProps, 29 | mapDispatchToProps 30 | )(Protected); 31 | -------------------------------------------------------------------------------- /typings/index.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | /// 9 | /// 10 | /// 11 | /// 12 | /// 13 | /// 14 | /// 15 | -------------------------------------------------------------------------------- /test/containers/app/App.spec.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {expect} from 'chai'; 3 | import {shallow} from 'enzyme'; 4 | import configureMockStore from 'redux-mock-store'; 5 | import thunk from 'redux-thunk'; 6 | import App from '../../../src/app/containers/app/App'; 7 | import { fromJS } from 'immutable'; 8 | 9 | const mockStore = configureMockStore([ thunk ]); 10 | const storeStateMock = fromJS({ 11 | views: { 12 | currentView: 'home' 13 | } 14 | }); 15 | 16 | let store; 17 | let wrapper; 18 | describe('App', () => { 19 | beforeEach(() => { 20 | store = mockStore(storeStateMock); 21 | wrapper = shallow().shallow(); 22 | }); 23 | 24 | it('should render ', () => { 25 | expect(wrapper.find('NavigationBar').length).to.equal(1); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/components/animatedView/AnimatedView.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React, { Component } from 'react'; 4 | import PropTypes from 'prop-types'; 5 | import cx from 'classnames'; 6 | // import { withRouter } from 'react-router-dom'; 7 | 8 | class AnimatedView extends Component { 9 | static propTypes = { 10 | children: PropTypes.node, 11 | animated: PropTypes.bool 12 | }; 13 | 14 | static defaultProps = { 15 | animated: true 16 | }; 17 | 18 | render() { 19 | const { 20 | animated, 21 | children 22 | } = this.props; 23 | 24 | return ( 25 |
32 | { children } 33 |
34 | ); 35 | } 36 | } 37 | 38 | export default AnimatedView; 39 | -------------------------------------------------------------------------------- /src/app/components/logoutRoute/LogoutRoute.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React, { 4 | PureComponent 5 | } from 'react'; 6 | import PropTypes from 'prop-types'; 7 | import { 8 | Route, 9 | Redirect, 10 | withRouter 11 | } from 'react-router-dom'; 12 | import auth from '../../services/auth'; 13 | 14 | class LogoutRoute extends PureComponent { 15 | static propTypes = { 16 | // react-router 4: 17 | match: PropTypes.object.isRequired, 18 | location: PropTypes.object.isRequired, 19 | history: PropTypes.object.isRequired 20 | }; 21 | 22 | componentDidMount() { 23 | auth.clearAllAppStorage(); 24 | } 25 | 26 | render() { 27 | return ( 28 | 29 | 30 | 31 | ); 32 | } 33 | } 34 | 35 | export default withRouter(LogoutRoute); 36 | -------------------------------------------------------------------------------- /src/app/components/routes/logoutRoute/LogoutRoute.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React, { 4 | PureComponent 5 | } from "react"; 6 | import PropTypes from "prop-types"; 7 | import { 8 | Route, 9 | Redirect, 10 | withRouter 11 | } from "react-router-dom"; 12 | import auth from "../../../services/auth"; 13 | 14 | class LogoutRoute extends PureComponent { 15 | static propTypes = { 16 | // react-router 4: 17 | match: PropTypes.object.isRequired, 18 | location: PropTypes.object.isRequired, 19 | history: PropTypes.object.isRequired 20 | }; 21 | 22 | componentDidMount() { 23 | auth.clearAllAppStorage(); 24 | } 25 | 26 | render() { 27 | return ( 28 | 29 | 30 | 31 | ); 32 | } 33 | } 34 | 35 | export default withRouter(LogoutRoute); 36 | -------------------------------------------------------------------------------- /test/containers/about/About.spec.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {expect} from 'chai'; 3 | import {shallow} from 'enzyme'; 4 | import configureMockStore from 'redux-mock-store'; 5 | import thunk from 'redux-thunk'; 6 | import AboutConnected from '../../../src/app/containers/about/About'; 7 | import { fromJS } from 'immutable'; 8 | 9 | const mockStore = configureMockStore([ thunk ]); 10 | const storeStateMock = fromJS({ 11 | views: { 12 | currentView: 'about' 13 | } 14 | }); 15 | 16 | let store; 17 | let wrapper; 18 | describe('AboutConnected (About container) ', () => { 19 | beforeEach(() => { 20 | store = mockStore(storeStateMock); 21 | wrapper = shallow().shallow(); 22 | }); 23 | 24 | it('should render container', () => { 25 | expect(wrapper.containsMatchingElement(

About

)); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /test/containers/home/Home.spec.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {expect} from 'chai'; 3 | import {shallow} from 'enzyme'; 4 | import configureMockStore from 'redux-mock-store'; 5 | import thunk from 'redux-thunk'; 6 | import HomeConnected from '../../../src/app/containers/home/Home'; 7 | import { fromJS } from 'immutable'; 8 | 9 | const mockStore = configureMockStore([ thunk ]); 10 | const storeStateMock = fromJS({ 11 | views: { 12 | currentView: 'home' 13 | } 14 | }); 15 | 16 | let store; 17 | let wrapper; 18 | describe('HomeConnected (Home container) ', () => { 19 | beforeEach(() => { 20 | store = mockStore(storeStateMock); 21 | wrapper = shallow().shallow(); 22 | }); 23 | 24 | it('should render container', () => { 25 | expect(wrapper.containsMatchingElement(

Full ES2015 ReactJS + Bootstrap

)); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/components/navigation/leftNav/leftNavButton/LeftNavButton.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React, { 4 | PureComponent 5 | } from 'react'; 6 | import PropTypes from 'prop-types'; 7 | import { Link } from 'react-router-dom'; 8 | 9 | class LeftNavButton extends PureComponent { 10 | static propTypes = { 11 | link: PropTypes.string, 12 | label: PropTypes.string, 13 | viewName: PropTypes.string, 14 | onClick: PropTypes.func 15 | }; 16 | 17 | render() { 18 | const { link, label } = this.props; 19 | return ( 20 |
  • 21 | 24 | {label} 25 | 26 |
  • 27 | ); 28 | } 29 | 30 | handleLeftNavItemClick = (event) => { 31 | const { onClick, viewName } = this.props; 32 | onClick(event, viewName); 33 | } 34 | } 35 | 36 | export default LeftNavButton; 37 | -------------------------------------------------------------------------------- /src/server/SPA/index.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | 'use strict'; 4 | 5 | const express = require('express'); 6 | const path = require('path'); 7 | const chalk = require('chalk'); 8 | 9 | const app = express(); 10 | const DOCS_PATH = '../../../docs/'; 11 | const PORT = 8082; 12 | const IP_ADRESS = 'localhost'; 13 | 14 | app.set('port', PORT); 15 | app.set('ipAdress', IP_ADRESS); 16 | 17 | app.use(express.static(path.join(__dirname, DOCS_PATH))); 18 | 19 | app.get('/', (req, res) => res.sendFile(path.join(__dirname, DOCS_PATH, 'index.html'))); 20 | 21 | /* eslint-disable no-console */ 22 | app.listen( 23 | PORT, 24 | IP_ADRESS, 25 | () => console.log(` 26 | ===================================================== 27 | -> Server (${chalk.bgBlue('SPA')}) 🏃 (running) on ${chalk.green(IP_ADRESS)}:${chalk.green(PORT)} 28 | ===================================================== 29 | `) 30 | ); 31 | /* eslint-enable no-console */ 32 | -------------------------------------------------------------------------------- /src/app/components/navigation/rightNav/rightNavButton/RightNavButton.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React, { 4 | PureComponent 5 | } from 'react'; 6 | import PropTypes from 'prop-types'; 7 | import { Link } from 'react-router-dom'; 8 | 9 | class RightNavButton extends PureComponent { 10 | static propTypes = { 11 | link: PropTypes.string, 12 | label: PropTypes.string, 13 | viewName: PropTypes.string, 14 | onClick: PropTypes.func 15 | }; 16 | 17 | render() { 18 | const { link, label } = this.props; 19 | return ( 20 |
  • 21 | 24 | {label} 25 | 26 |
  • 27 | ); 28 | } 29 | 30 | handleRightNavItemClick = (event) => { 31 | const { onClick, viewName } = this.props; 32 | onClick(event, viewName); 33 | } 34 | } 35 | 36 | export default RightNavButton; 37 | -------------------------------------------------------------------------------- /src/app/components/scrollToTop/ScrollToTop.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React, { 4 | Component 5 | } from 'react'; 6 | import PropTypes from 'prop-types'; 7 | import { withRouter } from 'react-router' 8 | 9 | class ScrollToTop extends Component { 10 | static propTypes = { 11 | // react-router 4: 12 | match: PropTypes.object.isRequired, 13 | location: PropTypes.object.isRequired, 14 | history: PropTypes.object.isRequired, 15 | 16 | children: PropTypes.node 17 | }; 18 | 19 | componentDidUpdate(prevProps) { 20 | if (window) { 21 | const { location: prevLocation } = prevProps; 22 | const { location: nextLocation } = this.props; 23 | 24 | if (prevLocation !== nextLocation) { 25 | window.scrollTo(0, 0); 26 | } 27 | } 28 | } 29 | 30 | render() { 31 | const { children } = this.props; 32 | return children; 33 | } 34 | } 35 | 36 | export default withRouter(ScrollToTop); 37 | -------------------------------------------------------------------------------- /flow-typed/npm/react-modal_v1.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 79b0d9e0a2b9916a7ee8fd46cc9fe92b 2 | // flow-typed version: 898a5a203f/react-modal_v1.x.x/flow_>=v0.26.x 3 | 4 | declare module 'react-modal' { 5 | declare type DefaultProps = { 6 | isOpen: bool, 7 | ariaHideApp: bool, 8 | closeTimeoutMS: number, 9 | shouldCloseOnOverlayClick: bool, 10 | } 11 | declare type Props = { 12 | isOpen: bool, 13 | style?: { 14 | content?: Object, 15 | overlay?: Object, 16 | }, 17 | appElement?: HTMLElement, 18 | ariaHideApp: bool, 19 | closeTimeoutMS: number, 20 | onAfterOpen?: () => mixed, 21 | onRequestClose?: (event: Event) => mixed, 22 | shouldCloseOnOverlayClick: bool, 23 | } 24 | declare class Modal extends React$Component { 25 | static setAppElement(element: HTMLElement | string): void; 26 | static defaultProps: DefaultProps; 27 | props: Props; 28 | } 29 | declare var exports: typeof Modal; 30 | } 31 | -------------------------------------------------------------------------------- /flow-typed/npm/helmet_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 9250e7e4ca98fc26c033cf2ed66f83d9 2 | // flow-typed version: <>/helmet_v^3.6.1/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'helmet' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'helmet' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'helmet/index' { 29 | declare module.exports: $Exports<'helmet'>; 30 | } 31 | declare module 'helmet/index.js' { 32 | declare module.exports: $Exports<'helmet'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/animate.css_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: e388acbcc176eb2e934b50bcc9c0c785 2 | // flow-typed version: <>/animate.css_v3.5.1/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'animate.css' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'animate.css' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'animate.css/gulpfile' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'animate.css/gulpfile.js' { 31 | declare module.exports: $Exports<'animate.css/gulpfile'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/redux-mock-store_v1.2.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 46cfe61426b707ae9e2e03f873d0eb95 2 | // flow-typed version: b43dff3e0e/redux-mock-store_v1.2.x/flow_>=v0.25.x 3 | 4 | declare module 'redux-mock-store' { 5 | /* 6 | S = State 7 | A = Action 8 | */ 9 | 10 | declare type mockStore = { 11 | (state: S): mockStoreWithoutMiddleware 12 | }; 13 | declare type mockStoreWithoutMiddleware = { 14 | getState(): S, 15 | getActions(): Array, 16 | dispatch(action: A): A, 17 | clearActions(): void, 18 | subscribe(callback: Function): void, 19 | replaceReducer(nextReducer: Function): void 20 | }; 21 | 22 | declare function exports(middlewares: ?Array): mockStore; 23 | } 24 | 25 | // Filename aliases 26 | declare module 'redux-mock-store/src/index' { 27 | declare module.exports: $Exports<'redux-mock-store'>; 28 | } 29 | declare module 'redux-mock-store/src/index.js' { 30 | declare module.exports: $Exports<'redux-mock-store'>; 31 | } 32 | -------------------------------------------------------------------------------- /flow-typed/npm/url-loader_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 9e70b9f6cb2269f74958173805bf5327 2 | // flow-typed version: <>/url-loader_v^0.5.8/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'url-loader' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'url-loader' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'url-loader/index' { 29 | declare module.exports: $Exports<'url-loader'>; 30 | } 31 | declare module 'url-loader/index.js' { 32 | declare module.exports: $Exports<'url-loader'>; 33 | } 34 | -------------------------------------------------------------------------------- /src/app/views/login/index.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import { bindActionCreators } from 'redux'; 4 | import { connect } from 'react-redux'; 5 | import * as viewsActions from '../../redux/modules/views'; 6 | import * as userAuthActions from '../../redux/modules/userAuth'; 7 | import Login from './Login'; 8 | 9 | const mapStateToProps = (state) => { 10 | return { 11 | // views: 12 | currentView: state.getIn(['views', 'currentView']), 13 | 14 | // useAuth: 15 | isAuthenticated: state.getIn(['userAuth', 'isAuthenticated']), 16 | isFetching: state.getIn(['userAuth', 'isFetching']), 17 | isLogging: state.getIn(['userAuth', 'isLogging']) 18 | }; 19 | }; 20 | 21 | const mapDispatchToProps = (dispatch) => { 22 | return bindActionCreators( 23 | { 24 | ...viewsActions, 25 | ...userAuthActions 26 | }, 27 | dispatch 28 | ); 29 | }; 30 | 31 | export default connect( 32 | mapStateToProps, 33 | mapDispatchToProps 34 | )(Login); 35 | -------------------------------------------------------------------------------- /flow-typed/npm/compression_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 7121ab076e027ab3225f9fa11e1bf16d 2 | // flow-typed version: <>/compression_v^1.7.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'compression' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'compression' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'compression/index' { 29 | declare module.exports: $Exports<'compression'>; 30 | } 31 | declare module 'compression/index.js' { 32 | declare module.exports: $Exports<'compression'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/file-loader_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: be0bb7a810f6b447164c4564498edd42 2 | // flow-typed version: <>/file-loader_v^0.11.1/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'file-loader' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'file-loader' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'file-loader/index' { 29 | declare module.exports: $Exports<'file-loader'>; 30 | } 31 | declare module 'file-loader/index.js' { 32 | declare module.exports: $Exports<'file-loader'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/json-loader_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 780080417ac1aebef76a984b29b9a8e1 2 | // flow-typed version: <>/json-loader_v^0.5.4/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'json-loader' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'json-loader' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'json-loader/index' { 29 | declare module.exports: $Exports<'json-loader'>; 30 | } 31 | declare module 'json-loader/index.js' { 32 | declare module.exports: $Exports<'json-loader'>; 33 | } 34 | -------------------------------------------------------------------------------- /src/app/services/API/fetchTools.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import { Base64 } from 'js-base64'; 4 | 5 | /* 6 | window.location.origin polyfill 7 | */ 8 | export const getLocationOrigin = () => { 9 | if (!window.location.origin) { 10 | window.location.origin = `${window.location.protocol}//${window.location.hostname}${window.location.port ? ':' + window.location.port : ''}`; 11 | } 12 | return window.location.origin; 13 | }; 14 | 15 | /* 16 | query options: 17 | */ 18 | export const getMethod = { 19 | method: 'get' 20 | }; 21 | 22 | export const postMethod = { 23 | method: 'post' 24 | }; 25 | 26 | export const defaultOptions = { 27 | credentials: 'same-origin' 28 | }; 29 | 30 | export const jsonHeader = { 31 | headers: { 32 | 'Accept': 'application/json', 33 | 'Content-Type': 'application/json' 34 | // 'Access-control-Allow-Origin': '*' 35 | } 36 | }; 37 | 38 | /* 39 | general helpers 40 | */ 41 | export const encodeBase64 = (stringToEncode) => { 42 | return Base64.encode(stringToEncode); 43 | }; -------------------------------------------------------------------------------- /flow-typed/npm/expose-loader_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: acf68c2eba98faab7c90993a820d5fbe 2 | // flow-typed version: <>/expose-loader_v^0.7.3/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'expose-loader' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'expose-loader' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'expose-loader/index' { 29 | declare module.exports: $Exports<'expose-loader'>; 30 | } 31 | declare module 'expose-loader/index.js' { 32 | declare module.exports: $Exports<'expose-loader'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/postcss-focus_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 5fd77c48b2e785d9371b913887033b6c 2 | // flow-typed version: <>/postcss-focus_v^2.0.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'postcss-focus' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'postcss-focus' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'postcss-focus/index' { 29 | declare module.exports: $Exports<'postcss-focus'>; 30 | } 31 | declare module 'postcss-focus/index.js' { 32 | declare module.exports: $Exports<'postcss-focus'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-preset-flow_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 76bb465b2bfa57b0d98f5ec2f8633ee5 2 | // flow-typed version: <>/babel-preset-flow_v^6.23.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-preset-flow' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-preset-flow' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-preset-flow/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'babel-preset-flow/lib/index.js' { 31 | declare module.exports: $Exports<'babel-preset-flow/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-preset-react_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: f36cef8c0faabcd12873f8dedbba14fd 2 | // flow-typed version: <>/babel-preset-react_v^6.24.1/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-preset-react' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-preset-react' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-preset-react/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'babel-preset-react/lib/index.js' { 31 | declare module.exports: $Exports<'babel-preset-react/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /test/components/NavigationBar/humburger/Humburger.spec.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { 3 | shallow 4 | } from 'enzyme'; 5 | import chai, {expect} from 'chai'; 6 | import dirtyChai from 'dirty-chai'; 7 | import Humburger from '../../../../src/app/components/navigation/humburger/Humburger'; 8 | 9 | chai.use(dirtyChai); 10 | 11 | 12 | describe('', () => { 13 | it('should render an Humburger', () => { 14 | const wrapper = shallow(); 15 | 16 | expect(wrapper).to.exist(); 17 | }); 18 | 19 | it('should contains a button with "navbar-toggle" class', () => { 20 | const wrapper = shallow(); 21 | const button = wrapper.find('button'); 22 | 23 | expect(button.hasClass('navbar-toggle')).to.equal(true); 24 | }); 25 | 26 | it('should contains ""', () => { 27 | const wrapper = shallow(); 28 | expect(wrapper.contains()).to.equal(true); 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-preset-es2015_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 5e71bb877ae4c3a70c181a71e2267aa6 2 | // flow-typed version: <>/babel-preset-es2015_v^6.24.1/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-preset-es2015' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-preset-es2015' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-preset-es2015/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'babel-preset-es2015/lib/index.js' { 31 | declare module.exports: $Exports<'babel-preset-es2015/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-preset-stage-0_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: fc70b51c852eacf92ac57cc809755f58 2 | // flow-typed version: <>/babel-preset-stage-0_v^6.24.1/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-preset-stage-0' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-preset-stage-0' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-preset-stage-0/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'babel-preset-stage-0/lib/index.js' { 31 | declare module.exports: $Exports<'babel-preset-stage-0/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-preset-stage-2_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: bd74ec965239b139d1c3401b8d43e236 2 | // flow-typed version: <>/babel-preset-stage-2_v^6.24.1/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-preset-stage-2' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-preset-stage-2' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-preset-stage-2/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'babel-preset-stage-2/lib/index.js' { 31 | declare module.exports: $Exports<'babel-preset-stage-2/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/postcss-load-config_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: bd6e67b3f59a8470e940ae27da06ff75 2 | // flow-typed version: <>/postcss-load-config_v^1.2.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'postcss-load-config' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'postcss-load-config' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'postcss-load-config/index' { 29 | declare module.exports: $Exports<'postcss-load-config'>; 30 | } 31 | declare module 'postcss-load-config/index.js' { 32 | declare module.exports: $Exports<'postcss-load-config'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/serialize-javascript_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: d23f32676f798388942affcb3f44cb9b 2 | // flow-typed version: <>/serialize-javascript_v^1.4.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'serialize-javascript' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'serialize-javascript' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'serialize-javascript/index' { 29 | declare module.exports: $Exports<'serialize-javascript'>; 30 | } 31 | declare module 'serialize-javascript/index.js' { 32 | declare module.exports: $Exports<'serialize-javascript'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/webpack-node-externals_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 72b7fbae5933f1c1f3e46ef6bd7f332a 2 | // flow-typed version: <>/webpack-node-externals_v^1.6.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'webpack-node-externals' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'webpack-node-externals' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'webpack-node-externals/index' { 29 | declare module.exports: $Exports<'webpack-node-externals'>; 30 | } 31 | declare module 'webpack-node-externals/index.js' { 32 | declare module.exports: $Exports<'webpack-node-externals'>; 33 | } 34 | -------------------------------------------------------------------------------- /src/app/index.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React from 'react'; 4 | import {render} from 'react-dom'; 5 | import injectTpEventPlugin from 'react-tap-event-plugin'; 6 | import { AppContainer } from 'react-hot-loader'; 7 | import Root from './Root'; 8 | 9 | import 'animate.css'; 10 | import 'jquery'; 11 | import 'font-awesome/css/font-awesome.min.css'; 12 | import 'bootstrap/dist/css/bootstrap.min.css'; 13 | import 'bootstrap/dist/js/bootstrap.min.js'; 14 | import './style/index.scss'; 15 | 16 | const ELEMENT_TO_BOOTSTRAP = 'root'; 17 | const BootstrapedElement = document.getElementById(ELEMENT_TO_BOOTSTRAP); 18 | 19 | injectTpEventPlugin(); 20 | 21 | const renderApp = RootComponent => { 22 | render( 23 | 24 | 25 | , 26 | BootstrapedElement 27 | ); 28 | }; 29 | 30 | renderApp(Root); 31 | 32 | if (module.hot) { 33 | module.hot.accept( 34 | './Root', 35 | () => { 36 | const RootComponent = require('./Root').default; 37 | renderApp(RootComponent); 38 | } 39 | ); 40 | } 41 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-preset-react-optimize_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 4848caaca8ac663016870eedbde56e69 2 | // flow-typed version: <>/babel-preset-react-optimize_v^1.0.1/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-preset-react-optimize' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-preset-react-optimize' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-preset-react-optimize/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'babel-preset-react-optimize/lib/index.js' { 31 | declare module.exports: $Exports<'babel-preset-react-optimize/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/rimraf_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 475d59277bfba3e04a313defb589ae39 2 | // flow-typed version: <>/rimraf_v^2.6.1/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'rimraf' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'rimraf' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'rimraf/bin' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'rimraf/rimraf' { 30 | declare module.exports: any; 31 | } 32 | 33 | // Filename aliases 34 | declare module 'rimraf/bin.js' { 35 | declare module.exports: $Exports<'rimraf/bin'>; 36 | } 37 | declare module 'rimraf/rimraf.js' { 38 | declare module.exports: $Exports<'rimraf/rimraf'>; 39 | } 40 | -------------------------------------------------------------------------------- /flow-typed/npm/chalk_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 81fa6cb150bb7acdac89e8e12a0a7331 2 | // flow-typed version: <>/chalk_v^2.0.1/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'chalk' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'chalk' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'chalk/templates' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'chalk/index' { 31 | declare module.exports: $Exports<'chalk'>; 32 | } 33 | declare module 'chalk/index.js' { 34 | declare module.exports: $Exports<'chalk'>; 35 | } 36 | declare module 'chalk/templates.js' { 37 | declare module.exports: $Exports<'chalk/templates'>; 38 | } 39 | -------------------------------------------------------------------------------- /test/components/backToTop/backToTopButton/UpIcon.spec.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { shallow } from 'enzyme'; 3 | import chai, {expect} from 'chai'; 4 | import dirtyChai from 'dirty-chai'; 5 | import UpIcon from '../../../../src/app/components/backToTop/backToTopButton/UpIcon'; 6 | 7 | chai.use(dirtyChai); 8 | 9 | describe('', () => { 10 | const colorMock = 'black'; 11 | const defaultColor = '#F1F1F1'; 12 | 13 | const props = { 14 | color: colorMock 15 | }; 16 | 17 | it('should render an UpIcon', () => { 18 | const wrapper = shallow(); 19 | 20 | expect(wrapper.node).to.exist(); 21 | expect(wrapper.find('svg')).to.exist(); 22 | }); 23 | 24 | it('should set default fill color', () => { 25 | const wrapper = shallow(); 26 | 27 | expect(wrapper.find('svg').prop('fill')).to.equal(defaultColor); 28 | }); 29 | 30 | it('should set fill color from prop value', () => { 31 | const wrapper = shallow(); 32 | 33 | expect(wrapper.find('svg').prop('fill')).to.equal(colorMock); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-plugin-transform-regenerator_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 16d251104e7676ce8c86a507f574e9d5 2 | // flow-typed version: <>/babel-plugin-transform-regenerator_v^6.24.1/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-plugin-transform-regenerator' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-plugin-transform-regenerator' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-plugin-transform-regenerator/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'babel-plugin-transform-regenerator/lib/index.js' { 31 | declare module.exports: $Exports<'babel-plugin-transform-regenerator/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /src/app/components/navigation/leftNav/LeftNav.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React, { 4 | PureComponent 5 | } from 'react'; 6 | import PropTypes from 'prop-types'; 7 | import LeftNavButton from './leftNavButton/LeftNavButton'; 8 | import * as Immutable from 'immutable'; 9 | 10 | 11 | class LeftNav extends PureComponent { 12 | static propTypes = { 13 | leftLinks: PropTypes.instanceOf(Immutable.List), 14 | onLeftNavButtonClick: PropTypes.func 15 | }; 16 | 17 | render() { 18 | const { leftLinks, onLeftNavButtonClick } = this.props; 19 | return ( 20 |
      21 | { 22 | leftLinks.map( 23 | (aLinkBtn, index) => { 24 | return ( 25 | 32 | ); 33 | } 34 | ) 35 | } 36 |
    37 | ); 38 | } 39 | } 40 | 41 | export default LeftNav; 42 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-plugin-transform-async-to-generator_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 55f002ccd7135fb6a2b9c0b17630435e 2 | // flow-typed version: <>/babel-plugin-transform-async-to-generator_v^6.24.1/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-plugin-transform-async-to-generator' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-plugin-transform-async-to-generator' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-plugin-transform-async-to-generator/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'babel-plugin-transform-async-to-generator/lib/index.js' { 31 | declare module.exports: $Exports<'babel-plugin-transform-async-to-generator/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /server.hot.reload.js: -------------------------------------------------------------------------------- 1 | /* eslint no-console:0 */ 2 | /* eslint consistent-return:0 */ 3 | const path = require('path'); 4 | const webpack = require('webpack'); 5 | const express = require('express'); 6 | const devMiddleware = require('webpack-dev-middleware'); 7 | const hotMiddleware = require('webpack-hot-middleware'); 8 | const config = require('./webpack.hot.reload.config'); 9 | const chalk = require('chalk'); 10 | 11 | const app = express(); 12 | const compiler = webpack(config); 13 | 14 | 15 | app.use(devMiddleware(compiler, { 16 | publicPath: config.output.publicPath, 17 | historyApiFallback: true 18 | })); 19 | 20 | app.use(hotMiddleware(compiler)); 21 | 22 | app.get('*', (req, res) => { 23 | res.sendFile(path.join(__dirname, 'index.html')); 24 | }); 25 | 26 | app.listen(3001, (err) => { 27 | if (err) { 28 | return console.error(err); 29 | } 30 | console.log( 31 | ` 32 | ===================================================== 33 | -> Server (${chalk.bgBlue('Hot reload')}) 🏃 (running) on ${chalk.green('localhost')}:${chalk.green('3001')} 34 | ===================================================== 35 | ` 36 | ); 37 | }); 38 | -------------------------------------------------------------------------------- /src/app/views/protected/Protected.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React, { 4 | PureComponent 5 | } from 'react'; 6 | import PropTypes from 'prop-types'; 7 | import AnimatedView from '../../components/animatedView/AnimatedView'; 8 | 9 | class Protected extends PureComponent { 10 | static propTypes= { 11 | // react-router 4: 12 | match: PropTypes.object.isRequired, 13 | location: PropTypes.object.isRequired, 14 | history: PropTypes.object.isRequired, 15 | 16 | // views: 17 | currentView: PropTypes.string.isRequired, 18 | enterProtected: PropTypes.func.isRequired, 19 | leaveProtected: PropTypes.func.isRequired 20 | }; 21 | 22 | componentDidMount() { 23 | const { enterProtected } = this.props; 24 | enterProtected(); 25 | } 26 | 27 | componentWillUnmount() { 28 | const { leaveProtected } = this.props; 29 | leaveProtected(); 30 | } 31 | 32 | render() { 33 | return( 34 | 35 |

    36 | Protected view 37 |

    38 |

    39 | If you can read, it means you are authenticated 40 |

    41 |
    42 | ); 43 | } 44 | } 45 | 46 | export default Protected; 47 | -------------------------------------------------------------------------------- /src/app/components/navigation/rightNav/RightNav.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React, { 4 | PureComponent 5 | } from 'react'; 6 | import PropTypes from 'prop-types'; 7 | import RightNavButton from './rightNavButton/RightNavButton'; 8 | import * as Immutable from 'immutable'; 9 | 10 | class RightNav extends PureComponent { 11 | static propTypes = { 12 | rightLinks: PropTypes.instanceOf(Immutable.List), 13 | onRightNavButtonClick: PropTypes.func 14 | }; 15 | 16 | render() { 17 | const { rightLinks, onRightNavButtonClick } = this.props; 18 | return ( 19 |
      20 | { 21 | rightLinks.map( 22 | (aLinkBtn, index) => { 23 | return ( 24 | 31 | ); 32 | } 33 | ) 34 | } 35 |
    36 | ); 37 | } 38 | } 39 | 40 | export default RightNav; 41 | -------------------------------------------------------------------------------- /src/app/redux/store/configureStore.dev.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import { 4 | createStore, 5 | // compose, 6 | applyMiddleware 7 | } from 'redux'; 8 | 9 | import { createLogger } from 'redux-logger'; 10 | import thunkMiddleware from 'redux-thunk'; 11 | import reducer from '../modules/reducers'; 12 | import fetchMiddleware from '../middleware/fetchMiddleware'; 13 | import { composeWithDevTools } from 'redux-devtools-extension'; 14 | 15 | const loggerMiddleware = createLogger({ 16 | level: 'info', 17 | collapsed: true, 18 | stateTransformer: state => state.toJS() 19 | }); 20 | 21 | // createStore : enhancer 22 | const enhancer = composeWithDevTools( 23 | applyMiddleware( 24 | thunkMiddleware, 25 | fetchMiddleware, 26 | loggerMiddleware 27 | ) // logger after thunk to avoid undefined actions 28 | ); 29 | 30 | export default function configureStore(initialState) { 31 | const store = createStore(reducer, initialState, enhancer); 32 | // checks if webpack HMR: 33 | if (module.hot) { 34 | module.hot.accept('../modules/reducers', () => 35 | store.replaceReducer(require('../modules/reducers').default) 36 | ); 37 | } 38 | 39 | return store; 40 | } 41 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-preset-babili_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 1b861a621d257628421d460a06d62623 2 | // flow-typed version: <>/babel-preset-babili_v^0.1.4/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-preset-babili' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-preset-babili' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-preset-babili/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-preset-babili/lib/options-manager' { 30 | declare module.exports: any; 31 | } 32 | 33 | // Filename aliases 34 | declare module 'babel-preset-babili/lib/index.js' { 35 | declare module.exports: $Exports<'babel-preset-babili/lib/index'>; 36 | } 37 | declare module 'babel-preset-babili/lib/options-manager.js' { 38 | declare module.exports: $Exports<'babel-preset-babili/lib/options-manager'>; 39 | } 40 | -------------------------------------------------------------------------------- /flow-typed/npm/precss_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 51c17647b06a8f63c8545b8ca948eec4 2 | // flow-typed version: <>/precss_v^1.4.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'precss' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'precss' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'precss/gulpfile' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'precss/test/index' { 30 | declare module.exports: any; 31 | } 32 | 33 | // Filename aliases 34 | declare module 'precss/gulpfile.js' { 35 | declare module.exports: $Exports<'precss/gulpfile'>; 36 | } 37 | declare module 'precss/index' { 38 | declare module.exports: $Exports<'precss'>; 39 | } 40 | declare module 'precss/index.js' { 41 | declare module.exports: $Exports<'precss'>; 42 | } 43 | declare module 'precss/test/index.js' { 44 | declare module.exports: $Exports<'precss/test/index'>; 45 | } 46 | -------------------------------------------------------------------------------- /test/components/backToTop/BackToTop.spec.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { 3 | shallow, 4 | mount 5 | } from 'enzyme'; 6 | import chai, {expect} from 'chai'; 7 | import sinon from 'sinon'; 8 | import dirtyChai from 'dirty-chai'; 9 | import BackToTop from '../../../src/app/components/backToTop/BackToTop'; 10 | 11 | chai.use(dirtyChai); 12 | 13 | const minScrollYMock = 10; 14 | const scrollToMock= 'fakeId'; 15 | 16 | 17 | describe('', () => { 18 | const props = { 19 | minScrollY: minScrollYMock, 20 | scrollTo: scrollToMock 21 | }; 22 | 23 | it('should render a BackToTop', () => { 24 | const wrapper = shallow(); 25 | 26 | expect(wrapper.node).to.exist(); 27 | }); 28 | 29 | // it('should call handleWindowScroll on scroll', () => { 30 | // const handleWindowScrollSpy = sinon.spy(BackToTop.prototype, 'handlesOnBackButtonClick'); 31 | // const wrapper = shallow( 32 | // 33 | // ); 34 | // wrapper.setState({showBackButton: true}); 35 | // window.scrollTo(300); 36 | // setTimeout( 37 | // () => { 38 | // expect(handleWindowScrollSpy).to.have.property('callCount', 0); 39 | // }, 0 40 | // ); 41 | // }); 42 | }); 43 | -------------------------------------------------------------------------------- /flow-typed/npm/prop-types_v15.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 3eaa1f24c7397b78a7481992d2cddcb2 2 | // flow-typed version: a1a20d4928/prop-types_v15.x.x/flow_>=v0.41.x 3 | 4 | type $npm$propTypes$ReactPropsCheckType = ( 5 | props: any, 6 | propName: string, 7 | componentName: string, 8 | href?: string) => ?Error; 9 | 10 | declare module 'prop-types' { 11 | declare var array: React$PropType$Primitive>; 12 | declare var bool: React$PropType$Primitive; 13 | declare var func: React$PropType$Primitive; 14 | declare var number: React$PropType$Primitive; 15 | declare var object: React$PropType$Primitive; 16 | declare var string: React$PropType$Primitive; 17 | declare var any: React$PropType$Primitive; 18 | declare var arrayOf: React$PropType$ArrayOf; 19 | declare var element: React$PropType$Primitive; /* TODO */ 20 | declare var instanceOf: React$PropType$InstanceOf; 21 | declare var node: React$PropType$Primitive; /* TODO */ 22 | declare var objectOf: React$PropType$ObjectOf; 23 | declare var oneOf: React$PropType$OneOf; 24 | declare var oneOfType: React$PropType$OneOfType; 25 | declare var shape: React$PropType$Shape; 26 | 27 | declare function checkPropTypes( 28 | propTypes: $Subtype<{[_: $Keys]: $npm$propTypes$ReactPropsCheckType}>, 29 | values: V, 30 | location: string, 31 | componentName: string, 32 | getStack: ?(() => ?string) 33 | ) : void; 34 | } 35 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-register_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 1bf322b2fda93bd323858c8a24e8368d 2 | // flow-typed version: <>/babel-register_v^6.24.1/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-register' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-register' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-register/lib/browser' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-register/lib/cache' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-register/lib/node' { 34 | declare module.exports: any; 35 | } 36 | 37 | // Filename aliases 38 | declare module 'babel-register/lib/browser.js' { 39 | declare module.exports: $Exports<'babel-register/lib/browser'>; 40 | } 41 | declare module 'babel-register/lib/cache.js' { 42 | declare module.exports: $Exports<'babel-register/lib/cache'>; 43 | } 44 | declare module 'babel-register/lib/node.js' { 45 | declare module.exports: $Exports<'babel-register/lib/node'>; 46 | } 47 | -------------------------------------------------------------------------------- /flow-typed/npm/postcss-loader_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 15a4cd57ef5b8dcac354660c91af2a4d 2 | // flow-typed version: <>/postcss-loader_v^2.0.5/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'postcss-loader' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'postcss-loader' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'postcss-loader/lib/Error' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'postcss-loader/lib/index' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'postcss-loader/lib/options' { 34 | declare module.exports: any; 35 | } 36 | 37 | // Filename aliases 38 | declare module 'postcss-loader/lib/Error.js' { 39 | declare module.exports: $Exports<'postcss-loader/lib/Error'>; 40 | } 41 | declare module 'postcss-loader/lib/index.js' { 42 | declare module.exports: $Exports<'postcss-loader/lib/index'>; 43 | } 44 | declare module 'postcss-loader/lib/options.js' { 45 | declare module.exports: $Exports<'postcss-loader/lib/options'>; 46 | } 47 | -------------------------------------------------------------------------------- /flow-typed/npm/body-parser_v1.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 18dadbe162b608c79b9b31c3d2f1c822 2 | // flow-typed version: b43dff3e0e/body-parser_v1.x.x/flow_>=v0.17.x 3 | 4 | import type { Middleware, $Request, $Response } from 'express'; 5 | 6 | declare type bodyParser$Options = { 7 | inflate?: boolean; 8 | limit?: number | string; 9 | type?: string | string[] | ((req: $Request) => any); 10 | verify?: (req: $Request, res: $Response, buf: Buffer, encoding: string) => void; 11 | }; 12 | 13 | declare type bodyParser$OptionsText = bodyParser$Options & { 14 | reviver?: (key: string, value: any) => any; 15 | strict?: boolean; 16 | }; 17 | 18 | declare type bodyParser$OptionsJson = bodyParser$Options & { 19 | reviver?: (key: string, value: any) => any; 20 | strict?: boolean; 21 | }; 22 | 23 | declare type bodyParser$OptionsUrlencoded = bodyParser$Options & { 24 | extended?: boolean; 25 | parameterLimit?: number; 26 | }; 27 | 28 | declare module "body-parser" { 29 | 30 | declare type Options = bodyParser$Options; 31 | declare type OptionsText = bodyParser$OptionsText; 32 | declare type OptionsJson = bodyParser$OptionsJson; 33 | declare type OptionsUrlencoded = bodyParser$OptionsUrlencoded; 34 | 35 | declare function json(options?: OptionsJson): Middleware; 36 | 37 | declare function raw(options?: Options): Middleware; 38 | 39 | declare function text(options?: OptionsText): Middleware; 40 | 41 | declare function urlencoded(options?: OptionsUrlencoded): Middleware; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/app/views/about/About.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React, { 4 | PureComponent 5 | } from 'react'; 6 | import PropTypes from 'prop-types'; 7 | import { 8 | Jumbotron 9 | } from '../../components'; 10 | import AnimatedView from '../../components/animatedView/AnimatedView'; 11 | import { Link } from 'react-router-dom'; 12 | 13 | class About extends PureComponent { 14 | static propTypes = { 15 | // react-router 4: 16 | match: PropTypes.object.isRequired, 17 | location: PropTypes.object.isRequired, 18 | history: PropTypes.object.isRequired, 19 | 20 | // views: 21 | currentView: PropTypes.string.isRequired, 22 | enterAbout: PropTypes.func.isRequired, 23 | leaveAbout: PropTypes.func.isRequired 24 | }; 25 | 26 | componentDidMount() { 27 | const { enterAbout } = this.props; 28 | enterAbout(); 29 | } 30 | 31 | componentWillUnmount() { 32 | const { leaveAbout } = this.props; 33 | leaveAbout(); 34 | } 35 | 36 | render() { 37 | return( 38 | 39 | 40 |

    41 | About 42 |

    43 |

    44 | 47 | 48 |   49 | go to home 50 | 51 |

    52 |
    53 |
    54 | ); 55 | } 56 | } 57 | 58 | export default About; 59 | -------------------------------------------------------------------------------- /src/app/components/routes/privateRoute/PrivateRoute.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React, { 4 | Component 5 | } from 'react'; 6 | import PropTypes from 'prop-types'; 7 | import { 8 | Route, 9 | Redirect, 10 | withRouter 11 | } from "react-router-dom"; 12 | import auth from '../../../services/auth'; 13 | 14 | class PrivateRoute extends Component { 15 | static propTypes = { 16 | // react-router 4: 17 | match: PropTypes.object.isRequired, 18 | location: PropTypes.object.isRequired, 19 | history: PropTypes.object.isRequired, 20 | 21 | component: PropTypes.any.isRequired, 22 | path: PropTypes.string 23 | }; 24 | 25 | render() { 26 | const { 27 | component: InnerComponent, 28 | ...rest 29 | } = this.props; 30 | 31 | const { location } = this.props; 32 | 33 | const isUserAuthenticated = this.isAuthenticated(); 34 | 35 | return ( 36 | ( 40 | isUserAuthenticated 41 | ? 42 | : 43 | ) 44 | } 45 | /> 46 | ); 47 | } 48 | 49 | isAuthenticated() { 50 | const checkUserHasId = user => user && user.id && user.id.length > 0; 51 | const user = auth.getUserInfo() ? auth.getUserInfo() : null; 52 | const isAuthenticated = 53 | auth.getToken() && checkUserHasId(user) ? true : false; 54 | 55 | return isAuthenticated; 56 | } 57 | } 58 | 59 | export default withRouter(PrivateRoute); 60 | -------------------------------------------------------------------------------- /test/views/home/Home.spec.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { 3 | shallow, 4 | mount 5 | } from 'enzyme'; 6 | import chai, {expect} from 'chai'; 7 | import sinon from 'sinon'; 8 | import dirtyChai from 'dirty-chai'; 9 | import Home from '../../../src/app/views/home/Home'; 10 | 11 | chai.use(dirtyChai); 12 | 13 | 14 | describe('Home VIEW ', () => { 15 | const props = { 16 | currentView: 'home', 17 | enterHome: () => {}, 18 | leaveHome: () => {} 19 | }; 20 | it('should render "Home" view', () => { 21 | const wrapper = shallow(); 22 | 23 | expect(wrapper).to.exist(); 24 | expect(wrapper.find('Jumbotron').length).to.equal(1); 25 | }); 26 | 27 | it('should call enterHome action', () => { 28 | const enterHomeAction = sinon.spy(); // called on componentDidMount 29 | /* eslint-disable no-unused-vars */ 30 | const wrapper = mount( 31 | {}} 35 | /> 36 | ); 37 | /* eslint-enable no-unused-vars */ 38 | expect(enterHomeAction).to.have.property('callCount', 1); 39 | }); 40 | 41 | it('should call leaveAbout action', () => { 42 | const leaveHomeAction = sinon.spy(); // called on componentDidMount 43 | const wrapper = mount( 44 | {}} 47 | leaveHome={leaveHomeAction} 48 | /> 49 | ); 50 | wrapper.unmount(); 51 | expect(leaveHomeAction).to.have.property('callCount', 1); 52 | }); 53 | }); 54 | -------------------------------------------------------------------------------- /test/views/about/About.spec.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { 3 | shallow, 4 | mount 5 | } from 'enzyme'; 6 | import chai, {expect} from 'chai'; 7 | import sinon from 'sinon'; 8 | import dirtyChai from 'dirty-chai'; 9 | import About from '../../../src/app/views/about/About'; 10 | 11 | chai.use(dirtyChai); 12 | 13 | 14 | describe('About VIEW ', () => { 15 | const props = { 16 | currentView: 'about', 17 | enterAbout: () => {}, 18 | leaveAbout: () => {} 19 | }; 20 | it('should render "About" view', () => { 21 | const wrapper = shallow(); 22 | 23 | expect(wrapper).to.exist(); 24 | expect(wrapper.containsMatchingElement(

    About

    )); 25 | }); 26 | 27 | it('should call enterAbout action', () => { 28 | const enterAboutAction = sinon.spy(); // called on componentDidMount 29 | /* eslint-disable no-unused-vars */ 30 | const wrapper = mount( 31 | {}} 35 | /> 36 | ); 37 | /* eslint-enable no-unused-vars */ 38 | expect(enterAboutAction).to.have.property('callCount', 1); 39 | }); 40 | 41 | it('should call leaveAbout action', () => { 42 | const leaveAboutAction = sinon.spy(); // called on componentDidMount 43 | const wrapper = mount( 44 | {}} 47 | leaveAbout={leaveAboutAction} 48 | /> 49 | ); 50 | wrapper.unmount(); 51 | expect(leaveAboutAction).to.have.property('callCount', 1); 52 | }); 53 | }); 54 | -------------------------------------------------------------------------------- /test/components/NavigationBar/leftNav/leftNavButton/LeftNavButton.spec.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { 3 | shallow 4 | } from 'enzyme'; 5 | import chai, {expect} from 'chai'; 6 | import sinon from 'sinon'; 7 | import dirtyChai from 'dirty-chai'; 8 | import LeftNavButton from '../../../../../src/app/components/navigation/leftNav/leftNavButton/LeftNavButton'; 9 | 10 | chai.use(dirtyChai); 11 | 12 | const linkMock = 'link'; 13 | const labelMock = 'label'; 14 | const viewNameMock = 'view name'; 15 | 16 | // avoid to eslint-disable for chai no-unsued-expressions 17 | chai.use(dirtyChai); 18 | 19 | describe('', () => { 20 | const props = { 21 | link: linkMock, 22 | label: labelMock, 23 | viewName: viewNameMock 24 | }; 25 | 26 | it('should render a LeftNavButton', () => { 27 | const wrapper = shallow(); 28 | 29 | expect(wrapper).to.exist(); 30 | }); 31 | 32 | describe('child ', () => { 33 | it('should exist', () => { 34 | const wrapper = shallow(); 35 | const Link = wrapper.find('Link'); 36 | 37 | expect(Link).to.exist(); 38 | }); 39 | 40 | it('should trigger a navigation on left link click', () => { 41 | const event = {}; 42 | const onClickStub = sinon.spy(); 43 | 44 | const wrapper = shallow( 45 | 49 | ); 50 | const Link = wrapper.find('Link'); 51 | Link.simulate('click', event); 52 | 53 | expect(onClickStub.calledOnce).to.equal(true); 54 | }); 55 | }); 56 | }); 57 | -------------------------------------------------------------------------------- /flow-typed/npm/postcss-reporter_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 92bcdeee1dd6c0c209985f257606ed25 2 | // flow-typed version: <>/postcss-reporter_v^3.0.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'postcss-reporter' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'postcss-reporter' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'postcss-reporter/lib/formatter' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'postcss-reporter/lib/reporter' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'postcss-reporter/lib/util' { 34 | declare module.exports: any; 35 | } 36 | 37 | // Filename aliases 38 | declare module 'postcss-reporter/index' { 39 | declare module.exports: $Exports<'postcss-reporter'>; 40 | } 41 | declare module 'postcss-reporter/index.js' { 42 | declare module.exports: $Exports<'postcss-reporter'>; 43 | } 44 | declare module 'postcss-reporter/lib/formatter.js' { 45 | declare module.exports: $Exports<'postcss-reporter/lib/formatter'>; 46 | } 47 | declare module 'postcss-reporter/lib/reporter.js' { 48 | declare module.exports: $Exports<'postcss-reporter/lib/reporter'>; 49 | } 50 | declare module 'postcss-reporter/lib/util.js' { 51 | declare module.exports: $Exports<'postcss-reporter/lib/util'>; 52 | } 53 | -------------------------------------------------------------------------------- /test/components/NavigationBar/rightNav/rightNavButton/RightNavButton.spec.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { 3 | shallow 4 | } from 'enzyme'; 5 | import chai, {expect} from 'chai'; 6 | import sinon from 'sinon'; 7 | import dirtyChai from 'dirty-chai'; 8 | import RightNavButton from '../../../../../src/app/components/navigation/rightNav/rightNavButton/RightNavButton'; 9 | import { fromJS } from 'immutable'; 10 | 11 | chai.use(dirtyChai); 12 | 13 | const linkMock = 'link'; 14 | const labelMock = 'label'; 15 | const viewNameMock = 'view name'; 16 | 17 | // avoid to eslint-disable for chai no-unsued-expressions 18 | chai.use(dirtyChai); 19 | 20 | describe('', () => { 21 | const props = fromJS({ 22 | link: linkMock, 23 | label: labelMock, 24 | viewName: viewNameMock 25 | }); 26 | 27 | it('should render a RightNavButton', () => { 28 | const wrapper = shallow(); 29 | 30 | expect(wrapper).to.exist(); 31 | }); 32 | 33 | describe('child ', () => { 34 | it('should exist', () => { 35 | const wrapper = shallow(); 36 | const Link = wrapper.find('Link'); 37 | 38 | expect(Link).to.exist(); 39 | }); 40 | 41 | it('should trigger a navigation on left link click', () => { 42 | const event = {}; 43 | const onClickStub = sinon.spy(); 44 | 45 | const wrapper = shallow( 46 | 50 | ); 51 | const Link = wrapper.find('Link'); 52 | Link.simulate('click', event); 53 | 54 | expect(onClickStub.calledOnce).to.equal(true); 55 | }); 56 | }); 57 | }); 58 | -------------------------------------------------------------------------------- /test/redux/actions/views.spec.js: -------------------------------------------------------------------------------- 1 | import chai, {expect} from 'chai'; 2 | import dirtyChai from 'dirty-chai'; 3 | import moment from 'moment'; 4 | import { 5 | enterHome, 6 | leaveHome, 7 | enterAbout, 8 | leaveAbout 9 | } from '../../../src/app/redux/modules/views'; 10 | 11 | const dateFormat = 'DD/MM/YYYY HH:mm'; 12 | 13 | chai.use(dirtyChai); 14 | 15 | 16 | describe('redux - action creator "views"', () => { 17 | const now = moment().format(dateFormat); 18 | 19 | it('should return enterHome action object', () => { 20 | const enterHomeACTION = { 21 | type: 'ENTER_HOME_VIEW', 22 | currentView: 'home', 23 | enterTime: now, 24 | leaveTime: null 25 | }; 26 | expect(enterHome(now)).to.deep.equal(enterHomeACTION); 27 | }); 28 | 29 | it('should return leaveHome action object', () => { 30 | const leaveHomeACTION = { 31 | type: 'LEAVE_HOME_VIEW', 32 | currentView: 'home', 33 | enterTime: null, 34 | leaveTime: now 35 | }; 36 | expect(leaveHome(now)).to.deep.equal(leaveHomeACTION); 37 | }); 38 | 39 | 40 | it('should return enterAbout action object', () => { 41 | const enterAboutACTION = { 42 | type: 'ENTER_ABOUT_VIEW', 43 | currentView: 'about', 44 | enterTime: now, 45 | leaveTime: null 46 | }; 47 | expect(enterAbout(now)).to.deep.equal(enterAboutACTION); 48 | }); 49 | 50 | it('should return leaveAbout action object', () => { 51 | const leaveAboutACTION = { 52 | type: 'LEAVE_ABOUT_VIEW', 53 | currentView: 'about', 54 | enterTime: null, 55 | leaveTime: now 56 | }; 57 | expect(leaveAbout(now)).to.deep.equal(leaveAboutACTION); 58 | }); 59 | }); 60 | -------------------------------------------------------------------------------- /flow-typed/npm/webpack-dev-middleware_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 52f170fe7fc77d4fb82d697a39a2c359 2 | // flow-typed version: <>/webpack-dev-middleware_v^1.11.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'webpack-dev-middleware' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'webpack-dev-middleware' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'webpack-dev-middleware/lib/GetFilenameFromUrl' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'webpack-dev-middleware/lib/PathJoin' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'webpack-dev-middleware/lib/Shared' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'webpack-dev-middleware/middleware' { 38 | declare module.exports: any; 39 | } 40 | 41 | // Filename aliases 42 | declare module 'webpack-dev-middleware/lib/GetFilenameFromUrl.js' { 43 | declare module.exports: $Exports<'webpack-dev-middleware/lib/GetFilenameFromUrl'>; 44 | } 45 | declare module 'webpack-dev-middleware/lib/PathJoin.js' { 46 | declare module.exports: $Exports<'webpack-dev-middleware/lib/PathJoin'>; 47 | } 48 | declare module 'webpack-dev-middleware/lib/Shared.js' { 49 | declare module.exports: $Exports<'webpack-dev-middleware/lib/Shared'>; 50 | } 51 | declare module 'webpack-dev-middleware/middleware.js' { 52 | declare module.exports: $Exports<'webpack-dev-middleware/middleware'>; 53 | } 54 | -------------------------------------------------------------------------------- /src/app/containers/app/App.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React, { 4 | PureComponent 5 | } from 'react'; 6 | import PropTypes from 'prop-types'; 7 | import { 8 | NavigationBar, 9 | BackToTop 10 | } from '../../components'; 11 | import navigationModel from '../../config/navigation.json'; 12 | import { fromJS } from 'immutable'; 13 | import MainRoutes from '../../routes/MainRoutes'; 14 | import { withRouter } from 'react-router'; 15 | 16 | 17 | class App extends PureComponent { 18 | static propTypes = { 19 | // react-router 4: 20 | match: PropTypes.object.isRequired, 21 | location: PropTypes.object.isRequired, 22 | history: PropTypes.object.isRequired 23 | 24 | }; 25 | 26 | state = { 27 | navModel : fromJS(navigationModel) 28 | }; 29 | 30 | render() { 31 | const { navModel } = this.state; 32 | const { match: { url } } = this.props; 33 | 34 | return ( 35 |
    36 | 42 |
    43 | 44 |
    45 | 49 |
    50 | ); 51 | } 52 | 53 | handleLeftNavItemClick = ( 54 | event: SyntheticInputEvent, 55 | viewName: string 56 | ) => { 57 | // something to do here? 58 | } 59 | 60 | handleRightNavItemClick = ( 61 | event: SyntheticInputEvent, 62 | viewName 63 | ) => { 64 | // something to do here? 65 | } 66 | } 67 | 68 | export default withRouter(App); 69 | -------------------------------------------------------------------------------- /flow-typed/npm/redux-thunk_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 8790b051ec1da19a52447bf191c56bbf 2 | // flow-typed version: <>/redux-thunk_v^2.1.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'redux-thunk' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'redux-thunk' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'redux-thunk/dist/redux-thunk' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'redux-thunk/dist/redux-thunk.min' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'redux-thunk/es/index' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'redux-thunk/lib/index' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'redux-thunk/src/index' { 42 | declare module.exports: any; 43 | } 44 | 45 | // Filename aliases 46 | declare module 'redux-thunk/dist/redux-thunk.js' { 47 | declare module.exports: $Exports<'redux-thunk/dist/redux-thunk'>; 48 | } 49 | declare module 'redux-thunk/dist/redux-thunk.min.js' { 50 | declare module.exports: $Exports<'redux-thunk/dist/redux-thunk.min'>; 51 | } 52 | declare module 'redux-thunk/es/index.js' { 53 | declare module.exports: $Exports<'redux-thunk/es/index'>; 54 | } 55 | declare module 'redux-thunk/lib/index.js' { 56 | declare module.exports: $Exports<'redux-thunk/lib/index'>; 57 | } 58 | declare module 'redux-thunk/src/index.js' { 59 | declare module.exports: $Exports<'redux-thunk/src/index'>; 60 | } 61 | -------------------------------------------------------------------------------- /flow-typed/npm/cross-env_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: cabc29f0db79ed5d5195c261994ffbcc 2 | // flow-typed version: <>/cross-env_v^5.0.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'cross-env' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'cross-env' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'cross-env/dist/bin/cross-env-shell' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'cross-env/dist/bin/cross-env' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'cross-env/dist/command' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'cross-env/dist/index' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'cross-env/dist/variable' { 42 | declare module.exports: any; 43 | } 44 | 45 | // Filename aliases 46 | declare module 'cross-env/dist/bin/cross-env-shell.js' { 47 | declare module.exports: $Exports<'cross-env/dist/bin/cross-env-shell'>; 48 | } 49 | declare module 'cross-env/dist/bin/cross-env.js' { 50 | declare module.exports: $Exports<'cross-env/dist/bin/cross-env'>; 51 | } 52 | declare module 'cross-env/dist/command.js' { 53 | declare module.exports: $Exports<'cross-env/dist/command'>; 54 | } 55 | declare module 'cross-env/dist/index.js' { 56 | declare module.exports: $Exports<'cross-env/dist/index'>; 57 | } 58 | declare module 'cross-env/dist/variable.js' { 59 | declare module.exports: $Exports<'cross-env/dist/variable'>; 60 | } 61 | -------------------------------------------------------------------------------- /flow-typed/npm/dirty-chai_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: d04cb5f678b5576ac9f88450efa03a7a 2 | // flow-typed version: <>/dirty-chai_v^1.2.2/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'dirty-chai' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'dirty-chai' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'dirty-chai/Gruntfile' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'dirty-chai/lib/dirty-chai' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'dirty-chai/test/chai-as-promised-integration' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'dirty-chai/test/common' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'dirty-chai/test/dirty-chai.spec' { 42 | declare module.exports: any; 43 | } 44 | 45 | // Filename aliases 46 | declare module 'dirty-chai/Gruntfile.js' { 47 | declare module.exports: $Exports<'dirty-chai/Gruntfile'>; 48 | } 49 | declare module 'dirty-chai/lib/dirty-chai.js' { 50 | declare module.exports: $Exports<'dirty-chai/lib/dirty-chai'>; 51 | } 52 | declare module 'dirty-chai/test/chai-as-promised-integration.js' { 53 | declare module.exports: $Exports<'dirty-chai/test/chai-as-promised-integration'>; 54 | } 55 | declare module 'dirty-chai/test/common.js' { 56 | declare module.exports: $Exports<'dirty-chai/test/common'>; 57 | } 58 | declare module 'dirty-chai/test/dirty-chai.spec.js' { 59 | declare module.exports: $Exports<'dirty-chai/test/dirty-chai.spec'>; 60 | } 61 | -------------------------------------------------------------------------------- /flow-typed/npm/react-tap-event-plugin_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: f33b423abd81f70aea89f8efa0860edd 2 | // flow-typed version: <>/react-tap-event-plugin_v^2.0.1/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'react-tap-event-plugin' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'react-tap-event-plugin' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'react-tap-event-plugin/src/defaultClickRejectionStrategy' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'react-tap-event-plugin/src/injectTapEventPlugin' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'react-tap-event-plugin/src/TapEventPlugin' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'react-tap-event-plugin/src/TouchEventUtils' { 38 | declare module.exports: any; 39 | } 40 | 41 | // Filename aliases 42 | declare module 'react-tap-event-plugin/src/defaultClickRejectionStrategy.js' { 43 | declare module.exports: $Exports<'react-tap-event-plugin/src/defaultClickRejectionStrategy'>; 44 | } 45 | declare module 'react-tap-event-plugin/src/injectTapEventPlugin.js' { 46 | declare module.exports: $Exports<'react-tap-event-plugin/src/injectTapEventPlugin'>; 47 | } 48 | declare module 'react-tap-event-plugin/src/TapEventPlugin.js' { 49 | declare module.exports: $Exports<'react-tap-event-plugin/src/TapEventPlugin'>; 50 | } 51 | declare module 'react-tap-event-plugin/src/TouchEventUtils.js' { 52 | declare module.exports: $Exports<'react-tap-event-plugin/src/TouchEventUtils'>; 53 | } 54 | -------------------------------------------------------------------------------- /src/app/components/privateRoute/PrivateRoute.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React, { 4 | Component 5 | } from 'react'; 6 | import PropTypes from 'prop-types'; 7 | import { 8 | Route, 9 | Redirect, 10 | withRouter 11 | } from "react-router-dom"; 12 | import auth from '../../services/auth'; 13 | 14 | class PrivateRoute extends Component { 15 | static propTypes = { 16 | // react-router 4: 17 | match: PropTypes.object.isRequired, 18 | location: PropTypes.object.isRequired, 19 | history: PropTypes.object.isRequired, 20 | 21 | component: PropTypes.any.isRequired, 22 | path: PropTypes.string 23 | }; 24 | 25 | render() { 26 | const { 27 | component: InnerComponent, 28 | ...rest 29 | } = this.props; 30 | const { location } = this.props; 31 | 32 | const isUserAuthenticated = this.isAuthenticated(); 33 | const isTokenExpired = this.isExpired(); 34 | 35 | return ( 36 | ( 40 | !isTokenExpired && isUserAuthenticated 41 | ? 42 | : 43 | ) 44 | } 45 | /> 46 | ); 47 | } 48 | 49 | isAuthenticated() { 50 | const checkUserHasId = user => user && user.id; 51 | const user = auth.getUserInfo() 52 | ? auth.getUserInfo() 53 | : null; 54 | const isAuthenticated = auth.getToken() && checkUserHasId(user) 55 | ? true 56 | : false; 57 | return isAuthenticated; 58 | } 59 | 60 | isExpired() { 61 | // comment me: 62 | console.log('token expires: ', auth.getTokenExpirationDate(auth.getToken())); 63 | return auth.isExpiredToken(auth.getToken()); 64 | } 65 | } 66 | 67 | export default withRouter(PrivateRoute); 68 | -------------------------------------------------------------------------------- /test/components/backToTop/backToTopButton/BackToTopButton.spec.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { shallow } from 'enzyme'; 3 | import chai, {expect} from 'chai'; 4 | import sinon from 'sinon'; 5 | import dirtyChai from 'dirty-chai'; 6 | import BackToTopButton from '../../../../src/app/components/backToTop/backToTopButton/BackToTopButton'; 7 | 8 | chai.use(dirtyChai); 9 | 10 | const positionMock = 'bottom-left'; 11 | const motionStyleMock= {width: '100px'}; 12 | 13 | 14 | describe('', () => { 15 | const props = { 16 | position: positionMock, 17 | motionStyle: motionStyleMock, 18 | onClick: () => {} 19 | }; 20 | 21 | it('should render a BackToTopButton', () => { 22 | const wrapper = shallow(); 23 | 24 | expect(wrapper).to.exist(); 25 | }); 26 | 27 | it('should have UpIcon as default children', () => { 28 | const wrapper = shallow(); 29 | const UpIcon = wrapper.find('UpIcon'); 30 | 31 | expect(UpIcon).to.exist(); 32 | expect(UpIcon.prop('color')).to.exist(); 33 | }); 34 | 35 | it('should not have UpIcon as children but a span', () => { 36 | const extentedProps = { 37 | ...props, 38 | children: (a child) 39 | }; 40 | const wrapper = shallow(); 41 | const childSpan = wrapper.find('.childSpan'); 42 | 43 | expect(childSpan).to.exist(); 44 | }); 45 | 46 | it('should trigger onClick function prop on click', () => { 47 | const event = {}; 48 | const onClickStub = sinon.spy(); 49 | 50 | const wrapper = shallow( 51 | 56 | ); 57 | const Button = wrapper.find('button'); 58 | Button.simulate('click', event); 59 | 60 | expect(onClickStub.calledOnce).to.equal(true); 61 | }); 62 | }); 63 | -------------------------------------------------------------------------------- /flow-typed/npm/style-loader_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 47a39b8b22b82efd7f453571360d5188 2 | // flow-typed version: <>/style-loader_v^0.18.1/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'style-loader' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'style-loader' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'style-loader/lib/addStyles' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'style-loader/lib/addStyleUrl' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'style-loader/lib/urls' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'style-loader/url' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'style-loader/useable' { 42 | declare module.exports: any; 43 | } 44 | 45 | // Filename aliases 46 | declare module 'style-loader/index' { 47 | declare module.exports: $Exports<'style-loader'>; 48 | } 49 | declare module 'style-loader/index.js' { 50 | declare module.exports: $Exports<'style-loader'>; 51 | } 52 | declare module 'style-loader/lib/addStyles.js' { 53 | declare module.exports: $Exports<'style-loader/lib/addStyles'>; 54 | } 55 | declare module 'style-loader/lib/addStyleUrl.js' { 56 | declare module.exports: $Exports<'style-loader/lib/addStyleUrl'>; 57 | } 58 | declare module 'style-loader/lib/urls.js' { 59 | declare module.exports: $Exports<'style-loader/lib/urls'>; 60 | } 61 | declare module 'style-loader/url.js' { 62 | declare module.exports: $Exports<'style-loader/url'>; 63 | } 64 | declare module 'style-loader/useable.js' { 65 | declare module.exports: $Exports<'style-loader/useable'>; 66 | } 67 | -------------------------------------------------------------------------------- /src/app/views/home/Home.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React, { 4 | PureComponent 5 | } from 'react'; 6 | import PropTypes from 'prop-types'; 7 | import { 8 | Jumbotron 9 | } from '../../components'; 10 | import AnimatedView from '../../components/animatedView/AnimatedView'; 11 | import { Link } from 'react-router-dom'; 12 | 13 | function testTime() { 14 | return new Promise( 15 | (resolve) => setTimeout(() => resolve('async-await works'), 200) 16 | ); 17 | } 18 | 19 | class Home extends PureComponent { 20 | static propTypes= { 21 | // react-router 4: 22 | match: PropTypes.object.isRequired, 23 | location: PropTypes.object.isRequired, 24 | history: PropTypes.object.isRequired, 25 | 26 | // views: 27 | currentView: PropTypes.string.isRequired, 28 | enterHome: PropTypes.func.isRequired, 29 | leaveHome: PropTypes.func.isRequired 30 | }; 31 | 32 | async componentDidMount() { 33 | const { enterHome } = this.props; 34 | enterHome(); 35 | const message = await testTime(); 36 | console.log('valid async await: ', message); 37 | } 38 | 39 | componentWillUnmount() { 40 | const { leaveHome } = this.props; 41 | leaveHome(); 42 | } 43 | 44 | render() { 45 | return( 46 | 47 | 48 |

    49 | React + Redux + Immutable + Bootstrap 50 |

    51 |

    52 | with Hot Reload!!! 53 |

    54 |

    55 | and React Router v4 56 |

    57 |

    58 | and webpack 3.x 59 |

    60 |

    61 | Starter 62 |

    63 |

    64 | 67 | 68 |   69 | go to about 70 | 71 |

    72 |
    73 |
    74 | ); 75 | } 76 | } 77 | 78 | export default Home; 79 | -------------------------------------------------------------------------------- /flow-typed/npm/redux-logger_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: c363641e15e05942723862d10d245e02 2 | // flow-typed version: <>/redux-logger_v^3.0.6/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'redux-logger' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'redux-logger' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'redux-logger/dist/redux-logger' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'redux-logger/src/core' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'redux-logger/src/defaults' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'redux-logger/src/diff' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'redux-logger/src/helpers' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'redux-logger/src/index' { 46 | declare module.exports: any; 47 | } 48 | 49 | // Filename aliases 50 | declare module 'redux-logger/dist/redux-logger.js' { 51 | declare module.exports: $Exports<'redux-logger/dist/redux-logger'>; 52 | } 53 | declare module 'redux-logger/src/core.js' { 54 | declare module.exports: $Exports<'redux-logger/src/core'>; 55 | } 56 | declare module 'redux-logger/src/defaults.js' { 57 | declare module.exports: $Exports<'redux-logger/src/defaults'>; 58 | } 59 | declare module 'redux-logger/src/diff.js' { 60 | declare module.exports: $Exports<'redux-logger/src/diff'>; 61 | } 62 | declare module 'redux-logger/src/helpers.js' { 63 | declare module.exports: $Exports<'redux-logger/src/helpers'>; 64 | } 65 | declare module 'redux-logger/src/index.js' { 66 | declare module.exports: $Exports<'redux-logger/src/index'>; 67 | } 68 | -------------------------------------------------------------------------------- /src/app/Root.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | /* eslint-disable no-process-env */ 4 | import React, { 5 | Component 6 | } from 'react'; 7 | import { 8 | // BrowserRouter as Router, 9 | HashRouter as Router, 10 | Switch, 11 | Route 12 | } from 'react-router-dom'; 13 | import { Provider } from 'react-redux'; 14 | import { syncHistoryWithStore } from 'react-router-redux'; 15 | import configureStore from './redux/store/configureStore'; 16 | import { createBrowserHistory } from 'history'; 17 | import { fromJS } from 'immutable'; 18 | import App from './containers/app/App'; 19 | import ScrollToTop from './components/scrollToTop/ScrollToTop'; 20 | import Login from './views/login'; 21 | import PageNotFound from './views/pageNotFound/PageNotFound'; // not connected to redux (no index.js) 22 | import LogoutRoute from './components/logoutRoute/LogoutRoute'; 23 | 24 | 25 | const preloadedState = window.__PRELOADED_STATE__; 26 | delete window.__PRELOADED_STATE__; 27 | 28 | const history = createBrowserHistory(); 29 | const store = configureStore(fromJS(preloadedState)); 30 | const syncedHistory = syncHistoryWithStore( 31 | history, 32 | store, 33 | { 34 | selectLocationState(state) { 35 | return state.get('routing').toJS(); 36 | } 37 | } 38 | ); 39 | 40 | class Root extends Component { 41 | render() { 42 | return ( 43 | 44 |
    45 | 46 | 47 | 48 | 49 | 50 | {/* logout: just redirects to login (App will take care of removing the token) */} 51 | 52 | 53 | 54 | 55 | 56 |
    57 |
    58 | ); 59 | } 60 | } 61 | 62 | export default Root; 63 | -------------------------------------------------------------------------------- /flow-typed/npm/redux-devtools-extension_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: e2f0359657270d61bf68e034b19edded 2 | // flow-typed version: <>/redux-devtools-extension_v^2.13.2/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'redux-devtools-extension' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'redux-devtools-extension' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'redux-devtools-extension/developmentOnly' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'redux-devtools-extension/logOnly' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'redux-devtools-extension/logOnlyInProduction' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'redux-devtools-extension/utils/assign' { 38 | declare module.exports: any; 39 | } 40 | 41 | // Filename aliases 42 | declare module 'redux-devtools-extension/developmentOnly.js' { 43 | declare module.exports: $Exports<'redux-devtools-extension/developmentOnly'>; 44 | } 45 | declare module 'redux-devtools-extension/index' { 46 | declare module.exports: $Exports<'redux-devtools-extension'>; 47 | } 48 | declare module 'redux-devtools-extension/index.js' { 49 | declare module.exports: $Exports<'redux-devtools-extension'>; 50 | } 51 | declare module 'redux-devtools-extension/logOnly.js' { 52 | declare module.exports: $Exports<'redux-devtools-extension/logOnly'>; 53 | } 54 | declare module 'redux-devtools-extension/logOnlyInProduction.js' { 55 | declare module.exports: $Exports<'redux-devtools-extension/logOnlyInProduction'>; 56 | } 57 | declare module 'redux-devtools-extension/utils/assign.js' { 58 | declare module.exports: $Exports<'redux-devtools-extension/utils/assign'>; 59 | } 60 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-loader_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: d82f2cd6e62d7fc4b3d955e7a8c9421a 2 | // flow-typed version: <>/babel-loader_v^7.1.1/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-loader' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-loader' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-loader/lib/fs-cache' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-loader/lib/index' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-loader/lib/resolve-rc' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-loader/lib/utils/exists' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-loader/lib/utils/read' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-loader/lib/utils/relative' { 46 | declare module.exports: any; 47 | } 48 | 49 | // Filename aliases 50 | declare module 'babel-loader/lib/fs-cache.js' { 51 | declare module.exports: $Exports<'babel-loader/lib/fs-cache'>; 52 | } 53 | declare module 'babel-loader/lib/index.js' { 54 | declare module.exports: $Exports<'babel-loader/lib/index'>; 55 | } 56 | declare module 'babel-loader/lib/resolve-rc.js' { 57 | declare module.exports: $Exports<'babel-loader/lib/resolve-rc'>; 58 | } 59 | declare module 'babel-loader/lib/utils/exists.js' { 60 | declare module.exports: $Exports<'babel-loader/lib/utils/exists'>; 61 | } 62 | declare module 'babel-loader/lib/utils/read.js' { 63 | declare module.exports: $Exports<'babel-loader/lib/utils/read'>; 64 | } 65 | declare module 'babel-loader/lib/utils/relative.js' { 66 | declare module.exports: $Exports<'babel-loader/lib/utils/relative'>; 67 | } 68 | -------------------------------------------------------------------------------- /src/app/components/backToTop/backToTopButton/BackToTopButton.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React from 'react'; 4 | import PropTypes from 'prop-types'; 5 | import cx from 'classnames'; 6 | import UpIcon from './UpIcon'; 7 | 8 | const defaultBackGroundColor = '#4A4A4A'; 9 | const sideOffset = '-10px'; 10 | const bottomOffset = '40px'; 11 | const defaultWidth = '100px'; 12 | const defaultZindex = 10; 13 | const defaultOpacity= 0.5; 14 | const defaultStyle = { 15 | position: 'fixed', 16 | right: sideOffset, 17 | left: '', 18 | bottom: bottomOffset, 19 | width: defaultWidth, 20 | zIndex: defaultZindex, 21 | opacity: defaultOpacity, 22 | backgroundColor: defaultBackGroundColor 23 | }; 24 | 25 | const BackToTopButton = ({ 26 | onClick, 27 | position, 28 | children, 29 | motionStyle 30 | }) => { 31 | const buttonStyle = setPosition(position, {...motionStyle, ...defaultStyle}); 32 | 33 | return ( 34 | 51 | ); 52 | }; 53 | 54 | BackToTopButton.propTypes = { 55 | position: PropTypes.oneOf(['bottom-left', 'bottom-right']), 56 | onClick: PropTypes.func.isRequired, 57 | children: PropTypes.node, 58 | motionStyle: PropTypes.object 59 | }; 60 | 61 | BackToTopButton.defaultProps = { 62 | position: 'bottom-right' 63 | }; 64 | 65 | function setPosition(position = 'bottom-right', refStyle = defaultStyle) { 66 | const style = {...refStyle}; 67 | 68 | switch (position) { 69 | case 'bottom-right': 70 | style.right = sideOffset; 71 | style.left = ''; 72 | return style; 73 | 74 | case 'bottom-left': 75 | style.right = ''; 76 | style.left = sideOffset; 77 | return style; 78 | 79 | default: 80 | return refStyle; 81 | } 82 | } 83 | 84 | export default BackToTopButton; 85 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-polyfill_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 520ecb2acab17741038d40ae1f2758ca 2 | // flow-typed version: <>/babel-polyfill_v^6.16.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-polyfill' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-polyfill' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-polyfill/browser' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-polyfill/dist/polyfill' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-polyfill/dist/polyfill.min' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-polyfill/lib/index' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-polyfill/scripts/postpublish' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-polyfill/scripts/prepublish' { 46 | declare module.exports: any; 47 | } 48 | 49 | // Filename aliases 50 | declare module 'babel-polyfill/browser.js' { 51 | declare module.exports: $Exports<'babel-polyfill/browser'>; 52 | } 53 | declare module 'babel-polyfill/dist/polyfill.js' { 54 | declare module.exports: $Exports<'babel-polyfill/dist/polyfill'>; 55 | } 56 | declare module 'babel-polyfill/dist/polyfill.min.js' { 57 | declare module.exports: $Exports<'babel-polyfill/dist/polyfill.min'>; 58 | } 59 | declare module 'babel-polyfill/lib/index.js' { 60 | declare module.exports: $Exports<'babel-polyfill/lib/index'>; 61 | } 62 | declare module 'babel-polyfill/scripts/postpublish.js' { 63 | declare module.exports: $Exports<'babel-polyfill/scripts/postpublish'>; 64 | } 65 | declare module 'babel-polyfill/scripts/prepublish.js' { 66 | declare module.exports: $Exports<'babel-polyfill/scripts/prepublish'>; 67 | } 68 | -------------------------------------------------------------------------------- /flow-typed/npm/sass-loader_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 8c0de165a64bf335d1729e329ea038b4 2 | // flow-typed version: <>/sass-loader_v^6.0.5/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'sass-loader' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'sass-loader' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'sass-loader/lib/formatSassError' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'sass-loader/lib/importsToResolve' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'sass-loader/lib/loader' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'sass-loader/lib/normalizeOptions' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'sass-loader/lib/proxyCustomImporters' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'sass-loader/lib/webpackImporter' { 46 | declare module.exports: any; 47 | } 48 | 49 | // Filename aliases 50 | declare module 'sass-loader/lib/formatSassError.js' { 51 | declare module.exports: $Exports<'sass-loader/lib/formatSassError'>; 52 | } 53 | declare module 'sass-loader/lib/importsToResolve.js' { 54 | declare module.exports: $Exports<'sass-loader/lib/importsToResolve'>; 55 | } 56 | declare module 'sass-loader/lib/loader.js' { 57 | declare module.exports: $Exports<'sass-loader/lib/loader'>; 58 | } 59 | declare module 'sass-loader/lib/normalizeOptions.js' { 60 | declare module.exports: $Exports<'sass-loader/lib/normalizeOptions'>; 61 | } 62 | declare module 'sass-loader/lib/proxyCustomImporters.js' { 63 | declare module.exports: $Exports<'sass-loader/lib/proxyCustomImporters'>; 64 | } 65 | declare module 'sass-loader/lib/webpackImporter.js' { 66 | declare module.exports: $Exports<'sass-loader/lib/webpackImporter'>; 67 | } 68 | -------------------------------------------------------------------------------- /typings/globals/react-router-dom/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/984933df7c89afcb97e42adbe37b6df5dd7b253c/react-router-dom/index.d.ts 3 | declare module 'react-router-dom' { 4 | import { 5 | Prompt, 6 | MemoryRouter, 7 | Redirect, 8 | RouteComponentProps, 9 | RouteProps, 10 | Route, 11 | Router, 12 | StaticRouter, 13 | Switch, 14 | match, 15 | matchPath, 16 | withRouter 17 | } from 'react-router'; 18 | import * as React from 'react'; 19 | import * as H from 'history'; 20 | 21 | 22 | interface BrowserRouterProps { 23 | basename?: string; 24 | getUserConfirmation?: () => void; 25 | forceRefresh?: boolean; 26 | keyLength?: number; 27 | } 28 | class BrowserRouter extends React.Component {} 29 | 30 | 31 | interface HashRouterProps { 32 | basename?: string; 33 | getUserConfirmation?: () => void; 34 | hashType?: 'slash' | 'noslash' | 'hashbang'; 35 | } 36 | class HashRouter extends React.Component {} 37 | 38 | 39 | interface LinkProps extends React.HTMLAttributes { 40 | to: H.LocationDescriptor; 41 | replace?: boolean; 42 | } 43 | class Link extends React.Component {} 44 | 45 | 46 | interface NavLinkProps extends LinkProps { 47 | activeClassName?: string; 48 | activeStyle?: React.CSSProperties; 49 | exact?: boolean; 50 | strict?: boolean; 51 | isActive?: (location: H.Location, props: any) => boolean; 52 | } 53 | class NavLink extends React.Component {} 54 | 55 | 56 | export { 57 | BrowserRouter, 58 | HashRouter, 59 | LinkProps, // TypeScript specific, not from React Router itself 60 | Link, 61 | NavLink, 62 | Prompt, 63 | MemoryRouter, 64 | Redirect, 65 | RouteComponentProps, // TypeScript specific, not from React Router itself 66 | RouteProps, // TypeScript specific, not from React Router itself 67 | Route, 68 | Router, 69 | StaticRouter, 70 | Switch, 71 | match, // TypeScript specific, not from React Router itself 72 | matchPath, 73 | withRouter 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /flow-typed/npm/postcss-import_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: da743115a92d51635ac460b16828c9af 2 | // flow-typed version: <>/postcss-import_v^10.0.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'postcss-import' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'postcss-import' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'postcss-import/lib/join-media' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'postcss-import/lib/load-content' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'postcss-import/lib/parse-statements' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'postcss-import/lib/process-content' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'postcss-import/lib/resolve-id' { 42 | declare module.exports: any; 43 | } 44 | 45 | // Filename aliases 46 | declare module 'postcss-import/index' { 47 | declare module.exports: $Exports<'postcss-import'>; 48 | } 49 | declare module 'postcss-import/index.js' { 50 | declare module.exports: $Exports<'postcss-import'>; 51 | } 52 | declare module 'postcss-import/lib/join-media.js' { 53 | declare module.exports: $Exports<'postcss-import/lib/join-media'>; 54 | } 55 | declare module 'postcss-import/lib/load-content.js' { 56 | declare module.exports: $Exports<'postcss-import/lib/load-content'>; 57 | } 58 | declare module 'postcss-import/lib/parse-statements.js' { 59 | declare module.exports: $Exports<'postcss-import/lib/parse-statements'>; 60 | } 61 | declare module 'postcss-import/lib/process-content.js' { 62 | declare module.exports: $Exports<'postcss-import/lib/process-content'>; 63 | } 64 | declare module 'postcss-import/lib/resolve-id.js' { 65 | declare module.exports: $Exports<'postcss-import/lib/resolve-id'>; 66 | } 67 | -------------------------------------------------------------------------------- /src/app/components/backToTop/lib/smoothScroll.js: -------------------------------------------------------------------------------- 1 | import { isBrowserSide } from '../../../services/universal'; 2 | 3 | export const smoothScroll = { 4 | timer: null, 5 | 6 | stop() { 7 | clearTimeout(this.timer); 8 | }, 9 | 10 | scrollTo(id, callback) { 11 | if (isBrowserSide()) { 12 | return; 13 | } 14 | 15 | const settings = { 16 | duration: 1000, 17 | easing: { 18 | outQuint(x, t, b, c, d) { 19 | /* eslint-disable no-param-reassign*/ 20 | return c*((t=t/d-1)*t*t*t*t + 1) + b; 21 | /* eslint-enable no-param-reassign*/ 22 | } 23 | } 24 | }; 25 | let percentage; 26 | const node = document.getElementById(id); 27 | const nodeTop = node.offsetTop; 28 | const nodeHeight = node.offsetHeight; 29 | const body = document.body; 30 | const html = document.documentElement; 31 | const height = Math.max( 32 | body.scrollHeight, 33 | body.offsetHeight, 34 | html.clientHeight, 35 | html.scrollHeight, 36 | html.offsetHeight 37 | ); 38 | const windowHeight = window.innerHeight; 39 | const offset = window.pageYOffset; 40 | const delta = nodeTop - offset; 41 | const bottomScrollableY = height - windowHeight; 42 | const targetY = (bottomScrollableY < delta) ? 43 | bottomScrollableY - (height - nodeTop - nodeHeight + offset): 44 | delta; 45 | 46 | const startTime = Date.now(); 47 | percentage = 0; 48 | 49 | if (this.timer) { 50 | clearInterval(this.timer); 51 | } 52 | 53 | function step() { 54 | let yScroll; 55 | const elapsed = Date.now() - startTime; 56 | 57 | if (elapsed > settings.duration) { 58 | clearTimeout(this.timer); 59 | } 60 | 61 | percentage = elapsed / settings.duration; 62 | 63 | if (percentage > 1) { 64 | clearTimeout(this.timer); 65 | 66 | if (callback) { 67 | callback(); 68 | } 69 | } else { 70 | yScroll = settings.easing.outQuint(0, elapsed, offset, targetY, settings.duration); 71 | window.scrollTo(0, yScroll); 72 | this.timer = setTimeout(step, 10); 73 | } 74 | } 75 | 76 | this.timer = setTimeout(step, 10); 77 | } 78 | }; 79 | -------------------------------------------------------------------------------- /webpack.hot.reload.config.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | const webpack = require('webpack'); 4 | const path = require('path'); 5 | 6 | const assetsDir = path.join(__dirname, 'public/assets'); 7 | const vendorsDir = path.join(__dirname, 'src/app/vendors'); 8 | const srcInclude = path.join(__dirname, 'src/app'); 9 | const indexFile = path.join(__dirname, 'src/app/index.js'); 10 | 11 | const config = { 12 | devtool: 'cheap-module-source-map', 13 | entry: [ 14 | 'babel-polyfill', 15 | 'react-hot-loader/patch', 16 | 'webpack-hot-middleware/client', 17 | indexFile 18 | ], 19 | output: { 20 | path: assetsDir, 21 | filename: 'bundle.js', 22 | publicPath: '/public/assets/' 23 | }, 24 | module: { 25 | rules: [ 26 | { 27 | test: /\.jsx?$/, 28 | include: srcInclude, 29 | exclude: [vendorsDir], 30 | loaders: ['babel-loader'] 31 | }, 32 | { 33 | test: /\.css$/, 34 | use: [ 35 | 'style-loader', 36 | {loader: 'css-loader', options: { importLoaders: 1 }}, 37 | 'postcss-loader' 38 | ] 39 | }, 40 | { 41 | test: /\.scss$/, 42 | use: [ 43 | 'style-loader', 44 | {loader: 'css-loader', options: { importLoaders: 1 }}, 45 | 'postcss-loader', 46 | 'sass-loader' 47 | ] 48 | }, 49 | { 50 | test: /\.(eot|woff|woff2|ttf|svg|png|jpe?g|gif)(\?\S*)?$/, 51 | use: [ 52 | { 53 | loader: 'url-loader', 54 | options: { 55 | limit: 100000, 56 | name: '[name].[ext]' 57 | } 58 | } 59 | ] 60 | } 61 | ] 62 | }, 63 | plugins: [ 64 | new webpack.HotModuleReplacementPlugin(), 65 | new webpack.NoEmitOnErrorsPlugin(), 66 | getImplicitGlobals(), 67 | setNodeEnv() 68 | ] 69 | }; 70 | /* 71 | * here using hoisting so don't use `var NAME = function()...` 72 | */ 73 | function getImplicitGlobals() { 74 | return new webpack.ProvidePlugin({ 75 | $: 'jquery', 76 | jQuery: 'jquery', 77 | jquery: 'jquery' 78 | }); 79 | } 80 | 81 | function setNodeEnv() { 82 | return new webpack.DefinePlugin({ 83 | 'process.env': { 84 | 'NODE_ENV': JSON.stringify('dev') 85 | } 86 | }); 87 | } 88 | 89 | module.exports = config; 90 | -------------------------------------------------------------------------------- /flow-typed/npm/js-base64_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 97e62d8bb531904e7a381163d9340eb5 2 | // flow-typed version: <>/js-base64_v^2.1.9/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'js-base64' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'js-base64' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'js-base64/base64' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'js-base64/base64.min' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'js-base64/old/base64-1.7' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'js-base64/package' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'js-base64/test/dankogai' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'js-base64/test/es5' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'js-base64/test/large' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'js-base64/test/yoshinoya' { 54 | declare module.exports: any; 55 | } 56 | 57 | // Filename aliases 58 | declare module 'js-base64/base64.js' { 59 | declare module.exports: $Exports<'js-base64/base64'>; 60 | } 61 | declare module 'js-base64/base64.min.js' { 62 | declare module.exports: $Exports<'js-base64/base64.min'>; 63 | } 64 | declare module 'js-base64/old/base64-1.7.js' { 65 | declare module.exports: $Exports<'js-base64/old/base64-1.7'>; 66 | } 67 | declare module 'js-base64/package.js' { 68 | declare module.exports: $Exports<'js-base64/package'>; 69 | } 70 | declare module 'js-base64/test/dankogai.js' { 71 | declare module.exports: $Exports<'js-base64/test/dankogai'>; 72 | } 73 | declare module 'js-base64/test/es5.js' { 74 | declare module.exports: $Exports<'js-base64/test/es5'>; 75 | } 76 | declare module 'js-base64/test/large.js' { 77 | declare module.exports: $Exports<'js-base64/test/large'>; 78 | } 79 | declare module 'js-base64/test/yoshinoya.js' { 80 | declare module.exports: $Exports<'js-base64/test/yoshinoya'>; 81 | } 82 | -------------------------------------------------------------------------------- /flow-typed/npm/react-addons-test-utils_v15.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: dec14d60ce37020ac7e52f7f32ade63b 2 | // flow-typed version: b43dff3e0e/react-addons-test-utils_v15.x.x/flow_>=v0.22.x 3 | 4 | declare type ReactAddonTest$FunctionOrComponentClass = React$Component | Function; 5 | declare module 'react-addons-test-utils' { 6 | declare var Simulate: { 7 | [eventName: string]: (element: Element, eventData?: Object) => void; 8 | }; 9 | declare function renderIntoDocument(instance: React$Element): React$Component; 10 | declare function mockComponent(componentClass: ReactAddonTest$FunctionOrComponentClass, mockTagName?: string): Object; 11 | declare function isElement(element: React$Element): boolean; 12 | declare function isElementOfType(element: React$Element, componentClass: ReactAddonTest$FunctionOrComponentClass): boolean; 13 | declare function isDOMComponent(instance: React$Component): boolean; 14 | declare function isCompositeComponent(instance: React$Component): boolean; 15 | declare function isCompositeComponentWithType(instance: React$Component, componentClass: ReactAddonTest$FunctionOrComponentClass): boolean; 16 | declare function findAllInRenderedTree(tree: React$Component, test: (child: React$Component) => boolean): Array>; 17 | declare function scryRenderedDOMComponentsWithClass(tree: React$Component, className: string): Array; 18 | declare function findRenderedDOMComponentWithClass(tree: React$Component, className: string): ?Element; 19 | declare function scryRenderedDOMComponentsWithTag(tree: React$Component, tagName: string): Array; 20 | declare function findRenderedDOMComponentWithTag(tree: React$Component, tagName: string): ?Element; 21 | declare function scryRenderedComponentsWithType(tree: React$Component, componentClass: ReactAddonTest$FunctionOrComponentClass): Array>; 22 | declare function findRenderedComponentWithType(tree: React$Component, componentClass: ReactAddonTest$FunctionOrComponentClass): ?React$Component; 23 | declare class ReactShallowRender { 24 | render(element: React$Element): void; 25 | getRenderOutput(): React$Element; 26 | } 27 | declare function createRenderer(): ReactShallowRender; 28 | } 29 | -------------------------------------------------------------------------------- /src/app/style/_mixins.scss: -------------------------------------------------------------------------------- 1 | 2 | @mixin background-cover { 3 | -webkit-background-size: cover; 4 | -moz-background-size: cover; 5 | background-size: cover; 6 | } 7 | 8 | @mixin card-shadows { 9 | box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.2), 0 1px 5px 0 rgba(0,0,0,.12); 10 | } 11 | 12 | // animations 13 | @mixin fade-in($delay, $duration, $ease) { 14 | opacity: 0; 15 | animation-name: fadeIn; 16 | animation-timing-function: $ease; 17 | animation-duration: $duration; 18 | animation-delay: $delay; 19 | animation-fill-mode: both; 20 | 21 | @keyframes fadeIn { 22 | from { 23 | opacity: 0; 24 | } 25 | to { 26 | opacity: 1; 27 | transform: none; 28 | } 29 | } 30 | } 31 | 32 | @mixin fade-in-right($delay, $duration) { 33 | opacity: 0; 34 | animation-name: fadeInRight; 35 | animation-timing-function: ease-out; 36 | animation-duration: $duration; 37 | animation-delay: $delay; 38 | animation-fill-mode: both; 39 | 40 | @keyframes fadeInRight { 41 | from { 42 | opacity: 0; 43 | transform: translate3d(50%, 0, 0); 44 | } 45 | to { 46 | opacity: 1; 47 | transform: none; 48 | } 49 | } 50 | } 51 | 52 | @mixin fade-in-right-pulse($delay, $duration) { 53 | opacity: 0; 54 | animation-name: fadeInRightPulse; 55 | animation-timing-function: ease-out; 56 | animation-duration: $duration; 57 | animation-delay: $delay; 58 | animation-fill-mode: both; 59 | 60 | @keyframes fadeInRightPulse { 61 | from { 62 | opacity: 0; 63 | transform: translate3d(50%, 0, 0); 64 | } 65 | 50% { 66 | opacity: 1; 67 | transform: scale3d(1, 1, 1); 68 | } 69 | 75% { 70 | transform: scale3d(1.05, 1.05, 1.05); 71 | } 72 | to { 73 | transform: scale3d(1, 1, 1); 74 | opacity: 1; 75 | } 76 | } 77 | } 78 | 79 | @mixin fade-in-down($delay, $duration) { 80 | opacity: 0; 81 | animation-name: fadeInDown; 82 | animation-timing-function: ease-out; 83 | animation-duration: $duration; 84 | animation-delay: $delay; 85 | animation-fill-mode: both; 86 | 87 | @keyframes fadeInDown { 88 | from { 89 | opacity: 0; 90 | transform: translate3d(0, -40%, 0); 91 | } 92 | 93 | 75% { 94 | opacity: 0.4; 95 | } 96 | 97 | to { 98 | opacity: 1; 99 | transform: none; 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /flow-typed/npm/jwt-decode_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: cc4d5f66351b17e09a936a1ebc783a96 2 | // flow-typed version: <>/jwt-decode_v^2.2.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'jwt-decode' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'jwt-decode' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'jwt-decode/build/jwt-decode' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'jwt-decode/build/jwt-decode.min' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'jwt-decode/Gruntfile' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'jwt-decode/lib/atob' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'jwt-decode/lib/base64_url_decode' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'jwt-decode/lib/index' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'jwt-decode/standalone' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'jwt-decode/test/tests' { 54 | declare module.exports: any; 55 | } 56 | 57 | // Filename aliases 58 | declare module 'jwt-decode/build/jwt-decode.js' { 59 | declare module.exports: $Exports<'jwt-decode/build/jwt-decode'>; 60 | } 61 | declare module 'jwt-decode/build/jwt-decode.min.js' { 62 | declare module.exports: $Exports<'jwt-decode/build/jwt-decode.min'>; 63 | } 64 | declare module 'jwt-decode/Gruntfile.js' { 65 | declare module.exports: $Exports<'jwt-decode/Gruntfile'>; 66 | } 67 | declare module 'jwt-decode/lib/atob.js' { 68 | declare module.exports: $Exports<'jwt-decode/lib/atob'>; 69 | } 70 | declare module 'jwt-decode/lib/base64_url_decode.js' { 71 | declare module.exports: $Exports<'jwt-decode/lib/base64_url_decode'>; 72 | } 73 | declare module 'jwt-decode/lib/index.js' { 74 | declare module.exports: $Exports<'jwt-decode/lib/index'>; 75 | } 76 | declare module 'jwt-decode/standalone.js' { 77 | declare module.exports: $Exports<'jwt-decode/standalone'>; 78 | } 79 | declare module 'jwt-decode/test/tests.js' { 80 | declare module.exports: $Exports<'jwt-decode/test/tests'>; 81 | } 82 | -------------------------------------------------------------------------------- /src/app/components/navigation/NavigationBar.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import React, { 4 | PureComponent 5 | } from 'react'; 6 | import PropTypes from 'prop-types'; 7 | import Humburger from './humburger/Humburger'; 8 | import LeftNav from './leftNav/LeftNav'; 9 | import RightNav from './rightNav/RightNav'; 10 | import * as Immutable from 'immutable'; 11 | 12 | class NavigationBar extends PureComponent { 13 | static propTypes = { 14 | brand: PropTypes.string, 15 | handleLeftNavItemClick: PropTypes.func, 16 | handleRightNavItemClick: PropTypes.func, 17 | 18 | navModel: PropTypes.instanceOf(Immutable.Map) 19 | // not immutable version of navModel would be described like: 20 | // navModel: PropTypes.shape({ 21 | // leftLinks: PropTypes.arrayOf( 22 | // PropTypes.shape({ 23 | // label: PropTypes.string.isRequired, 24 | // link : PropTypes.string.isRequired 25 | // }) 26 | // ).isRequired, 27 | // rightLinks: PropTypes.arrayOf( 28 | // PropTypes.shape({ 29 | // label: PropTypes.string.isRequired, 30 | // link : PropTypes.string.isRequired 31 | // }) 32 | // ).isRequired 33 | // }) 34 | }; 35 | 36 | static defaultProps = { 37 | brand : 'brand' 38 | }; 39 | 40 | render() { 41 | const { 42 | brand, 43 | navModel, 44 | handleLeftNavItemClick, 45 | handleRightNavItemClick 46 | } = this.props; 47 | 48 | return ( 49 | 75 | ); 76 | } 77 | } 78 | 79 | export default NavigationBar; 80 | -------------------------------------------------------------------------------- /flow-typed/npm/webpack-hot-middleware_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: edd4d9466a1fe6884fa567a1f66d0a2b 2 | // flow-typed version: <>/webpack-hot-middleware_v^2.18.2/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'webpack-hot-middleware' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'webpack-hot-middleware' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'webpack-hot-middleware/client-overlay' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'webpack-hot-middleware/client' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'webpack-hot-middleware/coverage/lcov-report/prettify' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'webpack-hot-middleware/coverage/lcov-report/sorter' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'webpack-hot-middleware/helpers' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'webpack-hot-middleware/middleware' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'webpack-hot-middleware/process-update' { 50 | declare module.exports: any; 51 | } 52 | 53 | // Filename aliases 54 | declare module 'webpack-hot-middleware/client-overlay.js' { 55 | declare module.exports: $Exports<'webpack-hot-middleware/client-overlay'>; 56 | } 57 | declare module 'webpack-hot-middleware/client.js' { 58 | declare module.exports: $Exports<'webpack-hot-middleware/client'>; 59 | } 60 | declare module 'webpack-hot-middleware/coverage/lcov-report/prettify.js' { 61 | declare module.exports: $Exports<'webpack-hot-middleware/coverage/lcov-report/prettify'>; 62 | } 63 | declare module 'webpack-hot-middleware/coverage/lcov-report/sorter.js' { 64 | declare module.exports: $Exports<'webpack-hot-middleware/coverage/lcov-report/sorter'>; 65 | } 66 | declare module 'webpack-hot-middleware/helpers.js' { 67 | declare module.exports: $Exports<'webpack-hot-middleware/helpers'>; 68 | } 69 | declare module 'webpack-hot-middleware/middleware.js' { 70 | declare module.exports: $Exports<'webpack-hot-middleware/middleware'>; 71 | } 72 | declare module 'webpack-hot-middleware/process-update.js' { 73 | declare module.exports: $Exports<'webpack-hot-middleware/process-update'>; 74 | } 75 | -------------------------------------------------------------------------------- /flow-typed/npm/redux-immutable_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: f02c68fc501538372dbf67986096e988 2 | // flow-typed version: <>/redux-immutable_v^3.0.11/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'redux-immutable' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'redux-immutable' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'redux-immutable/benchmarks/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'redux-immutable/dist/combineReducers' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'redux-immutable/dist/index' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'redux-immutable/dist/utilities/getStateName' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'redux-immutable/dist/utilities/getUnexpectedInvocationParameterMessage' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'redux-immutable/dist/utilities/index' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'redux-immutable/dist/utilities/validateNextState' { 50 | declare module.exports: any; 51 | } 52 | 53 | // Filename aliases 54 | declare module 'redux-immutable/benchmarks/index.js' { 55 | declare module.exports: $Exports<'redux-immutable/benchmarks/index'>; 56 | } 57 | declare module 'redux-immutable/dist/combineReducers.js' { 58 | declare module.exports: $Exports<'redux-immutable/dist/combineReducers'>; 59 | } 60 | declare module 'redux-immutable/dist/index.js' { 61 | declare module.exports: $Exports<'redux-immutable/dist/index'>; 62 | } 63 | declare module 'redux-immutable/dist/utilities/getStateName.js' { 64 | declare module.exports: $Exports<'redux-immutable/dist/utilities/getStateName'>; 65 | } 66 | declare module 'redux-immutable/dist/utilities/getUnexpectedInvocationParameterMessage.js' { 67 | declare module.exports: $Exports<'redux-immutable/dist/utilities/getUnexpectedInvocationParameterMessage'>; 68 | } 69 | declare module 'redux-immutable/dist/utilities/index.js' { 70 | declare module.exports: $Exports<'redux-immutable/dist/utilities/index'>; 71 | } 72 | declare module 'redux-immutable/dist/utilities/validateNextState.js' { 73 | declare module.exports: $Exports<'redux-immutable/dist/utilities/validateNextState'>; 74 | } 75 | -------------------------------------------------------------------------------- /flow-typed/npm/postcss-cssnext_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 8803fa488794e69b099451a7d80a56cf 2 | // flow-typed version: <>/postcss-cssnext_v2.9.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'postcss-cssnext' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'postcss-cssnext' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'postcss-cssnext/lib/features-activation-map' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'postcss-cssnext/lib/features' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'postcss-cssnext/lib/index' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'postcss-cssnext/lib/warn-for-duplicates' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'postcss-cssnext/src/features-activation-map' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'postcss-cssnext/src/features' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'postcss-cssnext/src/index' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'postcss-cssnext/src/warn-for-duplicates' { 54 | declare module.exports: any; 55 | } 56 | 57 | // Filename aliases 58 | declare module 'postcss-cssnext/lib/features-activation-map.js' { 59 | declare module.exports: $Exports<'postcss-cssnext/lib/features-activation-map'>; 60 | } 61 | declare module 'postcss-cssnext/lib/features.js' { 62 | declare module.exports: $Exports<'postcss-cssnext/lib/features'>; 63 | } 64 | declare module 'postcss-cssnext/lib/index.js' { 65 | declare module.exports: $Exports<'postcss-cssnext/lib/index'>; 66 | } 67 | declare module 'postcss-cssnext/lib/warn-for-duplicates.js' { 68 | declare module.exports: $Exports<'postcss-cssnext/lib/warn-for-duplicates'>; 69 | } 70 | declare module 'postcss-cssnext/src/features-activation-map.js' { 71 | declare module.exports: $Exports<'postcss-cssnext/src/features-activation-map'>; 72 | } 73 | declare module 'postcss-cssnext/src/features.js' { 74 | declare module.exports: $Exports<'postcss-cssnext/src/features'>; 75 | } 76 | declare module 'postcss-cssnext/src/index.js' { 77 | declare module.exports: $Exports<'postcss-cssnext/src/index'>; 78 | } 79 | declare module 'postcss-cssnext/src/warn-for-duplicates.js' { 80 | declare module.exports: $Exports<'postcss-cssnext/src/warn-for-duplicates'>; 81 | } 82 | -------------------------------------------------------------------------------- /webpack.server.ssr.config.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | const webpack = require('webpack'); 4 | const path = require('path'); 5 | const ExtractTextPlugin = require('extract-text-webpack-plugin'); 6 | const nodeExternals = require('webpack-node-externals'); 7 | 8 | const nodeModulesDir = path.join(__dirname, 'node_modules'); 9 | const indexFile = path.join(__dirname, 'src/server/SSR/src/server.js'); 10 | const publicPath = path.join(__dirname, 'docs/public'); 11 | const ouputDirectory = path.join(__dirname, 'src/server/SSR'); 12 | const outputFile = 'index.js'; 13 | 14 | 15 | const serverConfig = { 16 | entry: [ 17 | 'babel-polyfill', 18 | indexFile 19 | ], 20 | externals: [nodeExternals()], 21 | output: { 22 | path: ouputDirectory, 23 | filename: outputFile, 24 | publicPath: publicPath, 25 | libraryTarget: 'commonjs2' 26 | }, 27 | target: 'node', 28 | node: { 29 | __filename: true, 30 | __dirname: true 31 | }, 32 | module: { 33 | rules: [ 34 | { 35 | test: /\.jsx?$/, 36 | exclude: [nodeModulesDir], 37 | loader: 'babel-loader' 38 | }, 39 | { 40 | test: /\.css$/, 41 | use: ExtractTextPlugin.extract({ 42 | fallback: 'style-loader', 43 | use: [ 44 | {loader: 'css-loader', options: { importLoaders: 1 }}, 45 | 'postcss-loader' 46 | ] 47 | }) 48 | }, 49 | { 50 | test: /\.scss$/, 51 | use: ExtractTextPlugin.extract({ 52 | fallback: 'style-loader', 53 | use: [ 54 | {loader: 'css-loader', options: { importLoaders: 1 }}, 55 | 'postcss-loader', 56 | 'sass-loader' 57 | ] 58 | }) 59 | }, 60 | { 61 | test: /\.(eot|woff|woff2|ttf|svg|png|jpe?g|gif)(\?\S*)?$/, 62 | use: [ 63 | { 64 | loader: 'url-loader', 65 | options: { 66 | limit: 100000, 67 | name: '[name].[ext]' 68 | } 69 | } 70 | ] 71 | } 72 | ] 73 | }, 74 | plugins: [ 75 | getImplicitGlobals(), 76 | setNodeEnv() 77 | ] 78 | }; 79 | 80 | /* 81 | * here using hoisting so don't use `var NAME = function()...` 82 | */ 83 | function getImplicitGlobals() { 84 | return new webpack.ProvidePlugin({ 85 | $: 'jquery', 86 | jQuery: 'jquery', 87 | jquery: 'jquery' 88 | }); 89 | } 90 | 91 | function setNodeEnv() { 92 | return new webpack.DefinePlugin({ 93 | 'process.env': { 94 | 'NODE_ENV': JSON.stringify('production') 95 | } 96 | }); 97 | } 98 | 99 | module.exports = serverConfig; 100 | -------------------------------------------------------------------------------- /flow-typed/npm/extract-text-webpack-plugin_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: c4d619b65b3efa4519cab1d6e01779d5 2 | // flow-typed version: <>/extract-text-webpack-plugin_v^3.0.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'extract-text-webpack-plugin' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'extract-text-webpack-plugin' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'extract-text-webpack-plugin/dist/cjs' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'extract-text-webpack-plugin/dist/index' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'extract-text-webpack-plugin/dist/lib/ExtractedModule' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'extract-text-webpack-plugin/dist/lib/ExtractTextPluginCompilation' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'extract-text-webpack-plugin/dist/lib/helpers' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'extract-text-webpack-plugin/dist/lib/OrderUndefinedError' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'extract-text-webpack-plugin/dist/loader' { 50 | declare module.exports: any; 51 | } 52 | 53 | // Filename aliases 54 | declare module 'extract-text-webpack-plugin/dist/cjs.js' { 55 | declare module.exports: $Exports<'extract-text-webpack-plugin/dist/cjs'>; 56 | } 57 | declare module 'extract-text-webpack-plugin/dist/index.js' { 58 | declare module.exports: $Exports<'extract-text-webpack-plugin/dist/index'>; 59 | } 60 | declare module 'extract-text-webpack-plugin/dist/lib/ExtractedModule.js' { 61 | declare module.exports: $Exports<'extract-text-webpack-plugin/dist/lib/ExtractedModule'>; 62 | } 63 | declare module 'extract-text-webpack-plugin/dist/lib/ExtractTextPluginCompilation.js' { 64 | declare module.exports: $Exports<'extract-text-webpack-plugin/dist/lib/ExtractTextPluginCompilation'>; 65 | } 66 | declare module 'extract-text-webpack-plugin/dist/lib/helpers.js' { 67 | declare module.exports: $Exports<'extract-text-webpack-plugin/dist/lib/helpers'>; 68 | } 69 | declare module 'extract-text-webpack-plugin/dist/lib/OrderUndefinedError.js' { 70 | declare module.exports: $Exports<'extract-text-webpack-plugin/dist/lib/OrderUndefinedError'>; 71 | } 72 | declare module 'extract-text-webpack-plugin/dist/loader.js' { 73 | declare module.exports: $Exports<'extract-text-webpack-plugin/dist/loader'>; 74 | } 75 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-eslint_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: f3c3dd3c4bea413962ad456458ec0804 2 | // flow-typed version: <>/babel-eslint_v^7.2.3/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-eslint' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-eslint' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-eslint/babylon-to-espree/attachComments' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-eslint/babylon-to-espree/convertComments' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-eslint/babylon-to-espree/convertTemplateType' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-eslint/babylon-to-espree/index' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-eslint/babylon-to-espree/toAST' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-eslint/babylon-to-espree/toToken' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'babel-eslint/babylon-to-espree/toTokens' { 50 | declare module.exports: any; 51 | } 52 | 53 | // Filename aliases 54 | declare module 'babel-eslint/babylon-to-espree/attachComments.js' { 55 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/attachComments'>; 56 | } 57 | declare module 'babel-eslint/babylon-to-espree/convertComments.js' { 58 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/convertComments'>; 59 | } 60 | declare module 'babel-eslint/babylon-to-espree/convertTemplateType.js' { 61 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/convertTemplateType'>; 62 | } 63 | declare module 'babel-eslint/babylon-to-espree/index.js' { 64 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/index'>; 65 | } 66 | declare module 'babel-eslint/babylon-to-espree/toAST.js' { 67 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/toAST'>; 68 | } 69 | declare module 'babel-eslint/babylon-to-espree/toToken.js' { 70 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/toToken'>; 71 | } 72 | declare module 'babel-eslint/babylon-to-espree/toTokens.js' { 73 | declare module.exports: $Exports<'babel-eslint/babylon-to-espree/toTokens'>; 74 | } 75 | declare module 'babel-eslint/index' { 76 | declare module.exports: $Exports<'babel-eslint'>; 77 | } 78 | declare module 'babel-eslint/index.js' { 79 | declare module.exports: $Exports<'babel-eslint'>; 80 | } 81 | -------------------------------------------------------------------------------- /typings/globals/react-router/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/984933df7c89afcb97e42adbe37b6df5dd7b253c/react-router/index.d.ts 3 | declare module 'react-router' { 4 | import * as React from 'react'; 5 | import * as H from 'history'; 6 | 7 | 8 | interface MemoryRouterProps { 9 | initialEntries?: H.Location[]; 10 | initialIndex?: number; 11 | getUserConfirmation?: () => void; 12 | keyLength?: number; 13 | } 14 | class MemoryRouter extends React.Component {} 15 | 16 | 17 | interface PromptProps { 18 | message: string | ((location: H.Location) => void); 19 | when?: boolean; 20 | } 21 | class Prompt extends React.Component {} 22 | 23 | 24 | interface RedirectProps { 25 | to: H.LocationDescriptor; 26 | push?: boolean; 27 | from?: string; 28 | } 29 | class Redirect extends React.Component {} 30 | 31 | 32 | interface RouteComponentProps

    { 33 | match: match

    ; 34 | location: H.Location; 35 | history: H.History; 36 | } 37 | 38 | interface RouteProps { 39 | location?: H.Location; 40 | component?: React.SFC | void> | React.ComponentClass | void>; 41 | render?: (props: RouteComponentProps) => React.ReactNode; 42 | children?: (props: RouteComponentProps) => React.ReactNode | React.ReactNode; 43 | path?: string; 44 | exact?: boolean; 45 | strict?: boolean; 46 | } 47 | class Route extends React.Component {} 48 | 49 | 50 | interface RouterProps { 51 | history: any; 52 | } 53 | class Router extends React.Component {} 54 | 55 | 56 | interface StaticRouterProps extends RouterProps { 57 | basename?: string; 58 | location?: string | object; 59 | context?: object; 60 | } 61 | class StaticRouter extends React.Component {} 62 | 63 | 64 | interface SwitchProps extends RouteProps { 65 | } 66 | class Switch extends React.Component {} 67 | 68 | 69 | interface match

    { 70 | params: P; 71 | isExact: boolean; 72 | path: string; 73 | url: string; 74 | } 75 | 76 | 77 | function matchPath

    (pathname: string, props: RouteProps): match

    | null; 78 | 79 | 80 | function withRouter(component: React.SFC> | React.ComponentClass>): React.ComponentClass; 81 | 82 | 83 | export { 84 | MemoryRouter, 85 | Prompt, 86 | Redirect, 87 | RouteComponentProps, // TypeScript specific, not from React Router itself 88 | RouteProps, // TypeScript specific, not from React Router itself 89 | Route, 90 | Router, 91 | StaticRouter, 92 | Switch, 93 | match, // TypeScript specific, not from React Router itself 94 | matchPath, 95 | withRouter 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /flow-typed/npm/css-loader_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: ff88b5e78e053ebf0238ff40c7e86a38 2 | // flow-typed version: <>/css-loader_v^0.28.4/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'css-loader' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'css-loader' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'css-loader/lib/compile-exports' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'css-loader/lib/createResolver' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'css-loader/lib/css-base' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'css-loader/lib/getImportPrefix' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'css-loader/lib/getLocalIdent' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'css-loader/lib/loader' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'css-loader/lib/localsLoader' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'css-loader/lib/processCss' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'css-loader/locals' { 58 | declare module.exports: any; 59 | } 60 | 61 | // Filename aliases 62 | declare module 'css-loader/index' { 63 | declare module.exports: $Exports<'css-loader'>; 64 | } 65 | declare module 'css-loader/index.js' { 66 | declare module.exports: $Exports<'css-loader'>; 67 | } 68 | declare module 'css-loader/lib/compile-exports.js' { 69 | declare module.exports: $Exports<'css-loader/lib/compile-exports'>; 70 | } 71 | declare module 'css-loader/lib/createResolver.js' { 72 | declare module.exports: $Exports<'css-loader/lib/createResolver'>; 73 | } 74 | declare module 'css-loader/lib/css-base.js' { 75 | declare module.exports: $Exports<'css-loader/lib/css-base'>; 76 | } 77 | declare module 'css-loader/lib/getImportPrefix.js' { 78 | declare module.exports: $Exports<'css-loader/lib/getImportPrefix'>; 79 | } 80 | declare module 'css-loader/lib/getLocalIdent.js' { 81 | declare module.exports: $Exports<'css-loader/lib/getLocalIdent'>; 82 | } 83 | declare module 'css-loader/lib/loader.js' { 84 | declare module.exports: $Exports<'css-loader/lib/loader'>; 85 | } 86 | declare module 'css-loader/lib/localsLoader.js' { 87 | declare module.exports: $Exports<'css-loader/lib/localsLoader'>; 88 | } 89 | declare module 'css-loader/lib/processCss.js' { 90 | declare module.exports: $Exports<'css-loader/lib/processCss'>; 91 | } 92 | declare module 'css-loader/locals.js' { 93 | declare module.exports: $Exports<'css-loader/locals'>; 94 | } 95 | -------------------------------------------------------------------------------- /src/app/components/backToTop/BackToTop.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | /* global $:true */ 3 | 4 | import React, { 5 | Component 6 | } from 'react'; 7 | import PropTypes from 'prop-types'; 8 | import {smoothScroll} from './lib/smoothScroll'; 9 | import BackToTopButton from './backToTopButton/BackToTopButton'; 10 | import { 11 | Motion, 12 | spring, 13 | presets 14 | } from 'react-motion'; 15 | import { isBrowserSide } from '../../services/universal'; 16 | 17 | class BackToTop extends Component { 18 | static propTypes = { 19 | minScrollY: PropTypes.number, 20 | scrollTo: PropTypes.string.isRequired, 21 | onScrollDone: PropTypes.func 22 | }; 23 | 24 | static defaultProps = { 25 | minScrollY: 120 26 | }; 27 | 28 | state = { 29 | windowScrollY: 0, 30 | showBackButton: false 31 | }; 32 | 33 | componentWillMount() { 34 | if (isBrowserSide()) { 35 | window.addEventListener('scroll', this.handleWindowScroll); 36 | } 37 | } 38 | 39 | componentWillUnmount() { 40 | if (isBrowserSide()) { 41 | window.removeEventListener('scroll', this.handleWindowScroll); 42 | } 43 | } 44 | 45 | render() { 46 | const { showBackButton } = this.state; 47 | return ( 48 | 49 | { 50 | ({x}) => ( 51 | 59 | ) 60 | } 61 | 62 | ); 63 | } 64 | 65 | handleWindowScroll = () => { 66 | if (!isBrowserSide()) { 67 | return; 68 | } 69 | if ($) { 70 | const { windowScrollY } = this.state; 71 | const { minScrollY } = this.props; 72 | const currentWindowScrollY = $(window).scrollTop(); 73 | 74 | if (windowScrollY !== currentWindowScrollY) { 75 | const shouldShowBackButton = currentWindowScrollY >= minScrollY ? true : false; 76 | 77 | this.setState({ 78 | windowScrollY: currentWindowScrollY, 79 | showBackButton: shouldShowBackButton 80 | }); 81 | } 82 | } else { 83 | /* eslint-disable no-throw-literal*/ 84 | throw 'BackToTop component requires jQuery'; 85 | /* eslint-enable no-throw-literal*/ 86 | } 87 | } 88 | 89 | scrollDone = () => { 90 | const { onScrollDone } = this.props; 91 | if (onScrollDone) { 92 | onScrollDone(); 93 | } 94 | } 95 | 96 | handlesOnBackButtonClick = (event) => { 97 | event.preventDefault(); 98 | const { scrollTo, minScrollY } = this.props; 99 | const { windowScrollY } = this.state; 100 | 101 | if (windowScrollY && windowScrollY > minScrollY) { 102 | smoothScroll.scrollTo(scrollTo, this.scrollDone); 103 | } 104 | } 105 | } 106 | 107 | export default BackToTop; 108 | -------------------------------------------------------------------------------- /test/redux/reducers/views.spec.js: -------------------------------------------------------------------------------- 1 | import {expect} from 'chai'; 2 | import views from '../../../src/app/redux/modules/views'; 3 | import moment from 'moment'; 4 | import { fromJS } from 'immutable'; 5 | 6 | const dateFormat = 'DD/MM/YYYY HH:mm'; 7 | 8 | describe('redux - reducer "views"', () => { 9 | it('should return an initial state', () => { 10 | const initialState = { 11 | currentView: 'not set', 12 | enterTime: null, 13 | leaveTime: null 14 | }; 15 | /* eslint-disable no-undefined */ 16 | expect(views(undefined, {}).toJS()).to.deep.equal(initialState); 17 | /* eslint-enable no-undefined */ 18 | }); 19 | 20 | it('should set state according to ENTER_HOME_VIEW action', () => { 21 | const now = moment().format(dateFormat); 22 | const action = { 23 | type: 'ENTER_HOME_VIEW', 24 | currentView: 'home', 25 | enterTime: now, 26 | leaveTime: null 27 | }; 28 | const expectedState = { 29 | currentView: 'home', 30 | enterTime: now, 31 | leaveTime: null 32 | }; 33 | /* eslint-disable no-undefined */ 34 | expect(views(undefined, action).toJS()).to.deep.equal(expectedState); 35 | /* eslint-enable no-undefined */ 36 | }); 37 | 38 | it('should set state according to LEAVE_HOME_VIEW action', () => { 39 | const now = moment().format(dateFormat); 40 | const actionLeaveHome = { 41 | type: 'LEAVE_HOME_VIEW', 42 | currentView: 'home', 43 | enterTime: null, 44 | leaveTime: now 45 | }; 46 | const expectedState = { 47 | currentView: 'home', 48 | enterTime: null, 49 | leaveTime: now 50 | }; 51 | /* eslint-disable no-undefined */ 52 | expect(views(fromJS({currentView: 'home'}), actionLeaveHome).toJS()).to.deep.equal(expectedState); 53 | /* eslint-enable no-undefined */ 54 | }); 55 | 56 | 57 | it('should set state according to ENTER_ABOUT_VIEW action', () => { 58 | const now = moment().format(dateFormat); 59 | const action = { 60 | type: 'ENTER_ABOUT_VIEW', 61 | currentView: 'about', 62 | enterTime: now, 63 | leaveTime: null 64 | }; 65 | const expectedState = { 66 | currentView: 'about', 67 | enterTime: now, 68 | leaveTime: null 69 | }; 70 | /* eslint-disable no-undefined */ 71 | expect(views(undefined, action).toJS()).to.deep.equal(expectedState); 72 | /* eslint-enable no-undefined */ 73 | }); 74 | 75 | it('should set state according to LEAVE_ABOUT_VIEW action', () => { 76 | const now = moment().format(dateFormat); 77 | const actionLeaveAbout = { 78 | type: 'LEAVE_ABOUT_VIEW', 79 | currentView: 'about', 80 | enterTime: null, 81 | leaveTime: now 82 | }; 83 | const expectedState = { 84 | currentView: 'about', 85 | enterTime: null, 86 | leaveTime: now 87 | }; 88 | /* eslint-disable no-undefined */ 89 | expect(views(fromJS({currentView: 'about'}), actionLeaveAbout).toJS()).to.deep.equal(expectedState); 90 | /* eslint-enable no-undefined */ 91 | }); 92 | }); 93 | -------------------------------------------------------------------------------- /flow-typed/npm/react-redux_v4.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 88bd9be7fa0a534f29b71312d891027d 2 | // flow-typed version: 31bd2e9f94/react-redux_v4.x.x/flow_>=v0.30.x 3 | 4 | import type { Dispatch, Store } from 'redux' 5 | 6 | declare module 'react-redux' { 7 | 8 | /* 9 | 10 | S = State 11 | A = Action 12 | OP = OwnProps 13 | SP = StateProps 14 | DP = DispatchProps 15 | 16 | */ 17 | 18 | declare type MapStateToProps = (state: S, ownProps: OP) => SP; 19 | 20 | declare type MapDispatchToProps = ((dispatch: Dispatch, ownProps: OP) => DP) | DP; 21 | 22 | declare type MergeProps = (stateProps: SP, dispatchProps: DP, ownProps: OP) => P; 23 | 24 | declare type StatelessComponent

    = (props: P) => ?React$Element; 25 | 26 | declare class ConnectedComponent extends React$Component { 27 | static WrappedComponent: Class>; 28 | getWrappedInstance(): React$Component; 29 | static defaultProps: void; 30 | props: OP; 31 | state: void; 32 | } 33 | 34 | declare type ConnectedComponentClass = Class>; 35 | 36 | declare type Connector = { 37 | (component: StatelessComponent

    ): ConnectedComponentClass; 38 | (component: Class>): ConnectedComponentClass; 39 | }; 40 | 41 | declare class Provider extends React$Component, children?: any }, void> { } 42 | 43 | declare type ConnectOptions = { 44 | pure?: boolean, 45 | withRef?: boolean 46 | }; 47 | 48 | declare type Null = null | void; 49 | 50 | declare function connect( 51 | ...rest: Array // <= workaround for https://github.com/facebook/flow/issues/2360 52 | ): Connector } & OP>>; 53 | 54 | declare function connect( 55 | mapStateToProps: Null, 56 | mapDispatchToProps: Null, 57 | mergeProps: Null, 58 | options: ConnectOptions 59 | ): Connector } & OP>>; 60 | 61 | declare function connect( 62 | mapStateToProps: MapStateToProps, 63 | mapDispatchToProps: Null, 64 | mergeProps: Null, 65 | options?: ConnectOptions 66 | ): Connector } & OP>>; 67 | 68 | declare function connect( 69 | mapStateToProps: Null, 70 | mapDispatchToProps: MapDispatchToProps, 71 | mergeProps: Null, 72 | options?: ConnectOptions 73 | ): Connector>; 74 | 75 | declare function connect( 76 | mapStateToProps: MapStateToProps, 77 | mapDispatchToProps: MapDispatchToProps, 78 | mergeProps: Null, 79 | options?: ConnectOptions 80 | ): Connector>; 81 | 82 | declare function connect( 83 | mapStateToProps: MapStateToProps, 84 | mapDispatchToProps: MapDispatchToProps, 85 | mergeProps: MergeProps, 86 | options?: ConnectOptions 87 | ): Connector; 88 | 89 | } 90 | -------------------------------------------------------------------------------- /flow-typed/npm/nyc_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 82c9980e79942730ea88e5609fea9f7f 2 | // flow-typed version: <>/nyc_v^10.0.0/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'nyc' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'nyc' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'nyc/bin/nyc' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'nyc/bin/wrap' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'nyc/lib/commands/instrument' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'nyc/lib/config-util' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'nyc/lib/hash' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'nyc/lib/instrumenters/istanbul' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'nyc/lib/instrumenters/noop' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'nyc/lib/process-args' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'nyc/lib/process' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'nyc/lib/self-coverage-helper' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'nyc/lib/source-maps' { 66 | declare module.exports: any; 67 | } 68 | 69 | // Filename aliases 70 | declare module 'nyc/bin/nyc.js' { 71 | declare module.exports: $Exports<'nyc/bin/nyc'>; 72 | } 73 | declare module 'nyc/bin/wrap.js' { 74 | declare module.exports: $Exports<'nyc/bin/wrap'>; 75 | } 76 | declare module 'nyc/index' { 77 | declare module.exports: $Exports<'nyc'>; 78 | } 79 | declare module 'nyc/index.js' { 80 | declare module.exports: $Exports<'nyc'>; 81 | } 82 | declare module 'nyc/lib/commands/instrument.js' { 83 | declare module.exports: $Exports<'nyc/lib/commands/instrument'>; 84 | } 85 | declare module 'nyc/lib/config-util.js' { 86 | declare module.exports: $Exports<'nyc/lib/config-util'>; 87 | } 88 | declare module 'nyc/lib/hash.js' { 89 | declare module.exports: $Exports<'nyc/lib/hash'>; 90 | } 91 | declare module 'nyc/lib/instrumenters/istanbul.js' { 92 | declare module.exports: $Exports<'nyc/lib/instrumenters/istanbul'>; 93 | } 94 | declare module 'nyc/lib/instrumenters/noop.js' { 95 | declare module.exports: $Exports<'nyc/lib/instrumenters/noop'>; 96 | } 97 | declare module 'nyc/lib/process-args.js' { 98 | declare module.exports: $Exports<'nyc/lib/process-args'>; 99 | } 100 | declare module 'nyc/lib/process.js' { 101 | declare module.exports: $Exports<'nyc/lib/process'>; 102 | } 103 | declare module 'nyc/lib/self-coverage-helper.js' { 104 | declare module.exports: $Exports<'nyc/lib/self-coverage-helper'>; 105 | } 106 | declare module 'nyc/lib/source-maps.js' { 107 | declare module.exports: $Exports<'nyc/lib/source-maps'>; 108 | } 109 | -------------------------------------------------------------------------------- /src/app/redux/middleware/fetchMiddleware.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import axios from 'axios'; 4 | 5 | export const FETCH_MOCK = 'FETCH_MOCK'; 6 | export const FETCH = 'FETCH'; 7 | // 8 | // FETCH_MOCK mode 9 | // in any action just add fetch object like: 10 | // { 11 | // fetch: { 12 | // type: 'FETCH_MOCK', 13 | // actionTypes: { 14 | // request: 'TYPE_FOR_REQUEST', 15 | // success: 'TYPE_FOR_RECEIVED', 16 | // fail: 'TYPE_FOR_ERROR', 17 | // }, 18 | // mockResult: any 19 | // } 20 | // } 21 | // 22 | 23 | // FETCH mode 24 | // in any action just add fetch object like: 25 | // { 26 | // fetch: { 27 | // type: 'FETCH', 28 | // actionTypes: { 29 | // request: 'TYPE_FOR_REQUEST', 30 | // success: 'TYPE_FOR_RECEIVED', 31 | // fail: 'TYPE_FOR_ERROR', 32 | // }, 33 | // url: 'an url', 34 | // method: 'get', // lower case, one of 'get', 'post'... 35 | // headers: {} // OPTIONAL CONTENT like: data: { someprop: 'value ...} 36 | // options: {} // OPTIONAL CONTENT like: Authorization: 'Bearer _A_TOKEN_' 37 | // } 38 | // } 39 | // 40 | // 41 | // 42 | // 43 | const fetchMiddleware = store => next => action => { 44 | if (!action.fetch) { 45 | return next(action); 46 | } 47 | 48 | if (!action.fetch.type || 49 | !action.fetch.type === FETCH_MOCK || 50 | !action.fetch.type === FETCH) { 51 | return next(action); 52 | } 53 | 54 | if (!action.fetch.actionTypes) { 55 | return next(action); 56 | } 57 | 58 | /** 59 | * fetch mock 60 | * @type {[type]} 61 | */ 62 | if (action.fetch.type === FETCH_MOCK) { 63 | if (!action.fetch.mockResult) { 64 | throw new Error('Fetch middleware require a mockResult payload when type is "FETCH_MOCK"'); 65 | } 66 | 67 | const { 68 | actionTypes: {request, success}, 69 | mockResult 70 | } = action.fetch; 71 | 72 | // request 73 | store.dispatch({ type: request }); 74 | 75 | // received successful for mock 76 | return Promise.resolve( 77 | store.dispatch({ 78 | type: success, 79 | payload: { 80 | status: 200, 81 | data: mockResult 82 | } 83 | }) 84 | ); 85 | } 86 | 87 | if (action.fetch.type === FETCH) { 88 | const { 89 | actionTypes: {request, success, fail}, 90 | url, 91 | method, 92 | headers, 93 | options 94 | } = action.fetch; 95 | 96 | // request 97 | store.dispatch({ type: request }); 98 | 99 | // fetch server (success or fail) 100 | // returns a Promise 101 | return axios.request({ 102 | method, 103 | url, 104 | withCredentials: true, 105 | headers: { 106 | 'Accept': 'application/json', 107 | 'Content-Type': 'application/json', 108 | 'Acces-Control-Allow-Origin': '*', 109 | ...headers 110 | }, 111 | ...options 112 | }) 113 | .then(data => store.dispatch({type: success, payload: data})) 114 | .catch( 115 | err => { 116 | store.dispatch({type: fail, error: err.response}); 117 | return Promise.reject(err.response); 118 | } 119 | ); 120 | } 121 | return next(action); 122 | }; 123 | 124 | export default fetchMiddleware; 125 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-cli_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 8615cf6c39596ff7ba27c4a0377fe299 2 | // flow-typed version: <>/babel-cli_v^6.24.1/flow_v0.46.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-cli' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-cli' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-cli/bin/babel-doctor' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-cli/bin/babel-external-helpers' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-cli/bin/babel-node' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-cli/bin/babel' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-cli/lib/_babel-node' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-cli/lib/babel-external-helpers' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'babel-cli/lib/babel-node' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'babel-cli/lib/babel/dir' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'babel-cli/lib/babel/file' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'babel-cli/lib/babel/index' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'babel-cli/lib/babel/util' { 66 | declare module.exports: any; 67 | } 68 | 69 | // Filename aliases 70 | declare module 'babel-cli/bin/babel-doctor.js' { 71 | declare module.exports: $Exports<'babel-cli/bin/babel-doctor'>; 72 | } 73 | declare module 'babel-cli/bin/babel-external-helpers.js' { 74 | declare module.exports: $Exports<'babel-cli/bin/babel-external-helpers'>; 75 | } 76 | declare module 'babel-cli/bin/babel-node.js' { 77 | declare module.exports: $Exports<'babel-cli/bin/babel-node'>; 78 | } 79 | declare module 'babel-cli/bin/babel.js' { 80 | declare module.exports: $Exports<'babel-cli/bin/babel'>; 81 | } 82 | declare module 'babel-cli/index' { 83 | declare module.exports: $Exports<'babel-cli'>; 84 | } 85 | declare module 'babel-cli/index.js' { 86 | declare module.exports: $Exports<'babel-cli'>; 87 | } 88 | declare module 'babel-cli/lib/_babel-node.js' { 89 | declare module.exports: $Exports<'babel-cli/lib/_babel-node'>; 90 | } 91 | declare module 'babel-cli/lib/babel-external-helpers.js' { 92 | declare module.exports: $Exports<'babel-cli/lib/babel-external-helpers'>; 93 | } 94 | declare module 'babel-cli/lib/babel-node.js' { 95 | declare module.exports: $Exports<'babel-cli/lib/babel-node'>; 96 | } 97 | declare module 'babel-cli/lib/babel/dir.js' { 98 | declare module.exports: $Exports<'babel-cli/lib/babel/dir'>; 99 | } 100 | declare module 'babel-cli/lib/babel/file.js' { 101 | declare module.exports: $Exports<'babel-cli/lib/babel/file'>; 102 | } 103 | declare module 'babel-cli/lib/babel/index.js' { 104 | declare module.exports: $Exports<'babel-cli/lib/babel/index'>; 105 | } 106 | declare module 'babel-cli/lib/babel/util.js' { 107 | declare module.exports: $Exports<'babel-cli/lib/babel/util'>; 108 | } 109 | -------------------------------------------------------------------------------- /src/app/redux/modules/fakeModuleWithFetch.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | import moment from 'moment'; 4 | import fakeData from '../../mock/fakeAPI.json'; 5 | import { appConfig } from '../../config'; 6 | import { getLocationOrigin } from '../../services/API/fetchTools'; 7 | import { 8 | fromJS, 9 | List, 10 | Map 11 | } from 'immutable'; 12 | 13 | // -------------------------------- 14 | // CONSTANTS 15 | // -------------------------------- 16 | const REQUEST_FAKE_FETCH = 'REQUEST_FAKE_FETCH'; 17 | const RECEIVED_FAKE_FETCH = 'RECEIVED_FAKE_FETCH'; 18 | const ERROR_FAKE_FETCH = 'ERROR_FAKE_FETCH'; 19 | 20 | // -------------------------------- 21 | // REDUCER 22 | // -------------------------------- 23 | const initialState = fromJS({ 24 | isFetching: false, 25 | actionTime: '', 26 | data: new List(), 27 | error: new Map() 28 | }); 29 | 30 | export default function (state = initialState, action) { 31 | const currentTime = moment().format(); 32 | 33 | switch (action.type) { 34 | case REQUEST_FAKE_FETCH: 35 | return state.merge({ 36 | actionTime: currentTime, 37 | isFetching: true 38 | }); 39 | 40 | case RECEIVED_FAKE_FETCH: 41 | return state 42 | .merge({ 43 | actionTime: currentTime, 44 | isFetching: false 45 | }) 46 | .set('data', fromJS(action.payload)); 47 | 48 | case ERROR_FAKE_FETCH: 49 | const error = action.error ? fromJS(action.error) : new Map(); 50 | 51 | return state 52 | .merge({ 53 | actionTime: currentTime, 54 | isFetching: false 55 | }) 56 | .set('error', error); 57 | 58 | default: 59 | return state; 60 | } 61 | } 62 | 63 | // -------------------------------- 64 | // ACTIONS CREATORS 65 | // -------------------------------- 66 | function fakeFetch() { 67 | return dispatch => { 68 | const shouldFetchMock = appConfig.DEV_MODE; 69 | const fetchType = shouldFetchMock ? 'FETCH_MOCK': 'FETCH'; 70 | const mockResult = fakeData; 71 | 72 | const url = `${getLocationOrigin()}/${appConfig.api.fakeEndPoint}`; 73 | const method = 'get'; 74 | const header = {}; 75 | const options = {}; 76 | 77 | // fetch middleware 78 | // -> you handle pure front (with mock data) or with back-end asyncs just by dispatching a single object 79 | // -> just change config: appConfig.DEV_MODE 80 | return Promise.resolve( 81 | dispatch({ 82 | // type name is not important here since fetchMiddleware will intercept this action: 83 | type: 'FETCH_MIDDLEWARE', 84 | // here are fetch middleware props: 85 | fetch: { 86 | type: fetchType, 87 | actionTypes: { 88 | request: REQUEST_FAKE_FETCH, 89 | success: RECEIVED_FAKE_FETCH, 90 | fail: ERROR_FAKE_FETCH 91 | }, 92 | // props only used when type = FETCH_MOCK: 93 | mockResult, 94 | // props only used when type = FETCH: 95 | url, 96 | method, 97 | header, 98 | options 99 | } 100 | }) 101 | ); 102 | }; 103 | } 104 | 105 | export function fakeFetchIfNeeded() { 106 | return (dispatch, getState) => { 107 | if (shouldFakeFetch(getState())) { 108 | return dispatch(fakeFetch()); 109 | } 110 | return Promise.resolve(); 111 | }; 112 | } 113 | function shouldFakeFetch(state) { 114 | const isFetching = state.getIn(['fakeModuleWithFetch', 'isFetching']); 115 | 116 | if (isFetching) { 117 | return false; 118 | } 119 | return true; 120 | } 121 | -------------------------------------------------------------------------------- /test/components/NavigationBar/NavigationBar.spec.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { 3 | shallow, 4 | mount 5 | } from 'enzyme'; 6 | import chai, {expect} from 'chai'; 7 | import dirtyChai from 'dirty-chai'; 8 | // import { NavigationBar } from '../../../src/app/components'; 9 | import NavigationBar from '../../../src/app/components/navigation/NavigationBar'; 10 | import { fromJS } from 'immutable'; 11 | 12 | chai.use(dirtyChai); 13 | 14 | const navModelImmutable = fromJS({ 15 | brand: 'React Redux Bootstrap Starter', 16 | leftLinks: [ 17 | { 18 | label: 'a left Link', 19 | link: '', 20 | view: 'fake', 21 | isRouteBtn: false 22 | } 23 | ], 24 | rightLinks: [ 25 | { 26 | label: 'Home', 27 | link: '/', 28 | view: 'home', 29 | isRouteBtn: true 30 | }, 31 | { 32 | label: 'About', 33 | link: '/about', 34 | view: 'about', 35 | isRouteBtn: true 36 | } 37 | ] 38 | }); 39 | 40 | // avoid to eslint-disable for chai no-unsued-expressions 41 | chai.use(dirtyChai); 42 | 43 | describe('', () => { 44 | const testBrandName = 'test'; 45 | 46 | const props = { 47 | brand: testBrandName, 48 | handleLeftNavItemClick: () => {}, 49 | handleRightNavItemClick: () => {}, 50 | navModel: navModelImmutable 51 | }; 52 | 53 | it('should render a NavigationBar', () => { 54 | const wrapper = shallow(); 55 | expect(wrapper).to.exist(); 56 | }); 57 | 58 | it('should display a brand name', () => { 59 | const wrapper = mount(); 60 | expect(wrapper.prop('brand')).to.equal(testBrandName); 61 | }); 62 | 63 | describe('child ', () => { 64 | it('should be passed props leftLinks:of type Array', () => { 65 | const wrapper = mount(); 66 | const LeftNav = wrapper.find('LeftNav'); 67 | expect(Array.isArray(LeftNav.prop('leftLinks').toJS())).to.equal(true); 68 | }); 69 | 70 | it('should be passed props leftLinks:array of object with length 1', () => { 71 | const wrapper = shallow(); 72 | const LeftNav = wrapper.find('LeftNav'); 73 | expect((LeftNav.prop('leftLinks').toJS()).length).to.equal(1); 74 | }); 75 | 76 | it('should be passed props onLeftNavButtonClick:func', () => { 77 | const wrapper = shallow(); 78 | const LeftNav = wrapper.find('LeftNav'); 79 | expect(typeof LeftNav.prop('onLeftNavButtonClick')).to.equal('function'); 80 | }); 81 | }); 82 | 83 | describe('child ', () => { 84 | it('should be passed props rightLinks:array of object with length 2', () => { 85 | const wrapper = shallow(); 86 | const RightNav = wrapper.find('RightNav'); 87 | expect(RightNav.prop('rightLinks').toJS().length).to.equal(2); 88 | }); 89 | 90 | it('should be passed props onRightNavButtonClick:func', () => { 91 | const wrapper = shallow(); 92 | const RightNav = wrapper.find('RightNav'); 93 | expect(typeof RightNav.prop('onRightNavButtonClick')).to.equal('function'); 94 | }); 95 | }); 96 | 97 | describe('child ', () => { 98 | it('should exist', () => { 99 | const wrapper = shallow(); 100 | const Humburger = wrapper.find('Humburger'); 101 | expect(Humburger).to.exist(); 102 | }); 103 | }); 104 | }); 105 | -------------------------------------------------------------------------------- /webpack.dev.config.js: -------------------------------------------------------------------------------- 1 | // @flow weak 2 | 3 | const webpack = require('webpack'); 4 | const path = require('path'); 5 | const ExtractTextPlugin = require('extract-text-webpack-plugin'); 6 | 7 | const assetsDir = path.join(__dirname, 'docs/public/assets'); 8 | const nodeModulesDir = path.join(__dirname, 'node_modules'); 9 | const vendorsDir = path.join(__dirname, 'src/app/vendors'); 10 | const indexFile = path.join(__dirname, 'src/app/index.js'); 11 | 12 | const SPLIT_STYLE = true; 13 | 14 | const config = { 15 | devtool: '#source-map', 16 | entry: { 17 | app: indexFile, 18 | vendor: [ 19 | 'react', 20 | 'react-dom', 21 | 'react-tap-event-plugin', 22 | 'react-hot-loader', 23 | 'babel-polyfill', 24 | 'redux', 25 | 'redux-immutable', 26 | 'redux-thunk', 27 | 'react-router', 28 | 'react-router-dom', 29 | 'react-router-redux', 30 | 'history', 31 | 'immutable', 32 | 'jquery', 33 | 'bootstrap/dist/js/bootstrap.min.js', 34 | 'classnames', 35 | 'axios', 36 | 'js-base64', 37 | 'moment', 38 | 'react-bootstrap', 39 | 'react-motion', 40 | 'react-notification' 41 | ] 42 | }, 43 | output: { 44 | path: assetsDir, 45 | filename: 'app.bundle.js' 46 | }, 47 | module: { 48 | rules: [ 49 | { 50 | test: /\.jsx?$/, 51 | exclude: [nodeModulesDir, vendorsDir], 52 | loader: 'babel-loader' 53 | }, 54 | { 55 | test: /\.css$/, 56 | use: SPLIT_STYLE 57 | ? ExtractTextPlugin.extract({ 58 | fallback: 'style-loader', 59 | use: [ 60 | {loader: 'css-loader', options: { importLoaders: 1 }}, 61 | 'postcss-loader' 62 | ] 63 | }) 64 | : [ 65 | 'style-loader', 66 | {loader: 'css-loader', options: { importLoaders: 1 }}, 67 | 'postcss-loader' 68 | ] 69 | }, 70 | { 71 | test: /\.scss$/, 72 | use: SPLIT_STYLE 73 | ? ExtractTextPlugin.extract({ 74 | fallback: 'style-loader', 75 | use: [ 76 | {loader: 'css-loader', options: { importLoaders: 1 }}, 77 | 'postcss-loader', 78 | 'sass-loader' 79 | ] 80 | }) 81 | : [ 82 | 'style-loader', 83 | {loader: 'css-loader', options: { importLoaders: 1 }}, 84 | 'postcss-loader', 85 | 'sass-loader' 86 | ] 87 | }, 88 | { 89 | test: /\.(eot|woff|woff2|ttf|svg|png|jpe?g|gif)(\?\S*)?$/, 90 | use: [ 91 | { 92 | loader: 'url-loader', 93 | options: { 94 | limit: 100000, 95 | name: '[name].[ext]' 96 | } 97 | } 98 | ] 99 | } 100 | ] 101 | }, 102 | plugins: [ 103 | getImplicitGlobals(), 104 | setNodeEnv(), 105 | new ExtractTextPlugin('app.styles.css'), 106 | new webpack.optimize.CommonsChunkPlugin({ 107 | name: 'vendor', 108 | filename: 'app.vendor.bundle.js' 109 | }) 110 | ] 111 | }; 112 | 113 | /* 114 | * here using hoisting so don't use `var NAME = function()...` 115 | */ 116 | function getImplicitGlobals() { 117 | return new webpack.ProvidePlugin({ 118 | $: 'jquery', 119 | jQuery: 'jquery', 120 | jquery: 'jquery' 121 | }); 122 | } 123 | 124 | function setNodeEnv() { 125 | return new webpack.DefinePlugin({ 126 | 'process.env': { 127 | 'NODE_ENV': JSON.stringify('dev') 128 | } 129 | }); 130 | } 131 | 132 | module.exports = config; 133 | --------------------------------------------------------------------------------