Skip to content
Open
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
3 changes: 2 additions & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ config :laboratory,
{:new_timetables, "New timetables",
"Uses the new timetable component and logic for all timetables"},
{:use_smartling_translations, "Smartling translations",
"Uses Smartling's translation workflows"}
"Uses Smartling's translation workflows"},
{:fares_v2, "Fares v2", "Exposes information from GTFS Fares V2 in trip plans"}
],
cookie: [
# one month,
Expand Down
3 changes: 2 additions & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ config :laboratory,
features: [
{:test_flag, "Cool Bean", "cool bean for test"},
{:use_smartling_translations, "Smartling translations",
"Uses Smartling's translation workflows"}
"Uses Smartling's translation workflows"},
{:fares_v2, "Fares v2", "Exposes information from GTFS Fares V2 in trip plans"}
],
cookie: [
# one month,
Expand Down
24 changes: 24 additions & 0 deletions lib/dotcom_web/components/trip_planner/itinerary_summary.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ defmodule DotcomWeb.Components.TripPlanner.ItinerarySummary do
attr :itinerary, Itinerary, required: true
attr :show_accessible, :boolean, default: false
attr :summarized_legs, :list, doc: "If not provided, will be derived from the itinerary"
attr :fares_v2, :any, default: nil

def itinerary_summary(assigns) do
itinerary_fare = fare(assigns.itinerary)
Expand Down Expand Up @@ -92,6 +93,29 @@ defmodule DotcomWeb.Components.TripPlanner.ItinerarySummary do
{@price}
</div>
</div>
<div :if={@fares_v2} class="flex gap-x-md text-xs font-sans">
<div :for={
leg_fare <- Enum.filter(@itinerary.legs, & &1.transit_leg) |> Enum.map(& &1.fare_products)
}>
<div class="flex flex-col gap-y-sm bg-charcoal-80">
<div
:for={product_fare <- leg_fare}
class="bg-charcoal-90 text-black p-xs border-charcoal-70 border-xs"
>
<p class="font-black">{product_fare.name}</p>
{product_fare.usd_price} ({product_fare.medium_name})
<div :if={product_fare.dependencies != []} class="bg-emerald-90 p-xs">
<p class="font-black">With prior fare</p>
<ul class="px-sm">
<li :for={dependency <- product_fare.dependencies}>
{dependency.name} ({dependency.medium_name})
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
"""
end
Expand Down
12 changes: 10 additions & 2 deletions lib/dotcom_web/components/trip_planner/results.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ defmodule DotcomWeb.Components.TripPlanner.Results do
attr :results, :any
attr :class, :string, default: ""
attr :accessible_grouping?, :boolean
attr :fares_v2, :any, default: nil

def results(assigns) do
~H"""
Expand Down Expand Up @@ -46,6 +47,7 @@ defmodule DotcomWeb.Components.TripPlanner.Results do
results={@results}
accessible_grouping?={@accessible_grouping?}
feedback_url={@feedback_url}
fares_v2={@fares_v2}
/>
</div>
</section>
Expand All @@ -55,6 +57,7 @@ defmodule DotcomWeb.Components.TripPlanner.Results do
attr :feedback_url, :string, default: nil
attr :results, :any
attr :accessible_grouping?, :boolean
attr :fares_v2, :any, default: nil

defp itinerary_panel(%{results: %{loading?: true}} = assigns) do
~H"""
Expand All @@ -73,6 +76,7 @@ defmodule DotcomWeb.Components.TripPlanner.Results do
<.itinerary_groups
feedback_url={@feedback_url}
indexed_groups={Enum.with_index(@results.itinerary_groups)}
fares_v2={@fares_v2}
/>
"""
end
Expand Down Expand Up @@ -123,19 +127,20 @@ defmodule DotcomWeb.Components.TripPlanner.Results do
class="mb-md"
show_accessible
feedback_url={@feedback_url}
fares_v2={@fares_v2}
/>
<% end %>
<%= if @accessible_count > 0 do %>
<.group_header text={
~t(1 Accessible Route | %{count} Accessible Routes | #{@accessible_count})p
} />
<.itinerary_groups indexed_groups={@accessible_groups} show_accessible />
<.itinerary_groups indexed_groups={@accessible_groups} show_accessible fares_v2={@fares_v2} />
<% end %>
<%= if @inaccessible_count > 0 do %>
<.group_header text={
~t(1 Inaccessible Route | %{count} Inaccessible Routes | #{@inaccessible_count})p
} />
<.itinerary_groups indexed_groups={@inaccessible_groups} show_accessible />
<.itinerary_groups indexed_groups={@inaccessible_groups} show_accessible fares_v2={@fares_v2} />
<% end %>
"""
end
Expand Down Expand Up @@ -187,6 +192,7 @@ defmodule DotcomWeb.Components.TripPlanner.Results do
attr :show_accessible, :boolean, default: false
attr :class, :string, default: ""
attr :feedback_url, :string, default: nil
attr :fares_v2, :any, default: nil

defp itinerary_groups(assigns) do
assigns =
Expand All @@ -203,6 +209,7 @@ defmodule DotcomWeb.Components.TripPlanner.Results do
index={index}
show_accessible={@show_accessible}
feedback_url={@feedback_url}
fares_v2={@fares_v2}
/>
</div>
</div>
Expand Down Expand Up @@ -274,6 +281,7 @@ defmodule DotcomWeb.Components.TripPlanner.Results do
summarized_legs={@group.summary}
itinerary={@group.representative_itinerary}
show_accessible={@show_accessible}
fares_v2={@fares_v2}
/>
<div class="flex justify-end items-center mt-3">
<div :if={@group.alternatives_text} class="grow text-sm text-grey-dark">
Expand Down
1 change: 1 addition & 0 deletions lib/dotcom_web/live/trip_planner_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ defmodule DotcomWeb.TripPlannerLive do
results={@results}
accessible_grouping?={@accessible_grouping?}
feedback_url={@trip_planner_feedback_url}
fares_v2={@fares_v2}
/>
<.live_component
module={MbtaMetro.Live.Map}
Expand Down
5 changes: 3 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ defmodule DotCom.Mixfile do
{:ex_machina, "2.8.0", only: [:dev, :test]},
{:ex_unit_summary, "0.2.0", only: [:dev, :test]},
{:excoveralls, "0.18.5", only: :test},
{:faker, "0.19.0-alpha.1"},
{:faker, "0.19.0-alpha.1", override: true},
{:floki, "0.38.0"},
{:flame_on, "~> 1.0", only: [:dev]},
{:gen_stage, "1.3.2"},
Expand All @@ -152,7 +152,8 @@ defmodule DotCom.Mixfile do
{:nebulex_redis_adapter, "2.4.2"},
{
:open_trip_planner_client,
[github: "mbta/open_trip_planner_client", tag: "v0.18.0"]
[github: "mbta/open_trip_planner_client", branch: "cbj/add-fares"]
# [github: "mbta/open_trip_planner_client", tag: "v0.18.0"]
},
{:parallel_stream, "1.1.0"},
{:phoenix, "1.8.6", override: true},
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"nimble_ownership": {:hex, :nimble_ownership, "1.0.2", "fa8a6f2d8c592ad4d79b2ca617473c6aefd5869abfa02563a77682038bf916cf", [:mix], [], "hexpm", "098af64e1f6f8609c6672127cfe9e9590a5d3fcdd82bc17a377b8692fd81a879"},
"nimble_parsec": {:hex, :nimble_parsec, "1.4.2", "8efba0122db06df95bfaa78f791344a89352ba04baedd3849593bfce4d0dc1c6", [:mix], [], "hexpm", "4b21398942dda052b403bbe1da991ccd03a053668d147d53fb8c4e0efe09c973"},
"nimble_pool": {:hex, :nimble_pool, "1.1.0", "bf9c29fbdcba3564a8b800d1eeb5a3c58f36e1e11d7b7fb2e084a643f645f06b", [:mix], [], "hexpm", "af2e4e6b34197db81f7aad230c1118eac993acc0dae6bc83bac0126d4ae0813a"},
"open_trip_planner_client": {:git, "https://github.com/mbta/open_trip_planner_client.git", "f2f961dd2d0a8989c8ed7297230de985d16711d4", [tag: "v0.18.0"]},
"open_trip_planner_client": {:git, "https://github.com/mbta/open_trip_planner_client.git", "5ca0647ddb65cc151bddb1ef88e746a14282a9d7", [branch: "cbj/add-fares"]},
"parallel_stream": {:hex, :parallel_stream, "1.1.0", "f52f73eb344bc22de335992377413138405796e0d0ad99d995d9977ac29f1ca9", [:mix], [], "hexpm", "684fd19191aedfaf387bbabbeb8ff3c752f0220c8112eb907d797f4592d6e871"},
"parse_trans": {:hex, :parse_trans, "3.4.1", "6e6aa8167cb44cc8f39441d05193be6e6f4e7c2946cb2759f015f8c56b76e5ff", [:rebar3], [], "hexpm", "620a406ce75dada827b82e453c19cf06776be266f5a67cff34e1ef2cbb60e49a"},
"phoenix": {:hex, :phoenix, "1.8.6", "7106a0da114619c4b12b056bbaef39fdbc75d3d0cf9cf24af683364064c12dc3", [:mix], [{:bandit, "~> 1.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.7", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "d0d0b7931916c8196b6903a1efa118b5da28487e7a75ad32a54dfd77de59d421"},
Expand Down
Loading