chore: rename blocks to groups

This commit is contained in:
Carlos Valente
2025-08-09 06:47:13 +02:00
committed by Carlos Valente
parent 486d89ecf4
commit e5d2457717
83 changed files with 987 additions and 981 deletions
@@ -6,7 +6,7 @@ import {
OntimeEvent,
isOntimeEvent,
isOntimeDelay,
isOntimeBlock,
isOntimeGroup,
CustomFieldKey,
EntryId,
OntimeEntry,
@@ -21,7 +21,7 @@ import { defaultRundown } from '../../models/dataModel.js';
import { delay as delayDef } from '../../models/eventsDefinition.js';
import type { ErrorEmitter } from '../../utils/parserUtils.js';
import { calculateDayOffset, cleanupCustomFields, createBlock, createEvent, createMilestone } from './rundown.utils.js';
import { calculateDayOffset, cleanupCustomFields, createGroup, createEvent, createMilestone } from './rundown.utils.js';
import { RundownMetadata } from './rundown.types.js';
/**
@@ -110,7 +110,11 @@ export function parseRundown(
} else if (isOntimeMilestone(event)) {
newEvent = createMilestone({ ...event, id });
cleanupCustomFields(newEvent.custom, parsedCustomFields);
} else if (isOntimeBlock(event)) {
/**
* We leave here an entry point for blocks for the alpha testers, should remove this after a while
*/
// @ts-expect-error -- we are checking a legacy type
} else if (event.type === 'block' || isOntimeGroup(event)) {
for (let i = 0; i < event.entries.length; i++) {
const nestedEventId = event.entries[i];
const nestedEvent = rundown.entries[nestedEventId];
@@ -143,7 +147,7 @@ export function parseRundown(
}
}
newEvent = createBlock({ ...structuredClone(event), id });
newEvent = createGroup({ ...structuredClone(event), id });
// ensure entries exist
if (event.entries?.length > 0) {
newEvent.entries = event.entries.filter((eventId) => Object.hasOwn(rundown.entries, eventId));
@@ -240,9 +244,9 @@ export function makeRundownMetadata(customFields: CustomFields) {
function process<T extends OntimeEntry>(
entry: T,
childOfBlock: EntryId | null,
childOfGroup: EntryId | null,
): { processedData: ProcessedRundownMetadata; processedEntry: T } {
const data = processEntry(rundownMeta, customFields, entry, childOfBlock);
const data = processEntry(rundownMeta, customFields, entry, childOfGroup);
rundownMeta = data.processedData;
return data;
}
@@ -261,7 +265,7 @@ function processEntry<T extends OntimeEntry>(
rundownMetadata: ProcessedRundownMetadata,
customFields: CustomFields,
entry: T,
childOfBlock: EntryId | null,
childOfGroup: EntryId | null,
): { processedData: ProcessedRundownMetadata; processedEntry: T } {
const processedData = { ...rundownMetadata };
const currentEntry = structuredClone(entry);
@@ -294,7 +298,7 @@ function processEntry<T extends OntimeEntry>(
currentEntry.dayOffset = processedData.totalDays;
currentEntry.delay = 0; // this means we dont calculate delays or gaps for skipped events
currentEntry.gap = 0; // this means we dont calculate delays or gaps for skipped events
currentEntry.parent = childOfBlock;
currentEntry.parent = childOfGroup;
// update rundown metadata, it only concerns playable events
if (isPlayableEvent(currentEntry)) {
@@ -353,10 +357,10 @@ function processEntry<T extends OntimeEntry>(
} else if (isOntimeDelay(currentEntry)) {
// !!! this must happen after handling the links
processedData.totalDelay += currentEntry.duration;
currentEntry.parent = childOfBlock;
currentEntry.parent = childOfGroup;
}
if (!childOfBlock) {
if (!childOfGroup) {
processedData.order.push(currentEntry.id);
}
processedData.entries[currentEntry.id] = currentEntry;