From d8d448bcf7a5686de9f766166c0aa5dd48ed0aad Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Thu, 16 Jan 2020 17:08:55 +0700 Subject: [PATCH] updated leaflet version and tree-shaked deps --- package-lock.json | 8 ++++---- package.json | 2 +- src/redux/editor/index.ts | 2 +- src/redux/map/index.ts | 2 +- src/redux/user/index.ts | 2 +- src/utils/marks.ts | 3 +-- src/utils/reducer.ts | 13 +++++++++++++ 7 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 src/utils/reducer.ts diff --git a/package-lock.json b/package-lock.json index 23cd49a..5a6cb34 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7943,9 +7943,9 @@ } }, "leaflet": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.4.0.tgz", - "integrity": "sha512-x9j9tGY1+PDLN9pcWTx9/y6C5nezoTMB8BLK5jTakx+H7bPlnbCHfi9Hjg+Qt36sgDz/cb9lrSpNQXmk45Tvhw==" + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.6.0.tgz", + "integrity": "sha512-CPkhyqWUKZKFJ6K8umN5/D2wrJ2+/8UIpXppY7QDnUZW5bZL5+SEI2J7GBpwh4LIupOKqbNSQXgqmrEJopHVNQ==" }, "leaflet-editable": { "version": "1.2.0", @@ -7960,7 +7960,7 @@ "resolved": "https://registry.npmjs.org/leaflet-geometryutil/-/leaflet-geometryutil-0.9.1.tgz", "integrity": "sha512-DKYLzFBsEcmZSl1fXLM+Pd+7t5IHmY6Ps7XeSnWL1ngr1qxQfcVzhkJT9gxfZrmFWiL96c23xQ0aLcHocV2tVA==", "requires": { - "leaflet": "1.4.0" + "leaflet": "1.6.0" } }, "leaflet-routing-machine": { diff --git a/package.json b/package.json index 5c75fc7..5c86c11 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "history": "^4.7.2", "http-errors": "~1.6.2", "js-md5": "^0.7.3", - "leaflet": "^1.4.0", + "leaflet": "^1.6.0", "leaflet-editable": "^1.1.0", "leaflet-editable-polyline": "muerwre/leaflet-editable-polyline#master", "leaflet-geometryutil": "^0.9.0", diff --git a/src/redux/editor/index.ts b/src/redux/editor/index.ts index 5afaaa5..6fca121 100644 --- a/src/redux/editor/index.ts +++ b/src/redux/editor/index.ts @@ -1,4 +1,4 @@ -import createReducer from 'reduxsauce/lib/createReducer'; +import { createReducer } from '~/utils/reducer'; import { IDialogs } from '~/constants/dialogs'; import { MODES } from '~/constants/modes'; import { EDITOR_HANDLERS } from './handlers'; diff --git a/src/redux/map/index.ts b/src/redux/map/index.ts index a836d29..daea378 100644 --- a/src/redux/map/index.ts +++ b/src/redux/map/index.ts @@ -1,4 +1,4 @@ -import createReducer from 'reduxsauce/lib/createReducer'; +import { createReducer } from '~/utils/reducer'; import { MAP_HANDLERS } from './handlers'; import { DEFAULT_PROVIDER } from '~/constants/providers'; import { IMapRoute } from './types'; diff --git a/src/redux/user/index.ts b/src/redux/user/index.ts index 1492dda..ef444d4 100644 --- a/src/redux/user/index.ts +++ b/src/redux/user/index.ts @@ -1,4 +1,4 @@ -import createReducer from 'reduxsauce/lib/createReducer'; +import { createReducer } from '~/utils/reducer'; import { DEFAULT_USER, IUser } from '~/constants/auth'; import { USER_HANDLERS } from './handlers'; diff --git a/src/utils/marks.ts b/src/utils/marks.ts index a39504f..3d2bf03 100644 --- a/src/utils/marks.ts +++ b/src/utils/marks.ts @@ -89,10 +89,9 @@ class KmMarksLayer extends LayerGroup { html: `
${distance} - +
diff --git a/src/utils/reducer.ts b/src/utils/reducer.ts new file mode 100644 index 0000000..1121914 --- /dev/null +++ b/src/utils/reducer.ts @@ -0,0 +1,13 @@ +// create-reducer.ts +import { Action } from 'redux'; + +type Handlers> = { + readonly [Type in Types]: (state: State, action: Actions) => State +} + +export const createReducer = ( + initialState, + handlers, +) => (state = initialState, action) => (handlers.hasOwnProperty(action.type) + ? handlers[action.type](state, action) + : state);