Skip to content
This repository has been archived by the owner on Sep 11, 2019. It is now read-only.

Commit

Permalink
initial setup of loadable filters
Browse files Browse the repository at this point in the history
  • Loading branch information
James Seppi committed Apr 10, 2018
1 parent fd5c8ec commit d38720b
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 21 deletions.
5 changes: 4 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"presets": ["env", "react"]
"presets": ["env", "react"],
"plugins": [
"syntax-dynamic-import"
]
}
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"extends": "airbnb",
"parser": "babel-eslint",
"rules": {
"no-underscore-dangle": ["error", { "allowAfterThis": true }],
"no-plusplus": [0],
Expand Down
12 changes: 9 additions & 3 deletions frontend/gulp/webpack-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const path = require('path');
const webpackStream = require('webpack-stream');
const webpack = require('webpack');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const { ReactLoadablePlugin } = require('react-loadable/webpack');


const USE_POLLING = 'USE_POLLING' in process.env;

Expand Down Expand Up @@ -38,11 +40,11 @@ exports.webpackify = ({ isWatching, isProd }) => webpackStream({
},
devtool: isProd ? 'source-map' : 'eval-source-map',
plugins: [
new ReactLoadablePlugin({
filename: '././frontend/static/frontend/built/js/react-loadable.json',
}),
new BundleAnalyzerPlugin({
analyzerMode: 'disabled',
analyzerHost: '0.0.0.0',
openAnalyzer: false,
defaultSizes: 'parsed',
generateStatsFile: true,
statsFilename: './frontend/static/frontend/built/js/stats.json',
}),
Expand All @@ -60,4 +62,8 @@ exports.webpackify = ({ isWatching, isProd }) => webpackStream({
},
],
},
output: {
chunkFilename: '[name].bundle.js',
publicPath: '/static/frontend/built/js/',
},
}, webpack);
16 changes: 2 additions & 14 deletions frontend/source/js/data-explorer/components/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,10 @@ import Description from './description';
import Highlights from './highlights';
import Histogram from './histogram';
import ProposedPrice from './proposed-price';
import EducationLevel from './education-level';
import Experience from './experience';
import ExportData from './export-data';
import ResultsTable from './results-table';
import Schedule from './schedule';
import ContractYear from './contract-year';
import QueryType from './query-type';
import Site from './site';
import BusinessSize from './business-size';
import LoadableOptionalFilters from './loadable-optional-filters';
import LaborCategory from './labor-category';
import LoadingIndicator from './loading-indicator';
import TitleTagSynchronizer from './title-tag-synchronizer';
Expand Down Expand Up @@ -186,22 +181,15 @@ class App extends React.Component {
<div className="filter-container columns three">
<div className="filter-block">
<h5 className="filter-title">Optional filters</h5>
<EducationLevel />
<Experience />
<Site />
<BusinessSize />
<Schedule />
<ContractYear />
<LoadableOptionalFilters />
</div>
</div>

</div>
<div className="row">

<div className="table-container">
<ResultsTable />
</div>

</div>
</div>
</section>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

import React from 'react';
import Loadable from 'react-loadable';

const LoadableOptionalFilters = Loadable({
loader: () => import('./optional-filters'),
// eslint-disable-next-line react/prop-types
loading({ error, pastDelay }) {
if (error) {
return <div>Error!</div>;
} else if (pastDelay) {
return <div>Loading...</div>;
}
return null;
},
});

export default LoadableOptionalFilters;
23 changes: 23 additions & 0 deletions frontend/source/js/data-explorer/components/optional-filters.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

import React, { Fragment } from 'react';

import BusinessSize from './business-size';
import ContractYear from './contract-year';
import EducationLevel from './education-level';
import Experience from './experience';
import Schedule from './schedule';
import Site from './site';

const OptionalFilters = () => (
<Fragment>
<EducationLevel />
<Experience />
<Site />
<BusinessSize />
<Schedule />
<ContractYear />
</Fragment>
);

export default OptionalFilters;

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
"a11y-dialog": "2.5.2",
"axe-core": "^2.1.7",
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.2",
"babel-jest": "^18.0.0",
"babel-loader": "^7.1.4",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
Expand Down Expand Up @@ -48,6 +50,7 @@
"rc-slider": "^8.6.1",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-loadable": "^5.3.1",
"react-redux": "^5.0.0",
"react-transition-group": "1.x",
"redux": "^3.6.0",
Expand All @@ -67,7 +70,8 @@
"failable-eslint": "eslint --max-warnings 0 --ext .jsx --ext .js .",
"typescript": "tsc",
"test": "jest",
"test:watch": "jest --watch"
"test:watch": "jest --watch",
"analyze-webpack": "webpack-bundle-analyzer -h 0.0.0.0 ./frontend/static/frontend/built/js/stats.json"
},
"repository": {
"type": "git",
Expand Down
121 changes: 119 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,48 @@
# yarn lockfile v1


"@babel/code-frame@7.0.0-beta.44", "@babel/code-frame@^7.0.0-beta.40":
version "7.0.0-beta.44"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz#2a02643368de80916162be70865c97774f3adbd9"
dependencies:
"@babel/highlight" "7.0.0-beta.44"

"@babel/code-frame@^7.0.0-beta.35":
version "7.0.0-beta.42"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.42.tgz#a9c83233fa7cd06b39dc77adbb908616ff4f1962"
dependencies:
"@babel/highlight" "7.0.0-beta.42"

"@babel/generator@7.0.0-beta.44":
version "7.0.0-beta.44"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.44.tgz#c7e67b9b5284afcf69b309b50d7d37f3e5033d42"
dependencies:
"@babel/types" "7.0.0-beta.44"
jsesc "^2.5.1"
lodash "^4.2.0"
source-map "^0.5.0"
trim-right "^1.0.1"

"@babel/helper-function-name@7.0.0-beta.44":
version "7.0.0-beta.44"
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.44.tgz#e18552aaae2231100a6e485e03854bc3532d44dd"
dependencies:
"@babel/helper-get-function-arity" "7.0.0-beta.44"
"@babel/template" "7.0.0-beta.44"
"@babel/types" "7.0.0-beta.44"

"@babel/helper-get-function-arity@7.0.0-beta.44":
version "7.0.0-beta.44"
resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.44.tgz#d03ca6dd2b9f7b0b1e6b32c56c72836140db3a15"
dependencies:
"@babel/types" "7.0.0-beta.44"

"@babel/helper-split-export-declaration@7.0.0-beta.44":
version "7.0.0-beta.44"
resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.44.tgz#c0b351735e0fbcb3822c8ad8db4e583b05ebd9dc"
dependencies:
"@babel/types" "7.0.0-beta.44"

"@babel/highlight@7.0.0-beta.42":
version "7.0.0-beta.42"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.42.tgz#a502a1c0d6f99b2b0e81d468a1b0c0e81e3f3623"
Expand All @@ -16,6 +52,46 @@
esutils "^2.0.2"
js-tokens "^3.0.0"

"@babel/highlight@7.0.0-beta.44":
version "7.0.0-beta.44"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.44.tgz#18c94ce543916a80553edcdcf681890b200747d5"
dependencies:
chalk "^2.0.0"
esutils "^2.0.2"
js-tokens "^3.0.0"

"@babel/template@7.0.0-beta.44":
version "7.0.0-beta.44"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.44.tgz#f8832f4fdcee5d59bf515e595fc5106c529b394f"
dependencies:
"@babel/code-frame" "7.0.0-beta.44"
"@babel/types" "7.0.0-beta.44"
babylon "7.0.0-beta.44"
lodash "^4.2.0"

"@babel/traverse@^7.0.0-beta.40":
version "7.0.0-beta.44"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.44.tgz#a970a2c45477ad18017e2e465a0606feee0d2966"
dependencies:
"@babel/code-frame" "7.0.0-beta.44"
"@babel/generator" "7.0.0-beta.44"
"@babel/helper-function-name" "7.0.0-beta.44"
"@babel/helper-split-export-declaration" "7.0.0-beta.44"
"@babel/types" "7.0.0-beta.44"
babylon "7.0.0-beta.44"
debug "^3.1.0"
globals "^11.1.0"
invariant "^2.2.0"
lodash "^4.2.0"

"@babel/types@7.0.0-beta.44", "@babel/types@^7.0.0-beta.40":
version "7.0.0-beta.44"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.44.tgz#6b1b164591f77dec0a0342aca995f2d046b3a757"
dependencies:
esutils "^2.0.2"
lodash "^4.2.0"
to-fast-properties "^2.0.0"

"@types/node@*":
version "9.6.1"
resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.1.tgz#e2d374ef15b315b48e7efc308fa1a7cd51faa06c"
Expand Down Expand Up @@ -486,6 +562,17 @@ babel-core@^6.26.0:
slash "^1.0.0"
source-map "^0.5.6"

babel-eslint@^8.2.2:
version "8.2.2"
resolved "http://registry.npmjs.org/babel-eslint/-/babel-eslint-8.2.2.tgz#1102273354c6f0b29b4ea28a65f97d122296b68b"
dependencies:
"@babel/code-frame" "^7.0.0-beta.40"
"@babel/traverse" "^7.0.0-beta.40"
"@babel/types" "^7.0.0-beta.40"
babylon "^7.0.0-beta.40"
eslint-scope "~3.7.1"
eslint-visitor-keys "^1.0.0"

babel-generator@^6.18.0, babel-generator@^6.23.0:
version "6.23.0"
resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.23.0.tgz#6b8edab956ef3116f79d8c84c5a3c05f32a74bc5"
Expand Down Expand Up @@ -693,6 +780,10 @@ babel-plugin-syntax-async-functions@^6.8.0:
version "6.13.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95"

babel-plugin-syntax-dynamic-import@^6.18.0:
version "6.18.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz#8d6a26229c83745a9982a441051572caa179b1da"

babel-plugin-syntax-exponentiation-operator@^6.8.0:
version "6.13.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz#9ee7e8337290da95288201a6a57f4170317830de"
Expand Down Expand Up @@ -1122,6 +1213,10 @@ babel-types@^6.19.0, babel-types@^6.24.1, babel-types@^6.26.0:
lodash "^4.17.4"
to-fast-properties "^1.0.3"

babylon@7.0.0-beta.44, babylon@^7.0.0-beta.40:
version "7.0.0-beta.44"
resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.44.tgz#89159e15e6e30c5096e22d738d8c0af8a0e8ca1d"

babylon@^6.11.0, babylon@^6.13.0, babylon@^6.15.0:
version "6.16.1"
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.16.1.tgz#30c5a22f481978a9e7f8cdfdf496b11d94b404d3"
Expand Down Expand Up @@ -2729,13 +2824,17 @@ eslint-plugin-react@^6.9.0:
jsx-ast-utils "^1.3.4"
object.assign "^4.0.4"

eslint-scope@^3.7.1:
eslint-scope@^3.7.1, eslint-scope@~3.7.1:
version "3.7.1"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8"
dependencies:
esrecurse "^4.1.0"
estraverse "^4.1.1"

eslint-visitor-keys@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"

eslint@^3.0.0, eslint@^3.13.0:
version "3.16.1"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.16.1.tgz#9bc31fc7341692cf772e80607508f67d711c5609"
Expand Down Expand Up @@ -3459,6 +3558,10 @@ global@~4.3.0:
min-document "^2.19.0"
process "~0.5.1"

globals@^11.1.0:
version "11.4.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-11.4.0.tgz#b85c793349561c16076a3c13549238a27945f1bc"

globals@^9.0.0, globals@^9.14.0:
version "9.16.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-9.16.0.tgz#63e903658171ec2d9f51b1d31de5e2b8dc01fb80"
Expand Down Expand Up @@ -4734,6 +4837,10 @@ jsesc@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b"

jsesc@^2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.1.tgz#e421a2a8e20d6b0819df28908f782526b96dd1fe"

jsesc@~0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d"
Expand Down Expand Up @@ -6139,7 +6246,7 @@ promise@^7.1.1:
dependencies:
asap "~2.0.3"

prop-types@15.x, prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.6, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.1:
prop-types@15.x, prop-types@^15.5.0, prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.6, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.1:
version "15.6.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.1.tgz#36644453564255ddda391191fb3a125cbdf654ca"
dependencies:
Expand Down Expand Up @@ -6356,6 +6463,12 @@ react-is@^16.3.0:
version "16.3.0"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.3.0.tgz#f0e8bfd8c09b480dd610b8639d9ed65c13601224"

react-loadable@^5.3.1:
version "5.3.1"
resolved "https://registry.yarnpkg.com/react-loadable/-/react-loadable-5.3.1.tgz#9699e9a08fed49bacd69caaa282034b62a76bcdd"
dependencies:
prop-types "^15.5.0"

react-reconciler@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/react-reconciler/-/react-reconciler-0.7.0.tgz#9614894103e5f138deeeb5eabaf3ee80eb1d026d"
Expand Down Expand Up @@ -7552,6 +7665,10 @@ to-fast-properties@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47"

to-fast-properties@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e"

to-object-path@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af"
Expand Down

0 comments on commit d38720b

Please sign in to comment.