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

Fix #9623 widgets font customizations #9682

Merged
merged 7 commits into from
Nov 27, 2023

Conversation

MV88
Copy link
Contributor

@MV88 MV88 commented Nov 3, 2023

Description

Now you can customize some properties of the font that will be stored inside layout prop or coutnerOpts

  • Counter widget fontSize had been hidden because that is automatic
  • Pie chart can customize the font inside the hover, but not inside the pie, because you would lose some auto corrections on the fontSize
  • A new Layout tab has been added that will contain general chart layout info, but you can then override it with the values inside the x,y axes
  • removed pie options chart comp since it's zombie code

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

Issue

What is the current behavior?

Fix #9623

What is the new behavior?

Breaking change

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • Yes, and I documented them in migration notes
  • No

Other useful information

Copy link
Contributor

@allyoucanmap allyoucanmap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the code is good, just few changes:

  • we should remove font color on pie chart because the default behaviour is better. Bu default it uses the contrast color for each slice of the pie
  • line and bar chart have the layout section for font called Popup style but it has only effect on the axis. I think the title should be different like Font. It seems there is none font options applied globally to the plolty configuration, is this intentional?
  • the font family select is clearable but it we click on the x an error in console shows up
  • I think the Noto font family should not be included in the list because it's not considered a web safe font and it related to the default theme of mapstore that could be different in a custom project. My proposal is to remove the Noto Sans from the list and display the Inherit label so plolty will use the page font by default

Comment on lines 142 to 146
useEffect(() => {
if (selectedTrace?.type === "pie" && tab === "axis") {
setTab("traces");
}
}, [selectedTrace?.type]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think a useEffect is needed in this case because the current selected tab could be computed directly in the render:

const selectedTab = selectedTrace?.type === "pie" && tab === "axis" ? "traces" : (selectedTrace?.type || "traces");

then use:

{tabContents[selectedTab]}

the selectedTab can be also passed to other components as tab prop

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure about this line, especially in the false part selectedTab could be = to selectedTrace?.type which is not a tab

image

maybe it was tab || "traces" or simply tab?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it was like that, I wrote the code in the comment not tested

web/client/utils/GeoStoryUtils.js Outdated Show resolved Hide resolved
web/client/utils/WidgetsUtils.js Outdated Show resolved Hide resolved
@MV88
Copy link
Contributor Author

MV88 commented Nov 15, 2023

Overall the code is good, just few changes:

  • we should remove font color on pie chart because the default behaviour is better. Bu default it uses the contrast color for each slice of the pie

makes sense

  • line and bar chart have the layout section for font called Popup style but it has only effect on the axis. I think the title should be different like Font.

yes I've missed it during refactor

It seems there is none font options applied globally to the plotly configuration, is this intentional?

what do you mean exactly by "globally"?
In the Layout tab you can configure generic font attributes that are applied to all traces in that specific chart

  • the font family select is clearable but it we click on the x an error in console shows up

I'll remove clearable

  • I think the Noto font family should not be included in the list because it's not considered a web safe font and it related to the default theme of mapstore that could be different in a custom project. My proposal is to remove the Noto Sans from the list and display the Inherit label so plotly will use the page font by default

sounds good

MV88 added 2 commits November 15, 2023 11:51
* removed noto sans
* extended layout font customizations
* added jsdoc to Font comp
* removed clearable to font family
@MV88 MV88 requested a review from allyoucanmap November 15, 2023 11:06
@MV88
Copy link
Contributor Author

MV88 commented Nov 15, 2023

@allyoucanmap
PR is ready again for review

@MV88 MV88 requested a review from allyoucanmap November 23, 2023 18:00
@allyoucanmap allyoucanmap merged commit 5418216 into geosolutions-it:master Nov 27, 2023
4 checks passed
@allyoucanmap
Copy link
Contributor

@ElenaGallo please test this fix on dev, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Widgets - From the wizard we would like to configure the properties of the text
2 participants