Skip to content

Commit

Permalink
chore: Add new fields to elevator widget (#44)
Browse files Browse the repository at this point in the history
* Added additional fields for alternate directions on elevators.

* Create new Arrow type for reuse.
  • Loading branch information
cmaddox5 authored Nov 21, 2024
1 parent c0db78e commit fff14c3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 13 deletions.
7 changes: 7 additions & 0 deletions lib/config/arrow.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
defmodule ScreensConfig.Arrow do
@moduledoc """
Represents an arrow direction to be displayed on screens.
"""

@type t :: :n | :ne | :e | :se | :s | :sw | :w | :nw | nil
end
6 changes: 3 additions & 3 deletions lib/config/v2/blue_bikes/station.ex
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
defmodule ScreensConfig.V2.BlueBikes.Station do
@moduledoc false

alias ScreensConfig.Arrow

@type t :: %__MODULE__{
id: String.t(),
arrow: arrow(),
arrow: Arrow.t(),
walk_distance_minutes: non_neg_integer(),
walk_distance_feet: non_neg_integer()
}

@type arrow :: :n | :ne | :e | :se | :s | :sw | :w | :nw | nil

@enforce_keys [:id, :arrow, :walk_distance_minutes, :walk_distance_feet]
defstruct @enforce_keys

Expand Down
4 changes: 3 additions & 1 deletion lib/config/v2/departures/header.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ defmodule ScreensConfig.V2.Departures.Header do
If `title` is not set, there is no visual header, but `read_as` is still read out, if set.
"""

alias ScreensConfig.Arrow

@type t :: %__MODULE__{
arrow: nil | :n | :ne | :e | :se | :s | :sw | :w | :nw,
arrow: Arrow.t(),
read_as: String.t() | nil,
title: String.t() | nil
}
Expand Down
16 changes: 12 additions & 4 deletions lib/config/v2/elevator.ex
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
defmodule ScreensConfig.V2.Elevator do
@moduledoc false

alias ScreensConfig.Arrow
alias ScreensConfig.V2.EvergreenContentItem

@type t :: %__MODULE__{
elevator_id: String.t(),
evergreen_content: list(EvergreenContentItem.t())
evergreen_content: list(EvergreenContentItem.t()),
alternate_direction_text: String.t(),
accessible_path_image_url: String.t(),
accessible_path_direction_arrow: Arrow.t()
}

@enforce_keys [:elevator_id]
defstruct elevator_id: nil,
evergreen_content: []
@enforce_keys [
:elevator_id,
:alternate_direction_text,
:accessible_path_image_url,
:accessible_path_direction_arrow
]
defstruct @enforce_keys ++ [evergreen_content: []]

use ScreensConfig.Struct,
children: [
Expand Down
8 changes: 3 additions & 5 deletions lib/config/v2/shuttle_bus_info.ex
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
defmodule ScreensConfig.V2.ShuttleBusInfo do
@moduledoc false

alias ScreensConfig.V2.ShuttleBusSchedule
alias ScreensConfig.V2.WidgetInstance
alias ScreensConfig.Arrow
alias ScreensConfig.V2.{ShuttleBusSchedule, WidgetInstance}

@type t :: %__MODULE__{
minutes_range_to_destination_schedule: list(ShuttleBusSchedule.t()),
destination: String.t(),
arrow: arrow(),
arrow: Arrow.t(),
english_boarding_instructions: String.t(),
spanish_boarding_instructions: String.t(),
audio_boarding_instructions: String.t(),
priority: WidgetInstance.priority(),
enabled: boolean()
}

@type arrow :: :n | :ne | :e | :se | :s | :sw | :w | :nw | nil

defstruct minutes_range_to_destination_schedule: [],
destination: nil,
arrow: nil,
Expand Down

0 comments on commit fff14c3

Please sign in to comment.