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

feat: Fetch team_settings data for Editor forms and adding Update fn #3366

Merged
merged 8 commits into from
Jul 3, 2024

Conversation

RODO94
Copy link
Contributor

@RODO94 RODO94 commented Jul 3, 2024

What does this PR do?

This is a cleaner branch from the work undertaken on this previous branch: #3319

Continuing work on the team_settings implementation, this PR pulls in data from the database with a graphQL query and populates the corresponding form inputs.

This PR also uses the update mutation, similar to team_themes to update the form fields and database.

This PR aligns with a planx-core change where the requests and types for a Team were altered to incorporate the new team_settings table.

Reference to the planx-core changes

Important to note that this PR has not deleted any functions, methods, or types related to previous versions of notifyPersonalisation or the original settings column of "teams" table. Thinking is to do this clear out after changes have been made and tested using the new team_settings table

Copy link

github-actions bot commented Jul 3, 2024

Removed vultr server and associated DNS entries

Copy link
Contributor

@DafyddLlyr DafyddLlyr left a comment

Choose a reason for hiding this comment

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

Looking good - a lot simpler and cleaner following those naming updates 👍

There's a few outstanding issues to address, please see comments.

Also, I'd take a look at co-locating errors alongside their inputs. This will lead to a better user experience, and is required for accessibility reasons. This can be addressed here or in a follow up PR - whatever works best for you.

image

Comment on lines 50 to 54
{
name: "General",
route: "general",
Component: GeneralSettings,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think I'd reorder this array to be General → Design → Team

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DafyddLlyr do you think it is worth doing these types of changes as a final PR when error handling is all sorted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thought about it again, and tit doesn't really make it difference, so I've added it to this PR

Comment on lines +25 to +28
const isSuccess = await useStore.getState().updateTeamSettings({
helpEmail: values.helpEmail,
helpOpeningHours: values.helpOpeningHours,
helpPhone: values.helpPhone,
Copy link
Contributor

Choose a reason for hiding this comment

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

homepage is missing here which means that changes to the URL are not persisted.

onSubmit(values, { resetForm }) {
onSuccess();
resetForm({ values });
onSubmit: async (values, { resetForm }) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

We're still missing some basic validation on this field. I appreciate there's still work to be done on the boundary field, but if we're going to unhide the menu and allow Editors to access it we should either put this in place first, or hide this field.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll do the error handling in another PR, hopefully make it a lot cleaner. Current ones were just to test my understanding of formik and yup

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added basic validation now though

Copy link
Contributor

@DafyddLlyr DafyddLlyr left a comment

Choose a reason for hiding this comment

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

Perfect! Looking great 😄 ✅

Agree that validation in the next PR will be the best way to go here 👍

@RODO94
Copy link
Contributor Author

RODO94 commented Jul 3, 2024

Perfect! Looking great 😄 ✅

Agree that validation in the next PR will be the best way to go here 👍

Maybe I should move that last commit to a new PR then? @DafyddLlyr

@DafyddLlyr
Copy link
Contributor

Sorry for not being clear, I think this should merge as-is, and we can tackle per-field validation next in a follow up PR.

@RODO94 RODO94 merged commit 2d5ad70 into main Jul 3, 2024
12 checks passed
@RODO94 RODO94 deleted the rory/team-settings-data-update branch July 3, 2024 16:03
@RODO94
Copy link
Contributor Author

RODO94 commented Jul 5, 2024

1 similar comment
@RODO94
Copy link
Contributor Author

RODO94 commented Jul 5, 2024

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