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

Add overridable tags #287

Merged
merged 9 commits into from
Apr 8, 2024

Conversation

SarahW91
Copy link
Contributor

Description

Added additional Overridable tags for a more finegrained control over React components.

Checklist

Third-party code

If you've added third-party code (copy/pasted or new dependencies), please reach out to an architect.

Reminder

By using GitHub, you have already agreed to the GitHub’s Terms of Service including that:

  1. You license your contribution under the same terms as the current repository’s license.
  2. You agree that you have the right to license your contribution under the current repository’s license.

@SarahW91 SarahW91 requested a review from kpsherva December 11, 2023 13:38
@SarahW91 SarahW91 closed this Dec 11, 2023
@SarahW91 SarahW91 reopened this Dec 11, 2023
computeFundingContents={computeFundingContents}
/>

<Overridable id="InvenioVocabularies.FundingField.AddAward.Button">
Copy link
Contributor

@kpsherva kpsherva Dec 14, 2023

Choose a reason for hiding this comment

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

Suggested change
<Overridable id="InvenioVocabularies.FundingField.AddAward.Button">
<Overridable id="InvenioVocabularies.FundingField.actions.container">

I would go with a common container for the actions of this field, rather than wrapping each element separately. There might be more action buttons that can be added to this field, and common container allows for more flexibility as well as it reduces the amount of unique overridable IDs that we need to maintain in the code base

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We actually need these separate ids on individual elements since we just want to hide one of these buttons (we only want to allow adding custom awards in our project)

Choose a reason for hiding this comment

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

I think there would be less flexibility in wrapping the common container. You would have to override each element (including those you want to keep) and even the possible future elements, wouldn't you?

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand your point, and you are right on the fact we should allow overriding each of the elements as well. In this case, however, the overridable ID should be added in the component itself - either on the <Button> in line 118 or inFundingModal. While we are adding overridable IDs as wrappers (parent of several "subcomponents") then we identify it as a "container" - otherwise we have

InvenioVocabularies.FundingField.AddAward.Button
InvenioVocabularies.FundingField.AddCustom.Button

both wrapping two instantiations of FundingModal component, which is semantically incorrect - the naming does not mention the modal itself whatsoever. This naming convention we reserved to be associated with a component definition, not instantiation, to avoid misunderstandings and inconsistencies in the naming.

I am happy to explain it more in details on how this naming convention was planned to be used over a call.

Copy link
Contributor

@kpsherva kpsherva left a comment

Choose a reason for hiding this comment

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

Hello @SarahW91 I was reviewing both PRs, please check my comments in
inveniosoftware/invenio-rdm-records#1631 (review)
I believe we could better align over a zoom call. We could try to schedule it on discord. Please let me know what you think :)

"selectedFunding.funder",
deserializedFunder
);
<Overridable id="InvenioVocabularies.CustomAwardForm.RemoteSelectField.SelectedFundingFunderId">
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<Overridable id="InvenioVocabularies.CustomAwardForm.RemoteSelectField.SelectedFundingFunderId">
<Overridable id="InvenioVocabularies.CustomAwardForm.container">

/>
</Overridable>
<Overridable id="InvenioVocabularies.CustomAwardForm.AwardInformation.Header">
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<Overridable id="InvenioVocabularies.CustomAwardForm.AwardInformation.Header">
<Overridable id="InvenioVocabularies.CustomAwardForm.AwardInformation.Header.container">

</Header>
</Overridable>
<Form.Group widths="equal">
<Overridable id="InvenioVocabularies.CustomAwardForm.AwardNumber.TextField">
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<Overridable id="InvenioVocabularies.CustomAwardForm.AwardNumber.TextField">
<Overridable id="InvenioVocabularies.CustomAwardForm.AwardNumber.container">

fieldPath="selectedFunding.award.number"
/>
</Overridable>
<Overridable id="InvenioVocabularies.CustomAwardForm.AwardTitle.TextField">
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<Overridable id="InvenioVocabularies.CustomAwardForm.AwardTitle.TextField">
<Overridable id="InvenioVocabularies.CustomAwardForm.AwardTitle.container">

fieldPath="selectedFunding.award.title"
/>
</Overridable>
<Overridable id="InvenioVocabularies.CustomAwardForm.AwardUrl.TextField">
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<Overridable id="InvenioVocabularies.CustomAwardForm.AwardUrl.TextField">
<Overridable id="InvenioVocabularies.CustomAwardForm.AwardUrl.container">

/>
</Overridable>

<Overridable id="InvenioVocabularies.FundingField.AddCustom.Button">
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<Overridable id="InvenioVocabularies.FundingField.AddCustom.Button">
<Overridable id="InvenioVocabularies.FundingField.AddCustom.container">

SarahW91 and others added 2 commits April 4, 2024 13:52
…s/src/contrib/forms/Funding/CustomAwardForm.js


Add fieldPath attribute to Overridable tag

Co-authored-by: Karolina <[email protected]>
fieldPath="selectedFunding.award.number"
/>
</Overridable>
<Overridable id="InvenioVocabularies.CustomAwardForm.AwardTitleTextField.Container">
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: please apply the same as in the component above

fieldPath="selectedFunding.award.title"
/>
</Overridable>
<Overridable id="InvenioVocabularies.CustomAwardForm.AwardUrlTextField.Container">
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: please apply the same as in the component above

@kpsherva kpsherva merged commit f6e6ffd into inveniosoftware:master Apr 8, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Released | Done 🚀
Development

Successfully merging this pull request may close these issues.

3 participants