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

refactor(TripPlannerForm): use LiveComponent #2173

Merged
merged 13 commits into from
Oct 3, 2024

Conversation

thecristen
Copy link
Collaborator

Asana Ticket: LiveView-compatible trip planner form inputs

This is primarily a refactor of the trip planner form, from using a functional component to a Phoenix.LiveComponent.

Highlights:

  • Improvements to validation: checks whether the field is touched before rendering any errors. Also should eagerly revalidate (e.g. as soon as you fill in the field the error will disappear, as opposed to leaving the error on screen until resubmitting the form)
  • Datetime selection
    • The datepicker toggles visibility when choosing between now/arrive/depart
    • The form will always set the chosen datetime to the current date and time if "now" is selected, otherwise it'll validate whether the datetime is in the past
  • Mode selection
    • Verifies whether at least one mode is present
    • Adjusts the accordion text based on selected modes

Other changes:

  • Uses several components from MbtaMetro, so this PR installs and sets this up as well.
    • Adjusts our Tailwind configuration:
      • Follows the guidance from MbtaMetro
      • Adds two class names to the blocklist since they conflict with our existing Bootstrap styles in terrible ways
      • Adds important: true
    • Thanks to the prior two bulletpoints: our CSS now imports the base Tailwind CSS
    • Removes our CoreComponents
  • Sets up Phoenix verified routes so I can use ~p in a test

assets/css/app.scss Outdated Show resolved Hide resolved
@thecristen thecristen added the dev-blue Deploy to dev-blue label Sep 27, 2024
@thecristen thecristen removed the dev-blue Deploy to dev-blue label Sep 27, 2024
@thecristen thecristen merged commit 097b1cf into main Oct 3, 2024
17 checks passed
@thecristen thecristen deleted the cbj/trip-planner-input-form branch October 3, 2024 17:14
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