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 some minor js issues #2184

Draft
wants to merge 10 commits into
base: update-bootstrap-ui-library
Choose a base branch
from

Conversation

jhmegorei
Copy link
Collaborator

I clicked through the app and noted a lot of small JS errors in development mode (mostly PropType related).

This PR fixes them as good as possible.

The value is internally converted to a numeral anyway, so we can be lenient in accepting data.
Additionally, the component was called with a no longer existing property, which I removed as well.
…e object, not a JS Object

This caused Proptype Errors in AddButton and Citation
…onent

The original issue was just that the ToggleButton was situated in the Tab Button, which throws an error, because you are not allowed
to nest a <button> within a <button>.

Then it occurred to me, that this was the only instance where this button is used and that it's usage (namely toggling reaction scheme between default and gaseous)
was not very clear until you hover over the button and read the tooltip.

Therefore I replaced it by a regular bootstrap buttongroup we also use in other places. This way, the toggling functionality becomes clear directly,
as both buttons are displayed at the same time. So no more hover necessary. Additionally, the buttons use a global utility component for easier styling
of toggle buttons throughout the app.
The render function sets a default, so the prop is definitely not required
Copy link
Collaborator

@maiwald maiwald left a comment

Choose a reason for hiding this comment

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

👍

updatedLiterature.refs = { citation, bibtex: citation.format('bibtex'), bibliography: json.format('bibliography') };

return ({ literature: updatedLiterature });
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this modifies the prevState.literature object. This may not cause any issues but I'd prefer creating a new object, as in {…prevState.literature, doi: doi, etc… }

updatedLiterature.refs = { citation, bibtex: citation.format('bibtex'), bibliography: json.format('bibliography') };

return ({ literature: updatedLiterature });
});
const { literature } = this.state;
this.handleLiteratureAdd(literature);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just looking at this, it seems odd that we are calling handleLiteratureAdd with the current literature object, that has not been affected by the changes in setState above.

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

Successfully merging this pull request may close these issues.

2 participants