Skip to content

Commit

Permalink
chore: remove support for v1 screen types
Browse files Browse the repository at this point in the history
We no longer have any "v1" screens configured.
  • Loading branch information
digitalcora committed Nov 1, 2024
1 parent a7fa4e0 commit f7895a8
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 172 deletions.
58 changes: 0 additions & 58 deletions assets/css/screen-simulation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
Expand All @@ -83,12 +32,5 @@
height: 80px;
width: 250px;
}

&--solari {
height: 1920px;
width: 1080px;
transform: scale(17.92%);
transform-origin: top left;
}
}
}
5 changes: 0 additions & 5 deletions assets/js/components/Dashboard/PlaceRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,9 @@ const typeMap: Record<string, string> = {
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",
};
Expand Down
2 changes: 1 addition & 1 deletion assets/js/components/Dashboard/PlaceRowAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
20 changes: 3 additions & 17 deletions assets/js/components/Dashboard/ScreenDetailHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const ScreenDetailHeader = (props: ScreenDetailHeaderProps): JSX.Element => {
<div className="screen-detail__header">
<div className={classNames("screen-detail__screen-type-location")}>
{props.translatedScreenType} {props.screenLocation}
{["dup", "dup_v2"].includes(props.screen.type) && (
{props.screen.type === "dup_v2" && (
<div className="screen-detail__dup-ad-text">
Cycle in the ad loop for 7.5 seconds every 45 seconds
</div>
Expand All @@ -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;
22 changes: 4 additions & 18 deletions assets/js/components/Dashboard/ScreenSimulation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }: 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;
11 changes: 4 additions & 7 deletions assets/js/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,13 @@ export const SORT_LABELS: Record<string, [string, string]> = {
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 = [
Expand Down
5 changes: 0 additions & 5 deletions assets/js/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions assets/tests/components/Dashboard/PlacesActionBar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
],
};
Expand All @@ -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 },
],
};
Expand Down
4 changes: 2 additions & 2 deletions assets/tests/components/placeRowAccordion.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
],
};
Expand Down
18 changes: 9 additions & 9 deletions assets/tests/places_and_screens.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -532,7 +532,7 @@
{
"disabled": false,
"id": "EIB-101",
"type": "bus_eink"
"type": "bus_eink_v2"
}
]
},
Expand All @@ -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"
}
]
},
Expand All @@ -571,7 +571,7 @@
{
"disabled": false,
"id": "MUL-101",
"type": "solari"
"type": "busway_v2"
},
{
"disabled": false,
Expand Down
12 changes: 0 additions & 12 deletions lib/screenplay/permanent_config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading

0 comments on commit f7895a8

Please sign in to comment.