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

Convert form_row_text_list to React #3264

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

Serial-ATA
Copy link

Problem

This is related to MBS-12755. This is just converting the form_row_text_list TT macro to a React component to make the conversion of the edit pages possible.

Solution

This is just a direct translation of the TT macro. I'm no web developer, so this may not be the best.

Testing

I converted area/edit_form.tt separately and tested with that.

demo

I didn't include that yet to keep this simple.

Further action

I plan to use this to convert the edit pages in follow up PRs.

Copy link

welcome bot commented May 16, 2024

Thanks for opening your first pull request for MusicBrainz Server, and welcome to our community! 🎉
If you haven’t yet, please check out our contributing guidelines.
Someone will be reviewing your PR soon; just hang in there!
In the meantime, if you’re wondering what to do next, you can have a look at our issue tracker.

@brainzbot
Copy link
Member

Can one of the admins verify this patch?

@yvanzo
Copy link
Contributor

yvanzo commented May 16, 2024

@brainzbot, add to whitelist

@yvanzo
Copy link
Contributor

yvanzo commented May 16, 2024

Thanks a lot for submitting this pull request!

Please note that there is some work in progress to start with converting Event edit form to React, as MBS-11063 is a sub-task of MBS-12755. Sorry if it wasn’t clear from the ticket, I just added a comment to avoid any further misinterpretation.

We will review the Event PR #2672 at first, and see if your present contribution can help with making it even better.

@Serial-ATA
Copy link
Author

Ah thanks, I hadn't seen MBS-11063. The list of tasks on MBS-12755 was collapsed for some reason so I only saw the first 5.

#2672 will help simplify my implementation of the area edit form later, since it adds the Bubble component. I think the only forms that use form_row_text_list are area, artist, label, recording, and work, so this will still be needed.

@reosarevok
Copy link
Member

I started working on some improvements here, hope you don't mind me pushing them to the branch :)

@reosarevok reosarevok force-pushed the form-row-text-list-react branch 4 times, most recently from cce2cc6 to ef0676f Compare September 6, 2024 10:30
root/static/scripts/edit/components/AddButton.js Outdated Show resolved Hide resolved
root/static/scripts/edit/components/FormRowTextList.js Outdated Show resolved Hide resolved
root/static/scripts/edit/components/FormRowTextList.js Outdated Show resolved Hide resolved
root/static/scripts/edit/components/FormRowTextList.js Outdated Show resolved Hide resolved
@reosarevok reosarevok force-pushed the form-row-text-list-react branch 2 times, most recently from 334b075 to eb77d3d Compare September 10, 2024 16:47
Serial-ATA and others added 15 commits September 11, 2024 12:42
This is needed to be able to use the component in our TT forms
until all forms are converted (and makes it easier to test
without having to fully convert the entity editors to React).
This allows testing the code. We eventually will want to use it
in all TT forms and drop the TT version.
This is a lot better for translators than "Add {item}" (and needed for
Estonian at least to actually be translated correctly in a simple way).

For area, we don't want translations though since it's an admin form.
This was a hack needed for JQuery to work on this, but with
React it's AFAICT entirely useless.
This matches what we do elsewhere in the codebase.
It makes sense for this to be a reusable component, but then
we should reuse it.
This allows us to remove the TextList jquery code that the
TT version uses.
This will be needed (or at least helpful) anyway when we use this
in a larger React form so we might as well get it ready now.
This is not ideal, but it's the same as in production - and associating it
with the repeatable field is invalid HTML.
@reosarevok
Copy link
Member

I think this is fine now but @mwiencek, please do recheck. @Serial-ATA, feel free to ask about anything :) I know it probably feels like I changed everything, but it was great to have a good starting point and I hope you do submit the stuff for area (with some modifications needed probably, but that's ok) if you still have it around :)

@Serial-ATA
Copy link
Author

Thanks for taking this over, I had forgotten about it 😄.

I still have the area form branch. I'll bring it up to date once this is merged.

@reosarevok
Copy link
Member

Just a comment that if we do merge this as-is then you'd want to use NonHydratedFormRowTextList in your area form (possibly as import {NonHydratedFormRowTextList as FormRowTextList}) - we'll eventually drop the hydrated version once all is converted I guess.

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.

5 participants