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(TripPlan.InputForm): improve location validation + add visual error state #2365

Merged
merged 8 commits into from
Feb 5, 2025

Conversation

thecristen
Copy link
Collaborator

Summary of changes

Asana Ticket: mostly TP | Add an error state when location isn't selected with some UI/UX | Trip Planner location input error state, should fix TP Bugs | Trip planner input location bug

Will be even better with #2364 and #2361 in the mix.

Key changes

  • Validation of the :to and :from fields has been overhauled, and adds the error where needed
  • The location inputs are technically themable now, and we use that to change to the error styling when that form field has errors
  • Text that's pasted into the location inputs now gets sent to LiveView (as a pseudo-"selection" that's a name with no lat/lon) and proceeds through our usual pipelines

More changes

  • Fixes the default params in Dotcom.TripPlan.AntiCorruptionLayer to not encode missing params as "nil"
  • Only validates whether locations A != B if each location is itself valid

@thecristen thecristen requested a review from a team as a code owner February 5, 2025 17:46
Copy link
Contributor

@joshlarson joshlarson left a comment

Choose a reason for hiding this comment

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

The UX for this looks great!

I think it'd be worth having a test ensuring that there's an error when a location is invalid, and that there is no error when the location is just fully absent (I think that test would be at the Dotcom.TripPlan.InputForm level?)

@thecristen
Copy link
Collaborator Author

@joshlarson Great! I've added a test for the first thing; the second thing already has a test for no error when the location is fully absent!

@thecristen thecristen force-pushed the cbj/trip-planner-input-errors branch from eeae30f to 103a364 Compare February 5, 2025 21:35
@thecristen thecristen enabled auto-merge (squash) February 5, 2025 22:29
"to" => %{
"latitude" => "",
"longitude" => "",
"name" => Faker.Cat.breed(),
Copy link
Contributor

Choose a reason for hiding this comment

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

🐈

Copy link
Contributor

@joshlarson joshlarson left a comment

Choose a reason for hiding this comment

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

🐈‍⬛

@thecristen thecristen merged commit a0214c0 into main Feb 5, 2025
17 checks passed
@thecristen thecristen deleted the cbj/trip-planner-input-errors branch February 5, 2025 22:38
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