Skip to content

Commit

Permalink
[feature] Store triptych psas (#1845)
Browse files Browse the repository at this point in the history
* Test PSAs uploaded, to be replaced

* New local evergreen widget backend

* Split-pane support for triptychs frontend

* Make conversion of filename to slot_name more robust; pluralize config key

* Seed :rand with current time / 15

* Evergreen takes conditional prop for video playing

* Hook determines if app is onscreen to decide if video should be playing

* feat: Add admin config columns (thus far) for triptych app (#1841)

* fix: Handle unrecognized screen IDs in `screen_name_for_id` (#1842)

* Send and log version in data requests from OFM clients

* Always include logging params for triptych, even if we fail to determine pane

* Add a new log fn for unrecognized triptych player name (#1844)

* Accommodate various psa file types

* Log when PSA file retrieval fails

* Use stricter positioning for the panes

* Added new config boolean to allow for conditionally display version and playername.

* Added a couple of font mixins.

* Added identifiers to TrainCrowding.

* Added an EvergreenContent component for Triptychs. Just a wrapper of the OG with identifiers.

* Allowed props to only change when needed.

* Changed where identifiers are rendered for PSAs.

* Add remaining admin columns for triptych config

* Fix header font color for crowding widget (#1848)

* Bring box-shadow of key to foreground (#1849)

* Default to first folder of psas if needed

* Set evergreen image size

* Replace test psas with real ones

---------

Co-authored-by: Christian Maddox <christian.maddox93@gmail.com>
Co-authored-by: Jon Zimbel <jzimbel@mbta.com>
  • Loading branch information
3 people authored Sep 5, 2023
1 parent 52cc71a commit 27e2c39
Show file tree
Hide file tree
Showing 23 changed files with 433 additions and 55 deletions.
14 changes: 14 additions & 0 deletions assets/css/triptych_v2.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
line-height: 118px;
}

@mixin font--caption-2 {
font-size: 32px;
font-weight: 600;
line-height: 40px;
}

@mixin font--caption-3 {
font-size: 32px;
font-weight: 700;
line-height: 40px;
}

// Top level stuff
@import "v2/triptych/screen_container";
@import "v2/triptych/viewport";
Expand All @@ -47,6 +59,8 @@
@import "v2/outfront_common/debug";
@import "v2/triptych/debug";

@import "v2/triptych/evergreen";

body {
margin: 0px;
font-family: Inter, sans-serif;
Expand Down
10 changes: 10 additions & 0 deletions assets/css/v2/train_crowding.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
}
&__body {
display: flex;
position: relative;
flex-direction: column;
height: 920px;
background-color: #d9d6d0;
Expand Down Expand Up @@ -38,6 +39,7 @@
.crowding-widget__header__destination-sentence {
@include font--heading-3;
margin-top: auto;
color: #FFFFFF;
.destination {
padding-left: 109px;
}
Expand All @@ -50,6 +52,7 @@
display: flex;
flex-direction: column;
justify-content: space-between;
position: relative;
}

.crowding-widget__footer__key-row {
Expand All @@ -61,6 +64,13 @@
}
}

.crowding-widget__footer__identifiers {
@include font--caption-2;
position: absolute;
bottom: 18px;
right: 24px;
}

.crowding-widget__train-row {
display: flex;
justify-content: space-between;
Expand Down
20 changes: 20 additions & 0 deletions assets/css/v2/triptych/evergreen.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.left-pane,
.middle-pane,
.right-pane {
.evergreen-content__identifiers {
position: absolute;
bottom: 0;
right: 0;
background-color: rgba(23, 31, 38, 0.7);
@include font--caption-3;
color: white;
text-align: right;
padding: 12px 24px 18px 24px;
}
}

.evergreen-content-image__image,
.evergreen-content-video.looping-video {
width: 1080px;
height: 1920px;
}
18 changes: 18 additions & 0 deletions assets/css/v2/triptych/screen_container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,21 @@
margin: 0px auto;
overflow: hidden;
}

.left-pane,
.middle-pane,
.right-pane {
overflow: hidden;
position: absolute;
width: 1080px;
height: 1920px;
top: 0;
}

.middle-pane {
left: 1080px;
}

.right-pane {
left: 2160px;
}
8 changes: 7 additions & 1 deletion assets/src/apps/v2/triptych.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,25 @@ import SimulationScreenPage from "Components/v2/simulation_screen_page";
import Viewport from "Components/v2/triptych/viewport";

import FullScreen from "Components/v2/basic_layouts/full_screen";
import TriptychThreePane from "Components/v2/triptych/triptych_three_pane";

import PageLoadNoData from "Components/v2/triptych/page_load_no_data";
import NoData from "Components/v2/triptych/no_data";

import Placeholder from "Components/v2/placeholder";
import TrainCrowding from "Components/v2/train_crowding";
import OutfrontEvergreenContent from "Components/v2/outfront_evergreen_content";

const TYPE_TO_COMPONENT = {
// Layouts
screen_normal: FullScreen,
placeholder: Placeholder,
screen_split: TriptychThreePane,
// Components
page_load_no_data: PageLoadNoData,
no_data: NoData,
train_crowding: TrainCrowding,
evergreen_content: OutfrontEvergreenContent,
placeholder: Placeholder,
};

const LOADING_LAYOUT = {
Expand Down
37 changes: 37 additions & 0 deletions assets/src/components/admin/admin_tables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,30 @@ const v2Columns = [
},
];

const screenIDColumn = {
Header: "Screen ID",
accessor: "id",
Filter: DefaultColumnFilter,
FormCell: FormStaticCell,
};

const screenNameColumn = {
Header: "Name",
accessor: "name",
Cell: EditableCell,
Filter: DefaultColumnFilter,
FormCell: FormTextCell,
};

const evergreenContentColumn = {
Header: "Evergreen Content",
accessor: buildAppParamAccessor("evergreen_content"),
mutator: buildAppParamMutator("evergreen_content"),
Cell: EditableTextarea,
disableFilters: true,
FormCell: FormTextarea,
};

const alertsColumn = {
Header: "Alerts",
accessor: buildAppParamAccessor("alerts"),
Expand Down Expand Up @@ -705,6 +729,15 @@ const localEvergreenSetsColumn = {
FormCell: FormTextarea,
};

const showIdentifiersColumn = {
Header: "Show Version & Player Name?",
accessor: buildAppParamAccessor("show_identifiers"),
mutator: buildAppParamMutator("show_identifiers"),
Cell: EditableCheckbox,
Filter: DefaultColumnFilter,
FormCell: FormBoolean,
}

const PreFareV2ScreensTable = (): JSX.Element => {
const dataFilter = ({ app_id }) => {
return app_id === "pre_fare_v2";
Expand Down Expand Up @@ -783,8 +816,12 @@ const TriptychV2ScreensTable = (): JSX.Element => {
return (
<AdminTable
columns={[
screenIDColumn,
screenNameColumn,
trainCrowdingColumn,
localEvergreenSetsColumn,
evergreenContentColumn,
showIdentifiersColumn
]}
dataFilter={dataFilter}
/>
Expand Down
23 changes: 14 additions & 9 deletions assets/src/components/v2/evergreen_content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,41 @@ const VIDEO_EXTENSIONS = ["mp4", "ogg", "ogv", "webm"];

interface Props {
asset_url: string;
isPlaying?: boolean;
}

const EvergreenContent: ComponentType<Props> = ({ asset_url: assetUrl }) => {
const EvergreenContent: ComponentType<Props> = ({
asset_url: assetUrl,
isPlaying = true,
}) => {
const parts = assetUrl.split(".");
const extension = parts[parts.length - 1].toLowerCase();

if (IMAGE_EXTENSIONS.includes(extension)) {
return <Image assetUrl={assetUrl} />;
} else if (VIDEO_EXTENSIONS.includes(extension)) {
return <Video assetUrl={assetUrl} />;
return <Video assetUrl={assetUrl} isPlaying={isPlaying} />;
}
return null;
};

interface ProperProps {
assetUrl: string;
}

const Image: ComponentType<ProperProps> = ({ assetUrl }) => {
const Image: ComponentType<{ assetUrl: string }> = ({ assetUrl }) => {
return (
<div className="evergreen-content-image__container">
<img className="evergreen-content-image__image" src={assetUrl} />
</div>
);
};

const Video: ComponentType<ProperProps> = ({ assetUrl }) => {
interface VideoProps {
assetUrl: string;
isPlaying: boolean;
}

const Video: ComponentType<VideoProps> = ({ assetUrl, isPlaying }) => {
return (
<div className="evergreen-content-video">
<LoopingVideoPlayer src={assetUrl} isPlaying />
<LoopingVideoPlayer src={assetUrl} isPlaying={isPlaying} />
</div>
);
};
Expand Down
27 changes: 27 additions & 0 deletions assets/src/components/v2/outfront_evergreen_content.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React, { ComponentType } from "react";

import EvergreenContent from "./evergreen_content";
import useIsOnScreen from "Hooks/v2/use_is_on_screen";
import { imagePath } from "Util/util";
import { TRIPTYCH_VERSION } from "./triptych/version";
import { usePlayerName } from "Hooks/outfront";

const OutfrontEvergreenContent: ComponentType<{
asset_url: string;
show_identifiers: boolean;
}> = ({ asset_url: assetUrl, show_identifiers: showIdentifiers }) => {
const dupReadyUrl = imagePath(assetUrl);
const isPlaying = useIsOnScreen();
const playerName = usePlayerName();
let identifiers = `${TRIPTYCH_VERSION} ${playerName ? playerName : ""}`;
return (
<>
<EvergreenContent asset_url={dupReadyUrl} isPlaying={isPlaying} />
{showIdentifiers && (
<div className="evergreen-content__identifiers">{identifiers}</div>
)}
</>
);
};

export default OutfrontEvergreenContent;
Loading

0 comments on commit 27e2c39

Please sign in to comment.