Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
Signed-off-by: Shan He <[email protected]>
  • Loading branch information
heshan0131 committed Feb 27, 2020
1 parent aa25fcc commit aed7634
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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}`;
}
}
});
Expand Down Expand Up @@ -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);
Expand Down
18 changes: 11 additions & 7 deletions src/components/modals/load-storage-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,17 @@ function LoadStorageMapFactory() {
</span>
<StyledSeparator />
<StyledVisualizationList>
{visualizations.map(vis => (
<VisualizationItem
key={vis.id}
onClick={() => this._onLoadCloudMap(provider, vis)}
vis={vis}
/>
))}
{visualizations.length ? (
visualizations.map(vis => (
<VisualizationItem
key={vis.id}
onClick={() => this._onLoadCloudMap(provider, vis)}
vis={vis}
/>
))
) : (
<div className="visualization-list__message">>No saved maps yet</div>
)}
</StyledVisualizationList>
</StyledProviderVisSection>
</StyledVisualizationSection>
Expand Down
27 changes: 0 additions & 27 deletions src/reducers/vis-state-updaters.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit aed7634

Please sign in to comment.