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(TripPlanner.Results): various small things #2307

Merged
merged 4 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/dotcom_web/components/trip_planner/itinerary_summary.ex
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ defmodule DotcomWeb.Components.TripPlanner.ItinerarySummary do
attr(:routes, :list, required: true, doc: "List of %Routes.Route{}")
attr(:walk_minutes, :integer, required: true)

# No routes
# No routes: this is a walking leg
defp leg_icon(%{routes: [], walk_minutes: _} = assigns) do
~H"""
<span class={[
"flex items-center gap-1 text-sm font-semibold leading-none whitespace-nowrap py-1 px-2 rounded-full border border-solid border-gray-light",
"flex items-center gap-1 text-sm font-semibold leading-none whitespace-nowrap py-1 px-2 rounded-full border-[1px] border-gray-light",
Copy link
Contributor

Choose a reason for hiding this comment

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

This is bugging me, because according to Tailwind's docs, border should do the same thing as border-[1px], but it's not!

@class
]}>
<.icon name="person-walking" class="h-4 w-4" />
Expand Down
7 changes: 6 additions & 1 deletion lib/dotcom_web/components/trip_planner/results.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ defmodule DotcomWeb.Components.TripPlanner.Results do
<div
:for={{%{summary: summary}, index} <- Enum.with_index(@results.itinerary_groups)}
class="border border-solid border-gray-lighter p-4"
phx-click="select_itinerary_group"
phx-value-index={index}
>
<div
:if={summary.tag}
Expand All @@ -52,7 +54,10 @@ defmodule DotcomWeb.Components.TripPlanner.Results do
<.itinerary_summary summary={summary} />
<div class="flex justify-end items-center">
<div :if={Enum.count(summary.next_starts) > 0} class="grow text-sm text-grey-dark">
Similar trips depart at {Enum.map(
Similar {if(Enum.count(summary.next_starts) == 1,
do: "trip departs",
else: "trips depart"
)} at {Enum.map(
summary.next_starts,
&Timex.format!(&1, "%-I:%M", :strftime)
)
Expand Down
4 changes: 2 additions & 2 deletions lib/dotcom_web/components/trip_planner/results_summary.ex
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ defmodule DotcomWeb.Components.TripPlanner.ResultsSummary do
defp time_summary(%{datetime: datetime, datetime_type: datetime_type}) do
preamble = if datetime_type == "arrive_by", do: "Arriving by ", else: "Leaving at "
time_description = Timex.format!(datetime, "{h12}:{m}{am}")
date_description = Timex.format!(datetime, "{WDfull}, {Mfull} {D}")
preamble <> time_description <> " on " <> date_description
date_description = Timex.format!(datetime, "{WDfull}, {Mfull} ")
preamble <> time_description <> " on " <> date_description <> Inflex.ordinalize(datetime.day)
end
end
Loading