From aed7634885b1c258b3232329a77377bdb8b967b1 Mon Sep 17 00:00:00 2001 From: Shan He Date: Thu, 27 Feb 2020 15:51:43 -0800 Subject: [PATCH] address comment Signed-off-by: Shan He --- .../dropbox/dropbox-provider.js | 4 ++- src/components/modals/load-storage-map.js | 18 ++++++++----- src/reducers/vis-state-updaters.js | 27 ------------------- 3 files changed, 14 insertions(+), 35 deletions(-) diff --git a/examples/demo-app/src/cloud-providers/dropbox/dropbox-provider.js b/examples/demo-app/src/cloud-providers/dropbox/dropbox-provider.js index b82060fe1e..9b02fa23cb 100644 --- a/examples/demo-app/src/cloud-providers/dropbox/dropbox-provider.js +++ b/examples/demo-app/src/cloud-providers/dropbox/dropbox-provider.js @@ -34,6 +34,7 @@ const CORS_FREE_DOMAIN = 'dl.dropboxusercontent.com'; const PRIVATE_STORAGE_ENABLED = true; const SHARING_ENABLED = true; const MAX_THUMBNAIL_BATCH = 25; +const IMAGE_URL_PREFIX = 'data:image/gif;base64,'; function parseQueryString(query) { const searchParams = new URLSearchParams(query); @@ -147,7 +148,7 @@ export default class DropboxProvider extends Provider { if (thb['.tag'] === 'success' && thb.thumbnail) { const matchViz = visualizations[pngs[thb.metadata.id] && pngs[thb.metadata.id].name]; if (matchViz) { - matchViz.thumbnail = `data:image/gif;base64,${thb.thumbnail}`; + matchViz.thumbnail = `${IMAGE_URL_PREFIX}${thb.thumbnail}`; } } }); @@ -304,6 +305,7 @@ export default class DropboxProvider extends Provider { response = await this._dropbox.usersGetCurrentAccount(); } catch (error) { Console.warn(error); + return null; } return this._getUserFromAccount(response); diff --git a/src/components/modals/load-storage-map.js b/src/components/modals/load-storage-map.js index 597b430c8d..3bc2144f84 100644 --- a/src/components/modals/load-storage-map.js +++ b/src/components/modals/load-storage-map.js @@ -293,13 +293,17 @@ function LoadStorageMapFactory() { - {visualizations.map(vis => ( - this._onLoadCloudMap(provider, vis)} - vis={vis} - /> - ))} + {visualizations.length ? ( + visualizations.map(vis => ( + this._onLoadCloudMap(provider, vis)} + vis={vis} + /> + )) + ) : ( +
>No saved maps yet
+ )}
diff --git a/src/reducers/vis-state-updaters.js b/src/reducers/vis-state-updaters.js index 8d252f24f5..532cc04d47 100644 --- a/src/reducers/vis-state-updaters.js +++ b/src/reducers/vis-state-updaters.js @@ -1323,33 +1323,6 @@ export const loadFilesUpdater = (state, action) => { if (!files.length) { return state; } - // const filesToLoad = files.map(fileBlob => processFileToLoad(fileBlob)); - - // reader -> parser -> augment -> receiveVisData - // const loadFileTasks = [ - // Task.all(filesToLoad.map(LOAD_FILE_TASK)).bimap( - // // success - // results => { - // console.log(results) - // const data = results.reduce( - // (f, c) => ({ - // // using concat here because the current datasets could be an array or a single item - // datasets: f.datasets.concat(c.datasets), - // // we need to deep merge this thing unless we find a better solution - // // this case will only happen if we allow to load multiple keplergl json files - // config: { - // ...f.config, - // ...(c.config || {}) - // } - // }), - // {datasets: [], config: {}, options: {centerMap: true}} - // ); - - // return addDataToMap(data); - // }, - // // error - // loadFilesErr) - // ]; const fileCache = []; return withTask(