diff --git a/lib/dotcom_web/components/system_status/widget.ex b/lib/dotcom_web/components/system_status/widget.ex
new file mode 100644
index 0000000000..223eebfb80
--- /dev/null
+++ b/lib/dotcom_web/components/system_status/widget.ex
@@ -0,0 +1,74 @@
+defmodule DotcomWeb.SystemStatus.Widget do
+ @moduledoc """
+
+ A component that renders the given `@statuses` in a table.
+
+ """
+
+ use DotcomWeb, :component
+
+ @route_ids ["Red", "Orange", "Green", "Blue"]
+
+ def system_status_widget(assigns) do
+ assigns = assigns |> assign(:route_ids, @route_ids)
+
+ ~H"""
+
+ <.line_status
+ :for={route_id <- @route_ids}
+ route_id={route_id}
+ branches_with_statuses={@routes_with_statuses |> Map.get(route_id)}
+ />
+
+ """
+ end
+
+ defp line_status(assigns) do
+ ~H"""
+
+ <.branch_status
+ :for={branch <- @branches_with_statuses}
+ route_id={@route_id}
+ branch_ids={branch.branch_ids}
+ status_entries={branch.status_entries}
+ />
+
+ """
+ end
+
+ defp branch_status(assigns) do
+ ~H"""
+
<.alert :for={alert <- @alerts} alert={alert} />
@@ -30,12 +36,6 @@ defmodule DotcomWeb.Live.SystemStatus do
"""
end
- defp status(assigns) do
- ~H"""
-
{inspect @status, pretty: true}
- """
- end
-
defp alert(assigns) do
~H"""
@@ -49,4 +49,54 @@ defmodule DotcomWeb.Live.SystemStatus do
"""
end
+
+ defp fake_statuses_1() do
+ %{
+ "Blue" => [
+ %{
+ branch_ids: [],
+ status_entries: [%{time: :current, status: :normal, multiple: false}]
+ }
+ ],
+ "Orange" => [
+ %{
+ branch_ids: [],
+ status_entries: [
+ %{time: :current, status: :delay, multiple: false},
+ %{
+ time: {:future, Timex.now() |> Timex.set(hour: 20, minute: 30)},
+ status: :shuttle,
+ multiple: false
+ }
+ ]
+ }
+ ],
+ "Red" => [
+ %{
+ branch_ids: [],
+ status_entries: [%{time: :current, status: :normal, multiple: false}]
+ },
+ %{
+ branch_ids: ["Mattapan"],
+ status_entries: [%{time: :current, status: :suspension, multiple: false}]
+ }
+ ],
+ "Green" => [
+ %{
+ branch_ids: ["Green-D", "Green-E"],
+ status_entries: [
+ %{
+ time: {:future, Timex.now() |> Timex.set(hour: 18, minute: 0)},
+ status: :station_closure,
+ multiple: true
+ }
+ ]
+ },
+ %{
+ branch_ids: ["Green-B", "Green-C"],
+ status_entries: [%{time: :current, status: :normal, multiple: false}]
+ }
+ ]
+ }
+ end
end