refactor: deprecate presenter and subtitle (#795)

* refactor: deprecate presenter and subtitle

* style: reduce spacing between related sections

* refactor: optional secondary field

* refactor: remove secondary field

* refactor: dynamic data source
This commit is contained in:
Carlos Valente
2024-02-29 18:19:58 +01:00
committed by GitHub
parent d7392b93d2
commit 8df419d835
51 changed files with 735 additions and 731 deletions
@@ -6,8 +6,6 @@ import { coerceString, coerceNumber, coerceBoolean, coerceColour } from '../util
// TODO: handle custom fields
const whitelistedPayload = {
title: coerceString,
subtitle: coerceString,
presenter: coerceString,
note: coerceString,
cue: coerceString,
@@ -10,8 +10,6 @@ import {
export const event: Omit<OntimeEvent, 'id' | 'delay' | 'cue'> = {
title: '',
subtitle: '',
presenter: '',
note: '',
endAction: EndAction.None,
timerType: TimerType.CountDown,
@@ -395,8 +395,6 @@ describe('calculateRuntimeDelays', () => {
const rundown: OntimeRundown = [
{
title: '',
subtitle: '',
presenter: '',
note: '',
endAction: EndAction.None,
timerType: TimerType.CountDown,
@@ -423,8 +421,6 @@ describe('calculateRuntimeDelays', () => {
},
{
title: '',
subtitle: '',
presenter: '',
note: '',
endAction: EndAction.None,
timerType: TimerType.CountDown,
@@ -451,8 +447,6 @@ describe('calculateRuntimeDelays', () => {
},
{
title: '',
subtitle: '',
presenter: '',
note: '',
endAction: EndAction.None,
timerType: TimerType.CountDown,
@@ -479,8 +473,6 @@ describe('calculateRuntimeDelays', () => {
},
{
title: '',
subtitle: '',
presenter: '',
note: '',
endAction: EndAction.None,
timerType: TimerType.CountDown,
@@ -516,8 +508,6 @@ describe('getDelayAt()', () => {
const delayedRundown: OntimeRundown = [
{
title: '',
subtitle: '',
presenter: '',
note: '',
endAction: EndAction.None,
timerType: TimerType.CountDown,
@@ -545,8 +535,6 @@ describe('getDelayAt()', () => {
},
{
title: '',
subtitle: '',
presenter: '',
note: '',
endAction: EndAction.None,
timerType: TimerType.CountDown,
@@ -574,8 +562,6 @@ describe('getDelayAt()', () => {
},
{
title: '',
subtitle: '',
presenter: '',
note: '',
endAction: EndAction.None,
timerType: TimerType.CountDown,
@@ -603,8 +589,6 @@ describe('getDelayAt()', () => {
},
{
title: '',
subtitle: '',
presenter: '',
note: '',
endAction: EndAction.None,
timerType: TimerType.CountDown,
@@ -658,8 +642,6 @@ describe('calculateRuntimeDelaysFrom()', () => {
const delayedRundown: OntimeRundown = [
{
title: '',
subtitle: '',
presenter: '',
note: '',
endAction: EndAction.None,
timerType: TimerType.CountDown,
@@ -687,8 +669,6 @@ describe('calculateRuntimeDelaysFrom()', () => {
},
{
title: '',
subtitle: '',
presenter: '',
note: '',
endAction: EndAction.None,
timerType: TimerType.CountDown,
@@ -716,8 +696,6 @@ describe('calculateRuntimeDelaysFrom()', () => {
},
{
title: '',
subtitle: '',
presenter: '',
note: '',
endAction: EndAction.None,
timerType: TimerType.CountDown,
@@ -745,8 +723,6 @@ describe('calculateRuntimeDelaysFrom()', () => {
},
{
title: '',
subtitle: '',
presenter: '',
note: '',
endAction: EndAction.None,
timerType: TimerType.CountDown,
@@ -24,8 +24,6 @@ describe('cellRequestFromEvent()', () => {
type: SupportedEvent.Event,
cue: '1',
title: 'Fancy',
subtitle: 'Wow',
presenter: 'Mr. Presenter',
note: 'Blue button on the right',
timeStart: 46800000,
timeEnd: 57600000,
@@ -47,8 +45,6 @@ describe('cellRequestFromEvent()', () => {
type: { row: 1, col: 14 },
cue: { row: 1, col: 15 },
title: { row: 1, col: 16 },
subtitle: { row: 1, col: 17 },
presenter: { row: 1, col: 18 },
note: { row: 1, col: 19 },
timeStart: { row: 1, col: 20 },
timeEnd: { row: 1, col: 21 },
@@ -72,8 +68,6 @@ describe('cellRequestFromEvent()', () => {
type: SupportedEvent.Event,
cue: '1',
title: 'Fancy',
subtitle: 'Wow',
presenter: 'Mr. Presenter',
note: 'Blue button on the right',
timeStart: 46800000,
timeEnd: 57600000,
@@ -95,8 +89,6 @@ describe('cellRequestFromEvent()', () => {
type: { row: 1, col: 14 },
cue: { row: 1, col: 15 },
title: { row: 1, col: 16 },
subtitle: { row: 1, col: 17 },
presenter: { row: 1, col: 18 },
note: { row: 1, col: 19 },
timeStart: { row: 1, col: 20 },
timeEnd: { row: 1, col: 21 },
@@ -121,8 +113,6 @@ describe('cellRequestFromEvent()', () => {
type: SupportedEvent.Event,
cue: '1',
title: 'Fancy',
subtitle: 'Wow',
presenter: 'Mr. Presenter',
note: 'Blue button on the right',
timeStart: 46800000,
timeEnd: 57600000,
@@ -144,8 +134,6 @@ describe('cellRequestFromEvent()', () => {
type: { row: 1, col: 14 },
cue: { row: 1, col: 15 },
title: { row: 1, col: 16 },
subtitle: { row: 1, col: 17 },
presenter: { row: 1, col: 18 },
note: { row: 1, col: 19 },
timeStart: { row: 1, col: 20 },
timeEnd: { row: 1, col: 21 },
@@ -170,8 +158,6 @@ describe('cellRequestFromEvent()', () => {
type: SupportedEvent.Event,
cue: '1',
title: 'Fancy',
subtitle: 'Wow',
presenter: 'Mr. Presenter',
note: 'Blue button on the right',
timeStart: 46800000,
timeEnd: 57600000,
@@ -192,12 +178,10 @@ describe('cellRequestFromEvent()', () => {
const metadata = {
cue: { row: 1, col: 0 },
title: { row: 1, col: 6 },
subtitle: { row: 1, col: 10 },
};
const result = cellRequestFromEvent(event, 1, 1234, metadata);
expect(result.updateCells.rows[0].values[0].userEnteredValue.stringValue).toStrictEqual(event.cue);
expect(result.updateCells.rows[0].values[6].userEnteredValue.stringValue).toStrictEqual(event.title);
expect(result.updateCells.rows[0].values[10].userEnteredValue.stringValue).toStrictEqual(event.subtitle);
});
test('metadata offset from zero', () => {
@@ -205,8 +189,6 @@ describe('cellRequestFromEvent()', () => {
type: SupportedEvent.Event,
cue: '1',
title: 'Fancy',
subtitle: 'Wow',
presenter: 'Mr. Presenter',
note: 'Blue button on the right',
timeStart: 46800000,
timeEnd: 57600000,
@@ -227,13 +209,11 @@ describe('cellRequestFromEvent()', () => {
const metadata = {
cue: { row: 1, col: 5 },
title: { row: 1, col: 6 },
subtitle: { row: 1, col: 10 },
user0: { row: 1, col: 16 },
};
const result = cellRequestFromEvent(event, 1, 1234, metadata);
expect(result.updateCells.rows[0].values[0].userEnteredValue.stringValue).toStrictEqual(event.cue);
expect(result.updateCells.rows[0].values[1].userEnteredValue.stringValue).toStrictEqual(event.title);
expect(result.updateCells.rows[0].values[5].userEnteredValue.stringValue).toStrictEqual(event.subtitle);
});
test('sheet setup', () => {
@@ -241,8 +221,6 @@ describe('cellRequestFromEvent()', () => {
type: SupportedEvent.Event,
cue: '1',
title: 'Fancy',
subtitle: 'Wow',
presenter: 'Mr. Presenter',
note: 'Blue button on the right',
timeStart: 46800000,
timeEnd: 57600000,
@@ -263,7 +241,6 @@ describe('cellRequestFromEvent()', () => {
const metadata = {
cue: { row: 10, col: 5 },
title: { row: 10, col: 6 },
subtitle: { row: 1, col: 10 },
};
const result1 = cellRequestFromEvent(event, 1, 1234, metadata);
expect(result1.updateCells.start.sheetId).toStrictEqual(1234);
@@ -28,8 +28,6 @@ describe('test json parser with valid def', () => {
cue: 'Guest Welcoming',
type: SupportedEvent.Event,
title: 'Guest Welcoming',
subtitle: '',
presenter: '',
note: '',
endAction: EndAction.PlayNext,
timerType: TimerType.Clock,
@@ -51,8 +49,6 @@ describe('test json parser with valid def', () => {
cue: 'Good Morning',
type: SupportedEvent.Event,
title: 'Good Morning',
subtitle: 'Days schedule',
presenter: 'Carlos Valente',
note: '',
endAction: EndAction.PlayNext,
timerType: TimerType.CountUp,
@@ -74,8 +70,6 @@ describe('test json parser with valid def', () => {
cue: 'Stage 2 setup',
type: SupportedEvent.Event,
title: 'Stage 2 setup',
subtitle: '',
presenter: '',
note: '',
endAction: 'wrong action' as EndAction, // testing
timerType: TimerType.Clock,
@@ -98,8 +92,6 @@ describe('test json parser with valid def', () => {
cue: 'Working Procedures',
type: SupportedEvent.Event,
title: 'Working Procedures',
subtitle: '',
presenter: 'Filip Johansen',
note: '',
endAction: EndAction.None,
timerType: TimerType.Clock,
@@ -118,8 +110,6 @@ describe('test json parser with valid def', () => {
cue: 'Lunch',
title: 'Lunch',
type: SupportedEvent.Event,
subtitle: '',
presenter: '',
note: '',
endAction: EndAction.None,
timerType: TimerType.Clock,
@@ -141,8 +131,6 @@ describe('test json parser with valid def', () => {
cue: 'A day being carlos',
title: 'A day being carlos',
type: SupportedEvent.Event,
subtitle: 'My life in a song',
presenter: 'Carlos Valente',
note: '',
endAction: EndAction.None,
timerType: TimerType.Clock,
@@ -165,8 +153,6 @@ describe('test json parser with valid def', () => {
cue: 'Hamburgers and Cheese',
title: 'Hamburgers and Cheese',
type: SupportedEvent.Event,
subtitle: '... and other life questions',
presenter: 'Filip Johansen',
note: '',
endAction: EndAction.None,
timerType: TimerType.Clock,
@@ -470,8 +456,6 @@ describe('test event validator', () => {
expect(validated).toEqual(
expect.objectContaining({
title: expect.any(String),
subtitle: expect.any(String),
presenter: expect.any(String),
note: expect.any(String),
timeStart: expect.any(Number),
timeEnd: expect.any(Number),
@@ -496,15 +480,11 @@ describe('test event validator', () => {
it('makes objects strings', () => {
const event = {
title: 2,
subtitle: true,
presenter: 3.2,
note: '1899-12-30T08:00:10.000Z',
};
// @ts-expect-error -- we know this is wrong, testing imports outside domain
const validated = createEvent(event, 'not-used');
expect(typeof validated.title).toEqual('string');
expect(typeof validated.subtitle).toEqual('string');
expect(typeof validated.presenter).toEqual('string');
expect(typeof validated.note).toEqual('string');
});
@@ -697,8 +677,6 @@ describe('test import of v2 datamodel', () => {
id: expect.any(String),
cue: expect.any(String),
title: expect.any(String),
subtitle: expect.any(String),
presenter: expect.any(String),
note: expect.any(String),
endAction: expect.any(String),
timerType: expect.any(String),
@@ -757,8 +735,6 @@ describe('getCustomFieldData()', () => {
duration: 'duration',
cue: 'cue',
title: 'title',
presenter: 'presenter',
subtitle: 'subtitle',
isPublic: 'public',
skip: 'skip',
note: 'notes',
@@ -811,8 +787,6 @@ describe('parseExcel()', () => {
'Time Start',
'Time End',
'Title',
'Presenter',
'Subtitle',
'End Action',
'Timer type',
'Public',
@@ -835,8 +809,6 @@ describe('parseExcel()', () => {
'1899-12-30T07:00:00.000Z',
'1899-12-30T08:00:10.000Z',
'Guest Welcome',
'Carlos',
'Getting things started',
'',
'',
'x',
@@ -859,8 +831,6 @@ describe('parseExcel()', () => {
'1899-12-30T08:00:00.000Z',
'1899-12-30T08:30:00.000Z',
'A song from the hearth',
'Still Carlos',
'Derailing early',
'load-next',
'clock',
'',
@@ -904,8 +874,6 @@ describe('parseExcel()', () => {
//timeStart: 28800000,
//timeEnd: 32410000,
title: 'Guest Welcome',
presenter: 'Carlos',
subtitle: 'Getting things started',
timerType: 'count-down',
endAction: 'none',
isPublic: true,
@@ -931,8 +899,6 @@ describe('parseExcel()', () => {
//timeStart: 32400000,
//timeEnd: 34200000,
title: 'A song from the hearth',
presenter: 'Still Carlos',
subtitle: 'Derailing early',
timerType: 'clock',
endAction: 'load-next',
isPublic: false,
@@ -1014,8 +980,6 @@ describe('parseExcel()', () => {
'Time Start',
'Time End',
'Title',
'Presenter',
'Subtitle',
'End Action',
'Timer type',
'Public',
@@ -1038,8 +1002,6 @@ describe('parseExcel()', () => {
'1899-12-30T07:00:00.000Z',
'1899-12-30T08:00:10.000Z',
'Guest Welcome',
'Carlos',
'Getting things started',
'',
'',
'x',
@@ -1062,8 +1024,6 @@ describe('parseExcel()', () => {
'1899-12-30T08:00:00.000Z',
'1899-12-30T08:30:00.000Z',
'A song from the hearth',
'Still Carlos',
'Derailing early',
'load-next',
'clock',
'',
@@ -1099,8 +1059,6 @@ describe('parseExcel()', () => {
//timeStart: 28800000,
//timeEnd: 32410000,
title: 'Guest Welcome',
presenter: 'Carlos',
subtitle: 'Getting things started',
timerType: 'count-down',
endAction: 'none',
isPublic: true,
@@ -1115,8 +1073,6 @@ describe('parseExcel()', () => {
//timeStart: 32400000,
//timeEnd: 34200000,
title: 'A song from the hearth',
presenter: 'Still Carlos',
subtitle: 'Derailing early',
timerType: 'clock',
endAction: 'load-next',
isPublic: false,
-16
View File
@@ -91,8 +91,6 @@ export const parseExcel = (excelData: unknown[][], options?: Partial<ImportMap>)
// title stuff: strings
let titleIndex: number | null = null;
let cueIndex: number | null = null;
let presenterIndex: number | null = null;
let subtitleIndex: number | null = null;
let notesIndex: number | null = null;
let colourIndex: number | null = null;
@@ -142,14 +140,6 @@ export const parseExcel = (excelData: unknown[][], options?: Partial<ImportMap>)
titleIndex = col;
rundownMetadata['title'] = { row, col };
},
[importMap.presenter]: (row: number, col: number) => {
presenterIndex = col;
rundownMetadata['presenter'] = { row, col };
},
[importMap.subtitle]: (row: number, col: number) => {
subtitleIndex = col;
rundownMetadata['subtitle'] = { row, col };
},
[importMap.isPublic]: (row: number, col: number) => {
isPublicIndex = col;
rundownMetadata['isPublic'] = { row, col };
@@ -217,10 +207,6 @@ export const parseExcel = (excelData: unknown[][], options?: Partial<ImportMap>)
event.duration = parseExcelDate(column);
} else if (j === cueIndex) {
event.cue = makeString(column, '');
} else if (j === presenterIndex) {
event.presenter = makeString(column, '');
} else if (j === subtitleIndex) {
event.subtitle = makeString(column, '');
} else if (j === isPublicIndex) {
event.isPublic = column == 'x' ? true : coerceBoolean(column);
} else if (j === skipIndex) {
@@ -337,8 +323,6 @@ export function createPatch(originalEvent: OntimeEvent, patchEvent: Partial<Onti
id: originalEvent.id,
type: SupportedEvent.Event,
title: makeString(patchEvent.title, originalEvent.title),
subtitle: makeString(patchEvent.subtitle, originalEvent.subtitle),
presenter: makeString(patchEvent.presenter, originalEvent.presenter),
timeStart,
timeEnd,
duration,
+59 -51
View File
@@ -2,8 +2,6 @@
"rundown": [
{
"title": "Albania",
"subtitle": "Sekret",
"presenter": "Ronela Hajati",
"note": "SF1.01",
"endAction": "none",
"timerType": "count-down",
@@ -17,12 +15,13 @@
"revision": 0,
"id": "32d31",
"cue": "SF1.01",
"custom": {}
"custom": {
"song": "Sekret",
"artist": "Ronela Hajati"
}
},
{
"title": "Latvia",
"subtitle": "Eat Your Salad",
"presenter": "Citi Zeni",
"note": "SF1.02",
"endAction": "none",
"timerType": "count-down",
@@ -36,12 +35,13 @@
"revision": 0,
"id": "21cd2",
"cue": "SF1.02",
"custom": {}
"custom": {
"song": "Eat Your Salad",
"artist": "Citi Zeni"
}
},
{
"title": "Lithuania",
"subtitle": "Sentimentai",
"presenter": "Monika Liu",
"note": "SF1.03",
"endAction": "none",
"timerType": "count-down",
@@ -54,12 +54,14 @@
"type": "event",
"revision": 0,
"id": "0b371",
"cue": "SF1.03"
"cue": "SF1.03",
"custom": {
"song": "Sentimentai",
"artist": "Monika Liu"
}
},
{
"title": "Switzerland",
"subtitle": "Boys Do Cry",
"presenter": "Marius Bear",
"note": "SF1.04",
"endAction": "none",
"timerType": "count-down",
@@ -73,12 +75,13 @@
"revision": 0,
"id": "3cd28",
"cue": "SF1.04",
"custom": {}
"custom": {
"song": "Boys Do Cry",
"artist": "Marius Bear"
}
},
{
"title": "Slovenia",
"subtitle": "Disko",
"presenter": "LPS",
"note": "SF1.05",
"endAction": "none",
"timerType": "count-down",
@@ -92,7 +95,10 @@
"revision": 0,
"id": "e457f",
"cue": "SF1.05",
"custom": {}
"custom": {
"song": "Disko",
"artist": "LPS"
}
},
{
"title": "Lunch break",
@@ -101,8 +107,6 @@
},
{
"title": "Ukraine",
"subtitle": "Stefania",
"presenter": "Kalush Orchestra",
"note": "SF1.06",
"endAction": "none",
"timerType": "count-down",
@@ -116,12 +120,13 @@
"revision": 0,
"id": "1c420",
"cue": "SF1.06",
"custom": {}
"custom": {
"song": "Stefania",
"artist": "Kalush Orchestra"
}
},
{
"title": "Bulgaria",
"subtitle": "Intention",
"presenter": "Intelligent Music Project",
"note": "SF1.07",
"endAction": "none",
"timerType": "count-down",
@@ -135,12 +140,13 @@
"revision": 0,
"id": "b7737",
"cue": "SF1.07",
"custom": {}
"custom": {
"song": "Intention",
"artist": "Intelligent Music Project"
}
},
{
"title": "Netherlands",
"subtitle": "De Diepte",
"presenter": "S10",
"note": "SF1.08",
"endAction": "none",
"timerType": "count-down",
@@ -154,12 +160,13 @@
"revision": 0,
"id": "d3a80",
"cue": "SF1.08",
"custom": {}
"custom": {
"song": "De Diepte",
"artist": "S10"
}
},
{
"title": "Moldova",
"subtitle": "Trenuletul",
"presenter": "Zdob si Zdub",
"note": "SF1.09",
"endAction": "none",
"timerType": "count-down",
@@ -173,12 +180,13 @@
"revision": 0,
"id": "8276c",
"cue": "SF1.09",
"custom": {}
"custom": {
"song": "Trenuletul",
"artist": "Zdob si Zdub"
}
},
{
"title": "Portugal",
"subtitle": "Saudade Saudade",
"presenter": "Maro",
"note": "SF1.10",
"endAction": "none",
"timerType": "count-down",
@@ -192,7 +200,10 @@
"revision": 0,
"id": "2340b",
"cue": "SF1.10",
"custom": {}
"custom": {
"song": "Saudade Saudade",
"artist": "Maro"
}
},
{
"title": "Afternoon break",
@@ -201,8 +212,6 @@
},
{
"title": "Croatia",
"subtitle": "Guilty Pleasure",
"presenter": "Mia Dimsic",
"note": "SF1.11",
"endAction": "none",
"timerType": "count-down",
@@ -216,12 +225,13 @@
"revision": 0,
"id": "503c4",
"cue": "SF1.11",
"custom": {}
"custom": {
"song": "Guilty Pleasure",
"artist": "Mia Dimsic"
}
},
{
"title": "Denmark",
"subtitle": "The Show",
"presenter": "Reddi",
"note": "SF1.12",
"endAction": "none",
"timerType": "count-down",
@@ -235,12 +245,13 @@
"revision": 0,
"id": "5e965",
"cue": "SF1.12",
"custom": {}
"custom": {
"song": "The Show",
"artist": "Reddi"
}
},
{
"title": "Austria",
"subtitle": "Halo",
"presenter": "LUM!X & Pia Maria",
"note": "SF1.13",
"endAction": "none",
"timerType": "count-down",
@@ -254,12 +265,13 @@
"revision": 0,
"id": "bab4a",
"cue": "SF1.13",
"custom": {}
"custom": {
"song": "Halo",
"artist": "LUM!X & Pia Maria"
}
},
{
"title": "Greece",
"subtitle": "Die Together",
"presenter": "Amanda Tenfjord",
"note": "SF1.14",
"endAction": "none",
"timerType": "count-down",
@@ -273,7 +285,10 @@
"revision": 0,
"id": "d3eb1",
"cue": "SF1.14",
"custom": {}
"custom": {
"song": "Die Together",
"artist": "Amanda Tenfjord"
}
}
],
"project": {
@@ -315,15 +330,8 @@
"targetIP": "127.0.0.1",
"enabledIn": true,
"enabledOut": true,
"subscriptions": [
{
"id": "10eea",
"enabled": true,
"cycle": "onUpdate",
"message": "/ontime/update/{{timer.current}}"
}
]
},
"subscriptions": []
},
"http": {
"enabledOut": true,
"subscriptions": []