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: organize settings dialog with tabs #301

Merged
merged 8 commits into from
Nov 6, 2024
Merged

Conversation

cristianoventura
Copy link
Collaborator

Description

This PR changes the Settings dialog by separating sections into tabs. This provides a cleaner user interface as we add more functionalities to the Studio and enable users with custom settings.

How to Test

  • Make the state of the settings dialog invalid
  • Attempt to submit
  • Check that tabs with errors are automatically selected and, inputs with errors automatically get focus

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (npm run lint) and all checks pass.
  • I have run tests locally (npm test) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Screenshots (if appropriate):

Screen.Recording.2024-11-05.at.4.13.41.PM.mov

Related PR(s)/Issue(s)

@cristianoventura cristianoventura self-assigned this Nov 5, 2024

type SettingsDialogProps = {
open: boolean
onOpenChange: (open: boolean) => void
}

const tabs = [
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I extracted the content of the tabs to an array, so we can loop through and select which one to focus on after an error happens, following the order they are rendered in the UI. This ensures that the user is taken to the very first error at the top of the form.

This loop happens in the onInvalid method on L72.

Copy link
Collaborator

Choose a reason for hiding this comment

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

so we can loop through and select which one to focus on after an error happens

Looks like saving on blur/change can help us avoid the problem altogether: we won't need to show the warning icon and focus on a broken tab, and the user won't need to remember to save when the changes they made are on a different tab

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think using onBlur would be ideal, however this won't work for fields that are dependant on a checkbox (such as the proxy credentials) as the checkbox uses onChange instead.

@going-confetti and I agreed to leave as is for now and improve in the future.

@cristianoventura cristianoventura marked this pull request as ready for review November 5, 2024 21:34
@cristianoventura cristianoventura requested a review from a team as a code owner November 5, 2024 21:34
@cristianoventura cristianoventura requested review from going-confetti, e-fisher and Llandy3d and removed request for a team November 5, 2024 21:34
Llandy3d
Llandy3d previously approved these changes Nov 6, 2024
Copy link
Member

@Llandy3d Llandy3d left a comment

Choose a reason for hiding this comment

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

Looks good!

I wonder if it makes sense for the Recorder section to show greyed out the inputs for selecting a specific browser... it feels like the information that you can actually do that it's hidden away 🤔

Copy link
Collaborator

@going-confetti going-confetti left a comment

Choose a reason for hiding this comment

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

LGTM!
@cristianoventura and I talked about auto-saving changes and it looks like it'll be a separate improvement later on, because of how settings are designed (for example, changing the proxy mode changes how the form should be validated)

@cristianoventura cristianoventura merged commit 1d3d081 into main Nov 6, 2024
2 checks passed
@cristianoventura cristianoventura deleted the feat/settings-tabs branch November 6, 2024 16:02
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.

3 participants