From f75a704b33cbb5247e83e7940ef06f5b8ef34124 Mon Sep 17 00:00:00 2001 From: Cora Grant Date: Tue, 29 Oct 2024 16:34:21 -0400 Subject: [PATCH] chore: remove display of V1 screen types We no longer have any "V1" screens in the wild. This removes most references to these screen types and prevents any that still exist in the config from being shown. Some internal references remain (mostly in the Places builder), which can be cleaned up once `screens-config-lib` removes the config structs for these screens and they have been deleted from all live environments. --- assets/css/screen-simulation.scss | 58 ------------------- assets/js/components/Dashboard/PlaceRow.tsx | 5 -- .../Dashboard/PlaceRowAccordion.tsx | 2 +- .../Dashboard/ScreenDetailHeader.tsx | 20 +------ .../components/Dashboard/ScreenSimulation.tsx | 22 ++----- assets/js/constants/constants.ts | 11 ++-- assets/js/util.ts | 5 -- .../Dashboard/PlacesActionBar.test.tsx | 8 +-- .../components/placeRowAccordion.test.tsx | 4 +- assets/tests/places_and_screens.test.json | 18 +++--- lib/screenplay/permanent_config.ex | 12 ---- 11 files changed, 27 insertions(+), 138 deletions(-) diff --git a/assets/css/screen-simulation.scss b/assets/css/screen-simulation.scss index 77c379e68..bbabdf7f9 100644 --- a/assets/css/screen-simulation.scss +++ b/assets/css/screen-simulation.scss @@ -4,41 +4,6 @@ margin-top: 16px; overflow: hidden; - // The below values are "height of the iframe's container", which is different than the iframe content - - // V2 apps don't need the height set - - &--bus_eink, - &--gl_eink_double { - height: 480px; - width: 180px; - background-color: white; - box-shadow: 0px 0px 32px 0px #00000040; - margin-bottom: 12px; - } - - &--gl_eink_single { - height: 240px; - width: 180px; - background-color: white; - box-shadow: 0px 0px 32px 0px #00000040; - margin-bottom: 12px; - } - - &--pa_ess { - min-height: 100px; - display: flex; - justify-content: center; - padding-bottom: 20px; - } - - &--solari { - height: 344px; - width: 194px; - box-shadow: 0px 0px 32px 0px #00000040; - margin-bottom: 12px; - } - .screen-simulation__iframe { // DUP, PreFare, Bus Shelter, and Eink v2s all could have scrollbars, // so height adjusted to fit @@ -59,22 +24,6 @@ height: 515px; } - &--bus_eink, - &--gl_eink_double { - height: 3200px; - width: 1200px; - transform: scale(15%); - transform-origin: top left; - } - - &--gl_eink_single { - height: 1600px; - width: 1200px; - transform: scale(15%); - transform-origin: top left; - } - - &--dup, &--dup_v2 { height: 195px; } @@ -83,12 +32,5 @@ height: 80px; width: 250px; } - - &--solari { - height: 1920px; - width: 1080px; - transform: scale(17.92%); - transform-origin: top left; - } } } diff --git a/assets/js/components/Dashboard/PlaceRow.tsx b/assets/js/components/Dashboard/PlaceRow.tsx index c1b23a4e1..8ca1ce469 100644 --- a/assets/js/components/Dashboard/PlaceRow.tsx +++ b/assets/js/components/Dashboard/PlaceRow.tsx @@ -22,14 +22,9 @@ const typeMap: Record = { pa_ess: "PA", bus_shelter_v2: "Bus Shelter", pre_fare_v2: "Prefare", - dup: "DUP", dup_v2: "DUP", - gl_eink_single: "GL E-Ink", - gl_eink_double: "GL E-Ink", gl_eink_v2: "GL E-Ink", - bus_eink: "Bus E-Ink", bus_eink_v2: "Bus E-Ink", - solari: "Sectional", busway_v2: "Sectional", elevator_v2: "Elevator", }; diff --git a/assets/js/components/Dashboard/PlaceRowAccordion.tsx b/assets/js/components/Dashboard/PlaceRowAccordion.tsx index 173f2113e..8c363f632 100644 --- a/assets/js/components/Dashboard/PlaceRowAccordion.tsx +++ b/assets/js/components/Dashboard/PlaceRowAccordion.tsx @@ -23,7 +23,7 @@ type ScreenGroup = { }; const groupScreens = (screens: Screen[]): ScreenGroup[] => { - const inlineScreenTypes = ["busway_v2", "solari", "elevator_v2"]; + const inlineScreenTypes = ["busway_v2", "elevator_v2"]; const inlineScreens = screens.filter((screen) => inlineScreenTypes.includes(screen.type), diff --git a/assets/js/components/Dashboard/ScreenDetailHeader.tsx b/assets/js/components/Dashboard/ScreenDetailHeader.tsx index 2009608da..28220ebb7 100644 --- a/assets/js/components/Dashboard/ScreenDetailHeader.tsx +++ b/assets/js/components/Dashboard/ScreenDetailHeader.tsx @@ -17,7 +17,7 @@ const ScreenDetailHeader = (props: ScreenDetailHeaderProps): JSX.Element => {
{props.translatedScreenType} {props.screenLocation} - {["dup", "dup_v2"].includes(props.screen.type) && ( + {props.screen.type === "dup_v2" && (
Cycle in the ad loop for 7.5 seconds every 45 seconds
@@ -31,26 +31,12 @@ const ScreenDetailHeader = (props: ScreenDetailHeaderProps): JSX.Element => { ); }; -const generateSource = (screen: Screen) => { - const { id, type } = screen; - // @ts-ignore Suppressing "object could be null" warning +const generateSource = ({ id }: Screen) => { const screensUrl = document .querySelector("meta[name=screens-url]") ?.getAttribute("content"); - if (type.includes("v2")) { - return `${screensUrl}/v2/screen/${id}`; - } - if (["bus_eink", "gl_eink_single", "gl_eink_double"].includes(type)) { - return `${screensUrl}/screen/${id}`; - } - if (type === "solari") { - // Solari app disables scrolling unless this param is added. - // (Due to quirks of running on a very old browser in the past) - return `${screensUrl}/screen/${id}?scroll=true`; - } - - return ""; + return `${screensUrl}/v2/screen/${id}`; }; export default ScreenDetailHeader; diff --git a/assets/js/components/Dashboard/ScreenSimulation.tsx b/assets/js/components/Dashboard/ScreenSimulation.tsx index 3891e8ba4..bd5254eff 100644 --- a/assets/js/components/Dashboard/ScreenSimulation.tsx +++ b/assets/js/components/Dashboard/ScreenSimulation.tsx @@ -28,29 +28,15 @@ const ScreenSimulation = ({ ); }; -const generateSource = (screen: Screen, isPending: boolean) => { - const { id, type } = screen; - // @ts-ignore Suppressing "object could be null" warning +const generateSource = ({ id, type }: Screen, isPending: boolean) => { const screensUrl = document .querySelector("meta[name=screens-url]") ?.getAttribute("content"); const queryParams = "requestor=screenplay"; - if (type.includes("v2")) { - return `${screensUrl}/v2/screen${ - isPending ? "/pending/" : "/" - }${id}/simulation?${queryParams}`; - } - if ( - ["bus_eink", "gl_eink_single", "gl_eink_double", "solari"].includes(type) - ) { - return `${screensUrl}/screen/${id}?${queryParams}`; - } - if (type === "dup") { - return `${screensUrl}/screen/${id}/simulation?${queryParams}`; - } - - return ""; + return `${screensUrl}/v2/screen${ + isPending ? "/pending/" : "/" + }${id}/simulation?${queryParams}`; }; export default ScreenSimulation; diff --git a/assets/js/constants/constants.ts b/assets/js/constants/constants.ts index 9a54d2e19..3fe70b479 100644 --- a/assets/js/constants/constants.ts +++ b/assets/js/constants/constants.ts @@ -44,16 +44,13 @@ export const SORT_LABELS: Record = { export const SCREEN_TYPES: { label: string; ids: string[] }[] = [ { label: "All SCREEN TYPES", ids: ["All"] }, { label: "Bus Shelter", ids: ["bus_shelter_v2"] }, - { label: "DUP", ids: ["dup", "dup_v2"] }, - { label: "E-Ink: Bus", ids: ["bus_eink", "bus_eink_v2"] }, - { - label: "E-Ink: Green Line", - ids: ["gl_eink_single", "gl_eink_double", "gl_eink_v2"], - }, + { label: "DUP", ids: ["dup_v2"] }, + { label: "E-Ink: Bus", ids: ["bus_eink_v2"] }, + { label: "E-Ink: Green Line", ids: ["gl_eink_v2"] }, { label: "Elevator", ids: ["elevator_v2"] }, { label: "PA ESS", ids: ["pa_ess"] }, { label: "Pre Fare Duo", ids: ["pre_fare_v2"] }, - { label: "Sectional", ids: ["busway_v2", "solari"] }, + { label: "Sectional", ids: ["busway_v2"] }, ]; export const STATUSES = [ diff --git a/assets/js/util.ts b/assets/js/util.ts index 26abddff0..5f63dc907 100644 --- a/assets/js/util.ts +++ b/assets/js/util.ts @@ -201,15 +201,10 @@ export const signsByDirection = (signs: Screen[]) => { }; const screenTypeOrder = [ - "dup", "dup_v2", "busway_v2", - "solari", "bus_shelter_v2", - "bus_eink", "bus_eink_v2", - "gl_eink_single", - "gl_eink_double", "gl_eink_v2", "pre_fare_v2", "elevator_v2", diff --git a/assets/tests/components/Dashboard/PlacesActionBar.test.tsx b/assets/tests/components/Dashboard/PlacesActionBar.test.tsx index d47441d50..8e88beaf5 100644 --- a/assets/tests/components/Dashboard/PlacesActionBar.test.tsx +++ b/assets/tests/components/Dashboard/PlacesActionBar.test.tsx @@ -10,8 +10,8 @@ describe("PlacesActionBar", () => { routes: ["CR", "Red", "Green-B"], status: "Auto", screens: [ - { id: "1111", type: "dup", disabled: false }, - { id: "2222", type: "solari", disabled: false }, + { id: "1111", type: "dup_v2", disabled: false }, + { id: "2222", type: "busway_v2", disabled: false }, { id: "3333", type: "bus_shelter_v2", disabled: false }, ], }; @@ -22,9 +22,9 @@ describe("PlacesActionBar", () => { routes: ["Green-B"], status: "Auto", screens: [ - { id: "4444", type: "gl_eink_double", disabled: false }, + { id: "4444", type: "gl_eink_v2", disabled: false }, // screen is shared with place-stop1 - { id: "2222", type: "solari", disabled: false }, + { id: "2222", type: "busway_v2", disabled: false }, { id: "5555", type: "paess", disabled: false }, ], }; diff --git a/assets/tests/components/placeRowAccordion.test.tsx b/assets/tests/components/placeRowAccordion.test.tsx index 65fe211eb..a26196a35 100644 --- a/assets/tests/components/placeRowAccordion.test.tsx +++ b/assets/tests/components/placeRowAccordion.test.tsx @@ -19,8 +19,8 @@ describe("PlaceRowAccordion", () => { routes: ["CR", "Red", "Green-B"], status: "Auto", screens: [ - { id: "1111", type: "dup", disabled: false }, - { id: "2222", type: "solari", disabled: false }, + { id: "1111", type: "dup_v2", disabled: false }, + { id: "2222", type: "busway_v2", disabled: false }, { id: "3333", type: "bus_shelter_v2", disabled: false }, ], }; diff --git a/assets/tests/places_and_screens.test.json b/assets/tests/places_and_screens.test.json index 927d5935a..ef0feafa0 100644 --- a/assets/tests/places_and_screens.test.json +++ b/assets/tests/places_and_screens.test.json @@ -23,7 +23,7 @@ "name": "Davis", "routes": ["Bus", "Red"], "screens": [ - { "disabled": false, "id": "Landscape255", "type": "dup" }, + { "disabled": false, "id": "Landscape255", "type": "dup_v2" }, { "id": "davis_mezzanine", "station_code": "RDAV", @@ -101,7 +101,7 @@ "name": "Malden Center", "routes": ["Bus", "CR", "Orange"], "screens": [ - { "disabled": false, "id": "DUP-Malden", "type": "dup" }, + { "disabled": false, "id": "DUP-Malden", "type": "dup_v2" }, { "id": "malden_lobby", "station_code": "OMAL", @@ -312,7 +312,7 @@ "name": "Haymarket", "routes": ["Green-D", "Green-E", "Orange"], "screens": [ - { "disabled": false, "id": "DUP-Haymarket", "type": "dup" }, + { "disabled": false, "id": "DUP-Haymarket", "type": "dup_v2" }, { "id": "orange_haymarket_mezzanine", "station_code": "OHAY", @@ -532,7 +532,7 @@ { "disabled": false, "id": "EIB-101", - "type": "bus_eink" + "type": "bus_eink_v2" } ] }, @@ -544,22 +544,22 @@ { "disabled": true, "id": "EIG-401", - "type": "gl_eink_single" + "type": "gl_eink_v2" }, { "disabled": false, "id": "EIG-404", - "type": "gl_eink_single" + "type": "gl_eink_v2" }, { "disabled": true, "id": "EIG-403", - "type": "gl_eink_single" + "type": "gl_eink_v2" }, { "disabled": true, "id": "EIG-402", - "type": "gl_eink_single" + "type": "gl_eink_v2" } ] }, @@ -571,7 +571,7 @@ { "disabled": false, "id": "MUL-101", - "type": "solari" + "type": "busway_v2" }, { "disabled": false, diff --git a/lib/screenplay/permanent_config.ex b/lib/screenplay/permanent_config.ex index d67e169a5..dc7297f59 100644 --- a/lib/screenplay/permanent_config.ex +++ b/lib/screenplay/permanent_config.ex @@ -453,18 +453,6 @@ defmodule Screenplay.PermanentConfig do screen.app_params.alerts.stop_id end - defp screen_to_place_id(screen = %Screen{app_id: :gl_eink_single}) do - screen.app_params.stop_id - end - - defp screen_to_place_id(%Screen{app_id: solari_v1_app}) - when solari_v1_app in [:solari, :solari_large] do - # Solari screens frequently show info for multiple stop IDs in different sections. - # (Try `jq '.screens | map_values(select(.app_id == "solari")) | map_values(.app_params.sections | map(.query.params.stop_ids))' git/screens/priv/local.json` in your shell to see) - # So there isn't a straightforward implementation for that case, at the moment. - raise("screen_to_place_id/1 not implemented for app_id: #{solari_v1_app}") - end - defp screen_to_place_id(%Screen{app_id: app_id}), do: raise("screen_to_place_id/1 not implemented for app_id: #{app_id}") end