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

Polished date picker implementation #2195

Merged
merged 12 commits into from
Oct 23, 2024
Merged

Conversation

anthonyshull
Copy link
Contributor

It looks like there are some slight conflicts between the CSS that Cristen did in her polish PR and the changes I made in mine. I figure we can work those out after the big pieces are done being built. Another outstanding task is getting the default date of the date picker to be "now" in East Coast time. This is only a problem for people not on the East Coast, but something we should fix. We can do that in a separate task since it will necessitate a new release of Metro.

@anthonyshull anthonyshull requested a review from a team as a code owner October 11, 2024 16:55
@@ -25,7 +24,7 @@ defmodule Dotcom.TripPlan.InputForm do
typed_embedded_schema do
embeds_one(:from, __MODULE__.Location)
embeds_one(:to, __MODULE__.Location)
field(:datetime_type, Ecto.Enum, values: @time_types)
field(:datetime_type, :string)
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 changed this for now because we need to have a way to navigate between these atoms and the string we're given back by the form. We can figure this out later.

Copy link
Collaborator

Choose a reason for hiding this comment

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

the atom/string juggling was definitely my least favorite part about trying to handle mode changes too...

@@ -31,7 +31,7 @@ defmodule DotcomWeb.Components.LiveComponents.TripPlannerForm do
assign(socket, %{
form: form,
location_keys: InputForm.Location.fields(),
show_datepicker: input_value(form, :datetime_type) != :now
show_datepicker: false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

📓 This is always false for now until we implement some way to load a plan.

@@ -220,6 +220,12 @@
}
}

#date-picker-calendar {
.form-control[readonly] {
background-color: $body-bg;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

📓 Bootstrap was setting this to grey so we need this override.

Copy link
Collaborator

@thecristen thecristen left a comment

Choose a reason for hiding this comment

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

Works well! Some additional polish notes:

  • There's a bit too much space between the timepicker and the buttons, and I think it's due to some margins added to all lists via Dotcom's CSS. If you add mb-0 to the input group's <ul> tag that'll help.
  • The timepicker input should have the same border width as the buttons, right now it's a lot thicker
  • The calendar icon position is a little wonky, also ought to be blue rather than low-contrast grey

Comment on lines -28 to -43
date_input = ~s(name="input_form[datetime]")
refute html =~ date_input

html =
view
|> element("input[value=arrive_by]")
|> render_click()

assert html =~ date_input

html =
view
|> element("input[value=now]")
|> render_click()

refute html =~ date_input
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'm removing these until this stabilizes and we can test the entire form.

Comment on lines -81 to -86
html =
view
|> element("form")
|> render_submit()

assert html =~ "Please add a destination."
Copy link
Contributor Author

Choose a reason for hiding this comment

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

📓 Same here. I think we'll want to figure out our final error display approach before writing these tests.

@anthonyshull anthonyshull merged commit 88751c7 into main Oct 23, 2024
17 checks passed
@anthonyshull anthonyshull deleted the ags/polished-date-picker branch October 23, 2024 16:03
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