Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Update dependencies #81

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
}
}], "@babel/preset-react"],
"plugins": [
["@babel/plugin-transform-modules-commonjs", { "loose": true }],
["@babel/plugin-transform-modules-commonjs", { "loose": false }],
["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-syntax-dynamic-import",
["@babel/plugin-proposal-class-properties", { "loose": true }],
["@babel/plugin-proposal-class-properties", { "loose": false }],
"@babel/plugin-proposal-object-rest-spread",
["@babel/plugin-transform-runtime", { "regenerator": true }]
]
Expand Down
41,648 changes: 22,835 additions & 18,813 deletions package-lock.json

Large diffs are not rendered by default.

128 changes: 64 additions & 64 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Frontend for chron project",
"license": "GPLv3",
"scripts": {
"start": "webpack-dev-server --env.EXT=true --config ./webpack.config.dev.js",
"start": "webpack-dev-server --env EXT=true --config ./webpack.config.dev.js",
"dev": "webpack-dev-server --config ./webpack.config.dev.js",
"release": "rimraf dist && webpack --config webpack.config.prod.js",
"test": "jest --config ./jest.config.js",
Expand Down Expand Up @@ -35,79 +35,79 @@
},
"homepage": "https://github.com/chronhq/frontend/",
"devDependencies": {
"@storybook/react": "^5.3.13",
"@storybook/react": "^6.4.18",
"babel-eslint": "^10.0.3",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.0.1",
"enzyme-adapter-react-16": "^1.15.6",
"eslint": "^8.8.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-loader": "^3.0.3",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jest": "^23.7.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.18.3",
"jest": "^25.1.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^26.0.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.28.0",
"jest": "^27.5.0",
"jest-enzyme": "^7.1.2",
"react-hot-loader": "^4.12.19",
"react-test-renderer": "^16.12.0",
"react-hot-loader": "^4.13.0",
"react-test-renderer": "^17.0.2",
"rimraf": "^3.0.2",
"stylelint": "^13.2.0",
"stylelint-config-standard": "^20.0.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
"stylelint": "^14.3.0",
"stylelint-config-standard": "^24.0.0",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.7.4"
},
"dependencies": {
"@babel/core": "^7.8.4",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-decorators": "^7.8.3",
"@babel/plugin-proposal-object-rest-spread": "^7.8.3",
"@babel/core": "^7.17.0",
"@babel/plugin-proposal-class-properties": "^7.16.7",
"@babel/plugin-proposal-decorators": "^7.17.0",
"@babel/plugin-proposal-object-rest-spread": "^7.16.7",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.8.3",
"@babel/plugin-transform-modules-commonjs": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.8.3",
"@babel/preset-env": "^7.8.4",
"@babel/preset-react": "^7.8.3",
"@babel/runtime": "^7.8.4",
"@firebase/app": "^0.5.4",
"@firebase/auth": "^0.13.5",
"@firebase/polyfill": "^0.3.31",
"autoprefixer": "^9.7.4",
"axios": "^0.19.2",
"babel-loader": "^8.0.6",
"copy-webpack-plugin": "^5.1.1",
"core-js": "^3.6.4",
"css-loader": "^3.4.2",
"file-loader": "^5.0.2",
"firebase": "^7.8.2",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/plugin-transform-modules-commonjs": "^7.16.8",
"@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.16.11",
"@babel/preset-react": "^7.16.7",
"@babel/runtime": "^7.17.0",
"@firebase/app": "^0.7.16",
"@firebase/auth": "^0.19.8",
"@firebase/polyfill": "^0.3.36",
"autoprefixer": "^10.4.2",
"axios": "^0.25.0",
"babel-loader": "^8.2.3",
"copy-webpack-plugin": "^10.2.4",
"core-js": "^3.21.0",
"css-loader": "^6.6.0",
"file-loader": "^6.2.0",
"firebase": "^9.6.6",
"html-loader": "^3.1.0",
"html-webpack-plugin": "^5.5.0",
"julian": "^0.2.0",
"less": "^3.11.1",
"less-loader": "^5.0.0",
"mapbox-gl": "^1.7.0",
"mini-css-extract-plugin": "^0.9.0",
"mobx": "^5.15.4",
"mobx-react": "^6.1.8",
"postcss-fail-on-warn": "^0.1.0",
"postcss-flexbugs-fixes": "^4.2.0",
"postcss-loader": "^3.0.0",
"promise-polyfill": "^8.1.3",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-firebaseui": "^4.1.0",
"react-ga": "^2.7.0",
"less": "^4.1.2",
"less-loader": "^10.2.0",
"mapbox-gl": "^2.7.0",
"mini-css-extract-plugin": "^2.5.3",
"mobx": "^6.3.13",
"mobx-react": "^7.2.1",
"postcss-fail-on-warn": "^0.2.1",
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-loader": "^6.2.1",
"promise-polyfill": "^8.2.1",
"prop-types": "^15.8.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-firebaseui": "^6.0.0",
"react-ga": "^3.3.0",
"react-hotkeys": "^2.0.0",
"react-map-gl": "^5.2.3",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-select": "^3.0.8",
"react-smooth-collapse": "^2.1.0",
"react-map-gl": "^6.1.19",
"react-router": "^5.2.1",
"react-router-dom": "^5.3.0",
"react-select": "^5.2.2",
"react-smooth-collapse": "^2.1.1",
"react-yandex-metrika": "^2.6.0",
"style-loader": "^1.1.3",
"url-loader": "^3.0.0",
"use-onclickoutside": "^0.3.1",
"webpack": "^4.41.6",
"webpack-bundle-analyzer": "^3.6.0"
"style-loader": "^3.3.1",
"url-loader": "^4.1.1",
"use-onclickoutside": "^0.4.0",
"webpack": "^5.68.0",
"webpack-bundle-analyzer": "^4.5.0"
}
}
13 changes: 9 additions & 4 deletions src/models/DeckViewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
computed,
action
} from 'mobx';
import { flags } from './FlagsModel';

const INITIAL_VIEW_STATE = {
latitude: 0,
Expand All @@ -47,8 +48,12 @@ export default class DeckViewportModel {

@observable mapInitialized = false;

@computed get flags() {
return this.rootStore?.flags.deck.list || flags.deck
}

@computed get viewport() {
const { minZoom, maxZoom, center } = this.rootStore.flags.deck.list;
const { minZoom, maxZoom, center } = this.flags;

const vState = {
width: this.width,
Expand Down Expand Up @@ -79,15 +84,15 @@ export default class DeckViewportModel {

@computed get validZoomValue() {
// Do not reset zoom if current value is in range
const { minZoom, maxZoom } = this.rootStore.flags.deck.list;
const { minZoom, maxZoom } = this.flags;
const { zoom } = this.viewState;
return (maxZoom >= zoom && minZoom <= zoom)
? zoom // Keep current zoom if in range
: this.viewport.viewState.zoom;
}

@computed get viewState() {
const { minZoom, maxZoom } = this.rootStore.flags.deck.list;
const { minZoom, maxZoom } = this.rootStore.flags;
return {
width: this.width,
height: this.height,
Expand All @@ -110,7 +115,7 @@ export default class DeckViewportModel {

// Center from narration or map settings
@computed get defaultCenter() {
return this.rootStore.flags.deck.list.center;
return this.flags.center;
}

set viewState(viewState) {
Expand Down
2 changes: 1 addition & 1 deletion src/models/FlagsModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import { observable, action, computed } from 'mobx';

const flags = {
export const flags = {
runtime: {
SelectedCourse: null,
},
Expand Down
28 changes: 17 additions & 11 deletions src/models/Wikidata/Items/WikidataCountryItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,8 @@ import * as queries from './Queries';
import { julianInt } from '../../YearModel';

class WikidataCountryItem extends WikidataItem {
@observable queries = ['country', 'form'];

@observable extra = ['flag', 'capital', 'head', 'population'];

@observable saveEffects = {
country: this.fixData('country', 'item', false),
flag: this.fixData('flag', 'flag'),
capital: this.fixData('capital', 'capital'),
head: this.fixData('head', 'head'),
form: this.fixData('form', 'form'),
population: this.fixData('population', 'population')
};

fixData(key, label, dates = true) {
return () => {
this.data[key] = this.data[key].map((d) => {
Expand Down Expand Up @@ -94,6 +83,23 @@ class WikidataCountryItem extends WikidataItem {
: {};
return current;
}

constructor(id, rootStore) {
this.queries.push('country', 'form');
const saveEffects = {
country: this.fixData('country', 'item', false),
flag: this.fixData('flag', 'flag'),
capital: this.fixData('capital', 'capital'),
head: this.fixData('head', 'head'),
form: this.fixData('form', 'form'),
population: this.fixData('population', 'population')
};
Object.entries(saveEffects).forEach(([k,v]) => {
this.saveEffects[k] = v;
});

super(id, rootStore);
}
}

export default WikidataCountryItem;
11 changes: 9 additions & 2 deletions src/models/Wikidata/Items/WikidataItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,18 @@ class WikidataItem {
}

class WikidataBattleItem extends WikidataItem {
@observable queries = ['event', 'battle'];
constructor(id, rootStore) {
this.queries.push('event', 'battle');
super(id, rootStore);
}

}

class WikidataTreatyItem extends WikidataItem {
@observable queries = ['event', 'treaty'];
constructor(id, rootStore) {
this.queries.push('event', 'treaty');
super(id, rootStore);
}
}

export {
Expand Down
16 changes: 8 additions & 8 deletions src/models/Wikidata/Items/WikidataPersonItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { observable, computed } from 'mobx';
import { override } from 'mobx';
import WikidataItem from './WikidataItem';

class WikidataPersonItem extends WikidataItem {
@observable queries = ['person'];

@observable saveEffects = {
person: () => null
}

@computed get item() {
@override get item() {
if (this.data.person === undefined || !this.data.person.length) return {};
const raw = this.data.person[0];

Expand All @@ -47,6 +41,12 @@ class WikidataPersonItem extends WikidataItem {
death: fixedDeath
};
}
constructor(id, rootStore) {
this.queries.push('person');
this.saveEffects.person = () => null;

super(id, rootStore);
}
}

export default WikidataPersonItem;
16 changes: 2 additions & 14 deletions webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');

const mode = 'development';

Expand All @@ -29,7 +28,7 @@ module.exports = (env = {}) => ({
mode,
devtool: 'source-map',
entry: {
main: path.resolve(__dirname, 'src'),
main: path.resolve(__dirname, 'src/index.js'),
},
output: {
filename: '[name].js',
Expand All @@ -47,18 +46,11 @@ module.exports = (env = {}) => ({
nodeEnv: mode,
},
devServer: {
host: '0.0.0.0',
public: '0.0.0.0:3000',
historyApiFallback: true,
inline: true,
port: 3000,
hot: true,
hotOnly: true,
compress: true,
https: false,
disableHostCheck: true,
contentBase: path.resolve('static'),
publicPath: '/',
static: path.resolve('static'),
proxy: getEnv(env, 'EXT')
? [{
context: ['/api', '/mvt', 'status/mvt'],
Expand Down Expand Up @@ -138,10 +130,6 @@ module.exports = (env = {}) => ({
'process.env.NODE_ENV': JSON.stringify(mode),
}),
new webpack.HotModuleReplacementPlugin(),
new BundleAnalyzerPlugin({
analyzerPort: '3001',
openAnalyzer: false,
}),
new HtmlWebpackPlugin({
title: 'Chron Development',
filename: 'index.html',
Expand Down