diff --git a/assets/src/components/v2/departures.tsx b/assets/src/components/v2/departures.tsx index e54ed550d..a10432128 100644 --- a/assets/src/components/v2/departures.tsx +++ b/assets/src/components/v2/departures.tsx @@ -8,7 +8,6 @@ import React, { import weakKey from "weak-key"; import NormalSection from "./departures/normal_section"; -import NoticeSection from "./departures/notice_section"; import { Section, trimSections, toFoldedSection } from "./departures/section"; import { warn } from "Util/sentry"; @@ -45,13 +44,7 @@ const Departures: ComponentType = ({ sections }) => { return (
{foldedSections.map((section) => { - const key = weakKey(section); - - if (section.type === "folded_section") { - return ; - } else { - return ; - } + return ; })}
); diff --git a/assets/src/components/v2/departures/notice_section.tsx b/assets/src/components/v2/departures/notice_section.tsx deleted file mode 100644 index 08295f0a4..000000000 --- a/assets/src/components/v2/departures/notice_section.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { ComponentType } from "react"; - -import { FreeTextType } from "Components/v2/free_text"; - -type NoticeSection = { - text: FreeTextType; -}; - -const NoticeSection: ComponentType = () => { - return null; -}; - -export default NoticeSection; diff --git a/assets/src/components/v2/departures/section.ts b/assets/src/components/v2/departures/section.ts index 3b0afa056..0231e6fba 100644 --- a/assets/src/components/v2/departures/section.ts +++ b/assets/src/components/v2/departures/section.ts @@ -5,15 +5,10 @@ import type { NormalSection, FoldedNormalSection, } from "./normal_section"; -import NoticeSection from "./notice_section"; -export type Section = - | (NormalSection & { type: "normal_section" }) - | (NoticeSection & { type: "notice_section" }); +export type Section = NormalSection & { type: "normal_section" }; -export type FoldedSection = - | (FoldedNormalSection & { type: "folded_section" }) - | (NoticeSection & { type: "notice_section" }); +export type FoldedSection = FoldedNormalSection & { type: "folded_section" }; export const toFoldedSection = (section: Section): FoldedSection => { switch (section.type) { @@ -36,9 +31,6 @@ export const toFoldedSection = (section: Section): FoldedSection => { return foldedSection; } - - case "notice_section": - return section; } }; diff --git a/assets/src/components/v2/dup/departures.tsx b/assets/src/components/v2/dup/departures.tsx index 0f5a289af..ce74c6631 100644 --- a/assets/src/components/v2/dup/departures.tsx +++ b/assets/src/components/v2/dup/departures.tsx @@ -2,7 +2,6 @@ import React, { ComponentType } from "react"; import { type Section as SectionBase } from "Components/v2/departures/section"; import NormalSection from "./departures/normal_section"; -import NoticeSection from "Components/v2/departures/notice_section"; import HeadwaySection from "./departures/headway_section"; import NoDataSection from "./departures/no_data_section"; import OvernightSection from "./departures/overnight_section"; @@ -25,8 +24,6 @@ const Departures: ComponentType = ({ sections }) => { switch (section.type) { case "normal_section": return ; - case "notice_section": - return ; case "headway_section": return ; case "no_data_section": diff --git a/assets/tests/components/v2/departures/section.test.ts b/assets/tests/components/v2/departures/section.test.ts index 53428df2f..7c6e2121c 100644 --- a/assets/tests/components/v2/departures/section.test.ts +++ b/assets/tests/components/v2/departures/section.test.ts @@ -5,7 +5,6 @@ import _ from "lodash/fp"; import { toFoldedSection, trimSections, - type FoldedSection, } from "Components/v2/departures/section"; import { departureRow, normalSection, timeWithCrowding } from "./factories"; @@ -31,17 +30,6 @@ describe("trimSections", () => { const buildFoldedSection = (attrs) => toFoldedSection(normalSection.build(attrs)); - test("does nothing with notice sections", () => { - const sections: FoldedSection[] = [ - { - type: "notice_section", - text: { text: [{ text: "text" }] }, - }, - ]; - - expect(trimSections(sections)).toBe(sections); - }); - test("trims one departure from the largest section above its `base`", () => { const rowsB = departureRow.buildList(5); const [rowB1, rowB2, rowB3, rowB4, ...trimmedB] = rowsB; diff --git a/lib/screens/v2/widget_instance/departures.ex b/lib/screens/v2/widget_instance/departures.ex index 0bff84c05..10444be66 100644 --- a/lib/screens/v2/widget_instance/departures.ex +++ b/lib/screens/v2/widget_instance/departures.ex @@ -24,11 +24,6 @@ defmodule Screens.V2.WidgetInstance.Departures do header: Header.t() } - @type notice_section :: %{ - type: :notice_section, - text: FreeTextLine.t() - } - @type headway_section :: %{ type: :headway_section, route: :red | :orange | :green | :blue, @@ -55,7 +50,6 @@ defmodule Screens.V2.WidgetInstance.Departures do section_data: list( normal_section() - | notice_section() | headway_section() | overnight_section() | no_data_section() @@ -103,10 +97,6 @@ defmodule Screens.V2.WidgetInstance.Departures do def serialize_section(section, screen, now, is_only_section \\ false) - def serialize_section(%{type: :notice_section, text: text}, _screen, _now, _) do - %{type: :notice_section, text: text} - end - def serialize_section(%{type: :no_data_section, route: route}, _screen, _now, _) do text = %FreeTextLine{ icon: Route.icon(route), @@ -200,10 +190,6 @@ defmodule Screens.V2.WidgetInstance.Departures do %{type: :overnight_section, text: FreeTextLine.to_json(text)} end - def audio_serialize_section(%{type: :notice_section, text: text}, _screen, _now) do - %{type: :notice_section, text: FreeTextLine.to_plaintext(text)} - end - def audio_serialize_section( %{type: :normal_section, rows: departures, header: header}, screen, diff --git a/lib/screens_web/views/v2/audio/departures_view.ex b/lib/screens_web/views/v2/audio/departures_view.ex index a1650e8f7..4dbb4c009 100644 --- a/lib/screens_web/views/v2/audio/departures_view.ex +++ b/lib/screens_web/views/v2/audio/departures_view.ex @@ -13,10 +13,6 @@ defmodule ScreensWeb.V2.Audio.DeparturesView do end end - defp render_section(%{type: :notice_section, text: text}) do - ~E|

<%= text %>

| - end - defp render_section(%{type: :normal_section, header: header, departure_groups: departure_groups}) when is_binary(header) do ~E|

<%= header %>

<%= Enum.map(departure_groups, &render_departure_group/1) %>| diff --git a/test/screens/v2/widget_instance/departures_test.exs b/test/screens/v2/widget_instance/departures_test.exs index f4e349b7b..e9dc29367 100644 --- a/test/screens/v2/widget_instance/departures_test.exs +++ b/test/screens/v2/widget_instance/departures_test.exs @@ -65,13 +65,6 @@ defmodule Screens.V2.WidgetInstance.DeparturesTest do } = Departures.serialize_section(section, bus_shelter_screen, now) end - test "returns serialized notice_section", %{bus_shelter_screen: bus_shelter_screen, now: now} do - section = %{type: :notice_section, text: %{icon: :warning, text: []}} - - assert %{type: :notice_section, text: %{icon: :warning, text: []}} == - Departures.serialize_section(section, bus_shelter_screen, now) - end - test "returns serialized normal_section with notice", %{ bus_shelter_screen: bus_shelter_screen, now: now