Skip to content

Commit 233c327

Browse files
authored
Merge pull request Sofie-Automation#1523 from bbc/upstream/feat/additional-layinfo-on-hover
Feat: additional Layer info on hover previews
2 parents bf677a9 + 95c3942 commit 233c327

File tree

8 files changed

+373
-72
lines changed

8 files changed

+373
-72
lines changed

meteor/server/publications/pieceContentStatusUI/checkPieceContentStatus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ export async function checkPieceContentStatusAndDependencies(
241241
blacks: [],
242242
scenes: [],
243243

244-
thumbnailUrl: undefined,
244+
thumbnailUrl: '/dev/fakeThumbnail.png',
245245
previewUrl: '/dev/fakePreview.mp4',
246246

247247
packageName: null,

packages/blueprints-integration/src/previews.ts

Lines changed: 135 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,60 @@
1-
import { SplitsContentBoxContent, SplitsContentBoxProperties } from './content.js'
1+
/**
2+
* This file defines the types for content previews that can be returned from blueprints.
3+
*/
4+
import { SourceLayerType, SplitsContentBoxContent, SplitsContentBoxProperties } from './content.js'
25
import { NoteSeverity } from './lib.js'
36
import { ITranslatableMessage } from './translations.js'
47

8+
/**
9+
* Optional container for preview content with optional warnings and additional content.
10+
* If not added to a piece, the core will use the default preview handling.
11+
*
12+
* @example
13+
* ```ts
14+
* import { TablePreview, PreviewType } from 'blueprints-integration';
15+
* const preview: TablePreview = {
16+
* type: PreviewType.Table,
17+
* entries: [ { key: 'Title', value: 'My Piece' } ],
18+
* displayTiming: true,
19+
* // the additionalPreviewContent can contain any number of content items of various types
20+
* additionalPreviewContent: [
21+
* {
22+
* type: 'script',
23+
* script: 'console.log("Hello World")',
24+
* },
25+
* { type: 'separationLine' },
26+
* {
27+
* type: 'layerInfo',
28+
* layerType: SourceLayerType.Graphics,
29+
* text: ['Breaking News: Something happened!'],
30+
* inTime: 0,
31+
* duration: 5000
32+
* },
33+
* {
34+
* type: 'layerInfo',
35+
* layerType: SourceLayerType.Graphics,
36+
* text: ['Person Name - Title'],
37+
* inTime: 1000,
38+
* duration: 3000
39+
* },
40+
* { type: 'separationLine' },
41+
* {
42+
* type: 'iframe',
43+
* href: 'https://example.com/preview', // Could be an external URL or a local server serving live preview content
44+
* }
45+
* ]
46+
* };
47+
* return { preview };
48+
* ```
49+
*/
550
export interface PopupPreview<P extends Previews = Previews> {
651
name?: string
752
preview?: P
853
warnings?: InvalidPreview[]
54+
/**
55+
* Add custom content preview content
56+
*/
57+
additionalPreviewContent?: Array<PreviewContent>
958
}
1059
export type Previews = TablePreview | ScriptPreview | HTMLPreview | SplitPreview | VTPreview | BlueprintImagePreview
1160

@@ -19,22 +68,99 @@ export enum PreviewType {
1968
BlueprintImage = 'blueprintImage',
2069
}
2170

71+
/**
72+
* Additional preview content that can be added to a PopupPreview.
73+
* Supports various content types: iframe, image, video, script, title, inOutWords, layerInfo, separationLine, and data.
74+
* The purpose of this is to allow blueprints to provide extra preview content for pieces, e.g. showing script text,
75+
* Lower3rd GFX information, images, an iFrame with a live preview or other relevant information.
76+
* These preview content types are the same that are used in thedefault PreviewPopUp component in the web UI.
77+
*/
78+
export type PreviewContent =
79+
| {
80+
/** Embed an iframe with optional postMessage communication */
81+
type: 'iframe'
82+
href: string
83+
postMessage?: any
84+
dimensions?: { width: number; height: number }
85+
}
86+
| {
87+
/** Display an image */
88+
type: 'image'
89+
src: string
90+
}
91+
| {
92+
/** Display a video player */
93+
type: 'video'
94+
src: string
95+
}
96+
| {
97+
/** Show script content with timing words and metadata */
98+
type: 'script'
99+
script?: string
100+
firstWords?: string
101+
lastWords?: string
102+
comment?: string
103+
lastModified?: number
104+
}
105+
| {
106+
/** Display a title heading */
107+
type: 'title'
108+
content: string
109+
}
110+
| {
111+
/** Show in/out timing words */
112+
type: 'inOutWords'
113+
in?: string
114+
out: string
115+
}
116+
| {
117+
/** Display layer information with timing
118+
* Used for showing information about a specific source layer, such as graphics or lower thirds.
119+
* The inTime, outTime, and duration is for information only and can be specified as
120+
* numbers (milliseconds) or strings (e.g. "00:00:05:00" for 5 seconds).
121+
* They are optional, and if not specified, the layer info is shown without timing.
122+
*/
123+
type: 'layerInfo'
124+
layerType: SourceLayerType
125+
text: Array<string>
126+
inTime?: number | string
127+
outTime?: number | string
128+
duration?: number | string
129+
}
130+
| {
131+
/** Add a visual separator line */
132+
type: 'separationLine'
133+
}
134+
| {
135+
/** Display key-value data pairs
136+
* this is a basic data preview where the key is the Label and the value is the value
137+
* the layerInfo should preferably be used for layer specific information and color
138+
*/
139+
type: 'data'
140+
content: { key: string; value: string }[]
141+
}
142+
22143
interface PreviewBase {
23144
type: PreviewType
24145
}
25146

147+
/** Indicates an invalid preview with a severity level and reason */
26148
export interface InvalidPreview extends PreviewBase {
27149
type: PreviewType.Invalid
28150

29151
severity: NoteSeverity
30152
reason: ITranslatableMessage
31153
}
154+
155+
/** Display a table of key-value pairs, optionally with timing information */
32156
export interface TablePreview extends PreviewBase {
33157
type: PreviewType.Table
34158

35159
entries: { key: string; value: string }[]
36160
displayTiming: boolean
37161
}
162+
163+
/** Show script text with last words, comments, and last modified time */
38164
export interface ScriptPreview extends PreviewBase {
39165
type: PreviewType.Script
40166

@@ -43,6 +169,8 @@ export interface ScriptPreview extends PreviewBase {
43169
comment?: string
44170
lastModified?: number
45171
}
172+
173+
/** Embed a custom HTML preview via URL, with optional steps and dimensions */
46174
export interface HTMLPreview extends PreviewBase {
47175
// todo - expose if and how steps can be controlled
48176
type: PreviewType.HTML
@@ -56,12 +184,16 @@ export interface HTMLPreview extends PreviewBase {
56184

57185
steps?: { current: number; total: number }
58186
}
187+
188+
/** Show a split screen with multiple content boxes (e.g. for multi-camera or multi-source content) */
59189
export interface SplitPreview extends PreviewBase {
60190
type: PreviewType.Split
61191

62192
background?: string // file asset upload?
63193
boxes: (SplitsContentBoxContent & SplitsContentBoxProperties)[]
64194
}
195+
196+
/** Video Tape preview with in/out words for timing */
65197
export interface VTPreview extends PreviewBase {
66198
type: PreviewType.VT
67199

@@ -71,6 +203,8 @@ export interface VTPreview extends PreviewBase {
71203
inWords?: string // note - only displayed if outWords are present
72204
outWords?: string
73205
}
206+
207+
/** Show an image asset as a preview */
74208
export interface BlueprintImagePreview extends PreviewBase {
75209
type: PreviewType.BlueprintImage
76210

1.13 MB
Loading

packages/webui/src/client/styles/shelf/dashboard-rundownView.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
}
1212

1313
.dashboard-panel__panel__button {
14+
margin-top: 10px;
15+
height: 110px;
16+
max-width: 170px !important;
1417
> .dashboard-panel__panel__button__content {
1518
display: grid;
1619
grid-template-columns: 1fr min-content;
@@ -31,7 +34,7 @@
3134

3235
> .dashboard-panel__panel__button__thumbnail {
3336
position: relative;
34-
height: auto;
37+
height: 85px;
3538
z-index: 1;
3639
overflow: hidden;
3740
grid-column: auto / span 2;

0 commit comments

Comments
 (0)