From 798976e4c1f44f35be7acc4d8a95ea2beb5b825c Mon Sep 17 00:00:00 2001 From: maniarathi Date: Tue, 13 Oct 2020 15:47:56 -0700 Subject: [PATCH] Fix custom color handling (#1929) --- client/src/components/infoDrawer/infoFormat.js | 7 +------ client/src/util/stateManager/colorHelpers.js | 10 +++++++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/client/src/components/infoDrawer/infoFormat.js b/client/src/components/infoDrawer/infoFormat.js index 880a5f7d..6909e7cf 100644 --- a/client/src/components/infoDrawer/infoFormat.js +++ b/client/src/components/infoDrawer/infoFormat.js @@ -168,12 +168,7 @@ const renderLinks = (projectLinks, aboutURL) => { }; const InfoFormat = React.memo( - ({ - datasetTitle, - singleValueCategories, - aboutURL, - dataPortalProps = {}, - }) => { + ({ datasetTitle, singleValueCategories, aboutURL, dataPortalProps = {} }) => { if (dataPortalProps.version?.["corpora_schema_version"] !== "1.0.0") { dataPortalProps = {}; } diff --git a/client/src/util/stateManager/colorHelpers.js b/client/src/util/stateManager/colorHelpers.js index 4eaea2b7..d324dd37 100644 --- a/client/src/util/stateManager/colorHelpers.js +++ b/client/src/util/stateManager/colorHelpers.js @@ -106,15 +106,19 @@ export function loadUserColorConfig(userColors) { return -1; }) .reduce( - (acc, label, i) => { + (acc, label) => { const color = parseRGB(userColors[category][label]); acc[0][label] = color; - acc[1][i] = d3.rgb(255 * color[0], 255 * color[1], 255 * color[2]); + acc[1][label] = d3.rgb( + 255 * color[0], + 255 * color[1], + 255 * color[2] + ); return acc; }, [{}, {}] ); - const scale = (i) => scaleMap[i]; + const scale = (label) => scaleMap[label]; convertedUserColors[category] = { colors, scale }; }); return convertedUserColors;