Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cms] in the Tabs.jsx section, add an option for grouping visualizations together #621

Closed
perpetualgrimace opened this issue Jul 30, 2019 · 1 comment
Labels
type: enhancement Small, low-risk improvements

Comments

@perpetualgrimace
Copy link
Contributor

Currently, Tabs.jsx checks for the existence of a tab key in the d3plus config, which allows you to group visualizations together. But that's overloading the d3plus config with canon props. We should instead handle this explicitly in the interface & database.

function findKey(str, key) {
  const regex = new RegExp(`${key}\\:[\\s]*\\"([^\\"]+)\\"`, "g");
  const match = regex.exec(str);
  if (match) return match[1];
  else return match;
}

const titleKeys = ["tab", "type"];

const tabs = visualizations.map((d, i) => {
  let title;
  for (let x = 0; x < titleKeys.length; x++) {
    title = findKey(d.logic, titleKeys[x]);
    if (title) break;
  }
  return title || `Visualization ${i + 1}`;
});
@perpetualgrimace perpetualgrimace added the type: enhancement Small, low-risk improvements label Jul 30, 2019
@jhmullen
Copy link
Collaborator

jhmullen commented Jun 9, 2021

Closing in lieu of #1216

@jhmullen jhmullen closed this as completed Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Small, low-risk improvements
Projects
None yet
Development

No branches or pull requests

2 participants