Skip to content

Commit

Permalink
feat: Triptych NoData/Loading (#1840)
Browse files Browse the repository at this point in the history
* Rename `isDup` -> `isOFM` since we now run on two different OFM screen types

* Triptych app setup + packaging instructions

* Working triptych app with viewport shifter

* Remove TODO--made an asana task for it

* Use matching param for triptych pane in data requests

* Cleanup and fix accidentally committed test code

* Working triptych frontend with new route + cleaned up OFM utilities

* Address credo complaints

* Use default simulation component for triptychs

* Add triptych player name mapping for tests

* fix: Tweak config so vscode can consistently resolve aliased import paths

* Remove a few console.logs that I missed

* Unclutter useBaseApiResponse and memoize logic that computes API url

* Add some missing config for the test env :doh:

* A no-op change in lib/, because the last commit didn't trigger CI for some reason??

* Revert "A no-op change in lib/, because the last commit didn't trigger CI for some reason??"

This reverts commit 88e5511.

* Revert "Revert "A no-op change in lib/, because the last commit didn't trigger CI for some reason??""

This reverts commit 7db3eae.

* Uncomment accidentally commented line of code

* Revert `isDUP` name to `isDup`

* Rename a few more isDUPs that the vscode refactor tool missed

* Run prettier

* Rename split-screen slots to left_, middle_, right_pane for consistency

* "Closed" -> "Car closed" per designs (plus some tweaks to avoid prettier making a mess of the existing code)

* Add packaging README section on communicating with Outfront

* Document `platform_position` value

* Adjust no-data/disabled templates to match new slot names

* New images.

* Changed loading and no_data to use new images.

---------

Co-authored-by: Jon Zimbel <[email protected]>
  • Loading branch information
cmaddox5 and jzimbel-mbta authored Aug 30, 2023
1 parent 0c1e7b0 commit 7731d29
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 20 deletions.
1 change: 0 additions & 1 deletion assets/src/apps/v2/triptych.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const LOADING_LAYOUT = {
const DISABLED_LAYOUT = {
full_screen: {
type: "no_data",
show_alternatives: true,
},
type: "screen_normal",
};
Expand Down
13 changes: 5 additions & 8 deletions assets/src/components/v2/triptych/no_data.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
import React, { ComponentType } from "react";
import LcdNoData from "Components/v2/lcd/no_data";
import { imagePath } from "Util/util";

interface Props {
show_alternatives: boolean;
}

const NoData: ComponentType<Props> = ({
show_alternatives: showAlternatives,
}) => {
// TODO: We likely want to show something different from the usual when we fail to fetch data for this screen type.
const NoData: ComponentType<Props> = () => {
return (
<>
<div className="no-data-left">
<LcdNoData show_alternatives={showAlternatives} />
<img src={imagePath("no-data-triptych.png")} />
</div>
<div className="no-data-middle">
<LcdNoData show_alternatives={showAlternatives} />
<img src={imagePath("no-data-triptych.png")} />
</div>
<div className="no-data-right">
<LcdNoData show_alternatives={showAlternatives} />
<img src={imagePath("no-data-triptych.png")} />
</div>
</>
);
Expand Down
8 changes: 4 additions & 4 deletions assets/src/components/v2/triptych/page_load_no_data.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import React, { ComponentType } from "react";
import LcdPageLoadNoData from "Components/v2/lcd/page_load_no_data";
import { imagePath } from "Util/util";

const PageLoadNoData: ComponentType = () => {
return (
<>
<div className="no-data-left">
<LcdPageLoadNoData />
<img src={imagePath("loading-triptych.png")} />
</div>
<div className="no-data-middle">
<LcdPageLoadNoData />
<img src={imagePath("loading-triptych.png")} />
</div>
<div className="no-data-right">
<LcdPageLoadNoData />
<img src={imagePath("loading-triptych.png")} />
</div>
</>
);
Expand Down
12 changes: 5 additions & 7 deletions assets/src/util/outfront.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const getTags = (): OFMTag[] | null => {
};

const arrayConfigurationToTriptychPane = (
arrayConfiguration: string | null,
arrayConfiguration: string | null
): TriptychPane | null => {
switch (arrayConfiguration) {
case "Triple-Left":
Expand Down Expand Up @@ -154,7 +154,7 @@ interface MRAID {
addEventListener(
eventID: EventID,
callback: () => void,
layoutID: LayoutID,
layoutID: LayoutID
): void;
EVENTS: { ONSCREEN: EventID };
}
Expand Down Expand Up @@ -205,9 +205,7 @@ export const __TEST_setFakeMRAID__ = (options: {

// Be noisy about it so that we don't accidentally ship a package that calls this function.
alert(
`Setting fake MRAID object for testing purposes: ${JSON.stringify(
options,
)}`,
`Setting fake MRAID object for testing purposes: ${JSON.stringify(options)}`
);

// Since `window.parent.parent.parent...` returns itself if the window does not have a parent, we can just set the mraid object
Expand All @@ -224,7 +222,7 @@ const BASE_MRAID: Pick<MRAID, "EVENTS" | "requestInit" | "addEventListener"> = {
addEventListener(eventID, callback, layoutID) {
if (eventID == "fakeOnscreenEvent" && layoutID == "fakeLayoutID") {
console.log(
"FakeMRAID: Setting fake ONSCREEN event to fire in 3 seconds",
"FakeMRAID: Setting fake ONSCREEN event to fire in 3 seconds"
);

setTimeout(() => {
Expand All @@ -233,7 +231,7 @@ const BASE_MRAID: Pick<MRAID, "EVENTS" | "requestInit" | "addEventListener"> = {
}, 2000);
} else {
throw new Error(
"FakeMRAID: Stubbed addEventListener method expected eventID of 'fakeOnscreenEvent' and layoutID of 'fakeLayoutID'",
"FakeMRAID: Stubbed addEventListener method expected eventID of 'fakeOnscreenEvent' and layoutID of 'fakeLayoutID'"
);
}
},
Expand Down
Binary file added assets/static/images/loading-triptych.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/static/images/no-data-triptych.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7731d29

Please sign in to comment.