From 09658b812622ce14ded5213fc3daaac5bc9f37e0 Mon Sep 17 00:00:00 2001 From: muerwre Date: Fri, 7 Dec 2018 10:51:11 +0700 Subject: [PATCH] dialogs: load only 20 routes at start --- backend/routes/auth/check.js | 2 +- src/redux/user/sagas.js | 19 +++++++------------ src/styles/dialogs.less | 12 +++--------- src/styles/main.less | 2 +- 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/backend/routes/auth/check.js b/backend/routes/auth/check.js index 0cecf94..ae7a2d7 100644 --- a/backend/routes/auth/check.js +++ b/backend/routes/auth/check.js @@ -9,7 +9,7 @@ module.exports = async (req, res) => { path: 'routes', select: '_id title distance owner updated_at', options: { - limit: 100, + limit: 20, sort: { updated_at: -1 }, } }); diff --git a/src/redux/user/sagas.js b/src/redux/user/sagas.js index 5dccc61..c959584 100644 --- a/src/redux/user/sagas.js +++ b/src/redux/user/sagas.js @@ -332,15 +332,13 @@ function setProviderSaga({ provider }) { } function* locationChangeSaga({ location }) { - const { address, editing, ready, user: { id, random_url } } = yield select(getState); + const { address, ready, user: { id, random_url } } = yield select(getState); if (!ready) return; const { path, mode } = getUrlData(location); if (address !== path) { - console.log('LOADING NEW DATA'); - const map = yield call(loadMapSaga, path); if (map && map.owner && mode === 'edit' && map.owner.id !== id) { @@ -348,19 +346,16 @@ function* locationChangeSaga({ location }) { return; } } else if (mode === 'edit' && editor.owner.id !== id) { - console.log('NOT AN OWNER!!!', editor.owner.id, id); pushPath(`/${random_url}/edit`); return; } - if (editing !== (mode === 'edit')) { - if (mode === 'edit') { - yield put(setEditing(true)); - editor.startEditing(); - } else { - yield put(setEditing(false)); - editor.stopEditing(); - } + if (mode !== 'edit') { + yield put(setEditing(false)); + editor.stopEditing(); + } else { + yield put(setEditing(true)); + editor.startEditing(); } } diff --git a/src/styles/dialogs.less b/src/styles/dialogs.less index a8a77af..efc9e03 100644 --- a/src/styles/dialogs.less +++ b/src/styles/dialogs.less @@ -32,7 +32,7 @@ border-radius: @panel_radius; box-shadow: @dialog_shadow; - &::before { + &::before, &::after { content: ' '; height: 40px; width: 100%; @@ -43,19 +43,13 @@ background: linear-gradient(180deg, rgba(39, 21, 53, 1), rgba(39, 21, 53, 0)); position: absolute; z-index: 5; + pointer-events: none; } &::after { - content: ' '; - height: 40px; - width: 100%; - left: 0; + top: auto; bottom: 0; - // background: linear-gradient(0deg, rgba(2, 13, 43, 1) 50%, rgba(2,13,43,0)); - // background: linear-gradient(0deg, rgba(34, 34, 34, 1) 50%, rgba(34, 34, 34, 0)); background: linear-gradient(0deg, rgba(39, 21, 53, 1), rgba(39, 21, 53, 0)); - position: absolute; - z-index: 5; } } diff --git a/src/styles/main.less b/src/styles/main.less index 0758343..2053747 100644 --- a/src/styles/main.less +++ b/src/styles/main.less @@ -91,7 +91,7 @@ body { &::after { content: ' '; - width: 7px; + width: 5px; height: 100%; display: block; right: 0;