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

Output cleanup #2298

Merged
merged 10 commits into from
Jan 3, 2025
Merged

Output cleanup #2298

merged 10 commits into from
Jan 3, 2025

Conversation

Comment on lines 27 to 32
<%= if @summary.accessible? do %>
<.icon type="icon-svg" name="icon-accessible-small" class="h-3 w-3 mr-0.5" /> Accessible
<% else %>
<.icon type="icon-svg" name="icon-not-accessible-small" class="h-3 w-3 mr-0.5" /> May not be accessible
<% end %>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

📓 Shows the accessible icon or the not accessible icon.

Comment on lines +38 to +43
<% price = Fares.Format.price(@summary.total_cost) %>
<div :if={price != ""} class="inline-flex items-center gap-0.5">
<.icon name="circle" class="h-0.5 w-0.5 mx-1" />
<.icon name="wallet" class="h-3 w-3" />
{Fares.Format.price(@summary.total_cost)}
{price}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

📓 If the price is nil then "" will be returned. If the price is 0 then "Free" will be returned. If we get "" then we don't show the element.

Comment on lines +49 to +53
<div class="w-full py-5">
<.leg_summary leg={@leg} alerts={@alerts.route} />
<.leg_details leg={@leg} />
</div>
<% else %>
<details class="w-full my-3 group/stops">
<details class="w-full py-5 group/stops">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

📓 We just wanted more padding here.

@@ -32,7 +32,7 @@ defmodule DotcomWeb.Components.TripPlanner.WalkingLeg do
</div>
<details class="border-y border-x-0 border-gray-lightest my-3 w-full group">
<summary class="flex w-full gap-x-3.5 py-3">
<summary class="flex w-full gap-x-3.5 py-3 cursor-pointer">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

📓 Gives us a cursor pointer on the accordion header.

Comment on lines 109 to 120
@impl true
# Triggered when we cannot connect to OTP.
def handle_async("get_itinerary_groups", {:ok, {:error, %Req.TransportError{reason: :econnrefused}}}, socket) do
message = "Cannot connect to OpenTripPlanner. Please try again later."
new_socket = assign(socket, :results, Map.put(@state.results, :error, message))

{:noreply, new_socket}
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

📓 No ticket for this, I just noticed that if OTP is unreachable, we didn't have a way to handle it.

Comment on lines 318 to 323
diff = Timex.diff(datetime, future, :minutes)

if datetime_type != "now" && Timex.before?(datetime, future) do
if datetime_type != "now" && diff < 0 do
push_event(socket, "set-datetime", %{datetime: future})
else
socket
assign(socket, :input_form, Map.put(socket.assigns.input_form, :changeset, Map.put(socket.assigns.input_form.changeset, :datetime, datetime)))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

📓 Looks at the old and new time according to the minute so that it doesn't reset if they are just seconds apart...which will happen if we take now two separate times.

@anthonyshull anthonyshull marked this pull request as ready for review January 3, 2025 14:46
@anthonyshull anthonyshull requested a review from a team as a code owner January 3, 2025 14:46
@anthonyshull anthonyshull added the dev-green Deploy to dev-green label Jan 3, 2025
@@ -54,5 +54,9 @@ defmodule DotcomWeb.Components.TripPlanner.Place do
"""
end

defp format_time(datetime), do: Timex.format!(datetime, "%-I:%M %p", :strftime)
defp format_time(datetime) do
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion: we should make this public somewhere and reuse it in here, DotcomWeb.Components.TripPlanner.ItinerarySummary, and DotcomWeb.Components.TripPlanner.ItineraryDetail

# Triggered when we cannot connect to OTP.
def handle_async(
"get_itinerary_groups",
{:ok, {:error, %Req.TransportError{reason: :econnrefused}}},
Copy link
Collaborator

Choose a reason for hiding this comment

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

thanks for catching!

@anthonyshull anthonyshull merged commit 66d5fa6 into main Jan 3, 2025
21 checks passed
@anthonyshull anthonyshull deleted the ags/output-cleanup branch January 3, 2025 19:32
@github-actions github-actions bot removed the dev-green Deploy to dev-green label Jan 3, 2025
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