* style: element relationship
* feat: utility to add first element
* refactor: organise dir
* ux: deleting element closes drawer
* fix: issue with escaped characters
* fix: issue with overflow in events list
* fix: prevent event timer from receiving non event
* style: prevent small shift on class change
* style: visually detach event editor
* fix: entry block knows last event
* fix: skip event timer updates on non events
* fix: prevent electron OPENGL error
* style: cleanup text styles
* style: unify input styles
* refactor: simplify style and composition
* refactor: tweaks on style + ts
* refactor: add validation to events post
* fix: handle non events in event timer
* refactor: cleanup unused
This commit is contained in:
Carlos Valente
2022-10-23 19:21:49 +02:00
committed by GitHub
parent d8ee0d4f82
commit 1b1aced296
30 changed files with 233 additions and 252 deletions
@@ -95,7 +95,9 @@ export class DataProvider {
*/
static async insertEventAfterId(entry, id) {
const index = [...data.events].findIndex((event) => event.id === id);
await DataProvider.insertEventAt(entry, index + 1);
// eslint-disable-next-line no-unused-vars
const { _after, ...sanitisedEvent } = entry;
await DataProvider.insertEventAt(sanitisedEvent, index + 1);
}
static getSettings() {
+34 -44
View File
@@ -772,40 +772,45 @@ export class EventTimer extends Timer {
* @param previousId
*/
insertEventAfterId(event, previousId) {
// find object in events
const previousIndex = this._eventlist.findIndex((e) => e.id === previousId);
if (previousIndex === -1) {
throw 'Event not found';
}
if (previousIndex + 1 >= this._eventlist.length) {
this._eventlist.push(event);
if (typeof previousId === 'undefined') {
// Insert at beginning
this._eventlist.unshift(event);
} else {
this._eventlist.splice(previousIndex + 1, 0, event);
}
// find object in events
const previousIndex = this._eventlist.findIndex((e) => e.id === previousId);
if (previousIndex === -1) {
throw 'Event not found';
}
try {
// check if entry is running
if (event.id === this.selectedEventId) {
// handle reload selected
// Reload data if running
const type =
this.selectedEventId === event.id && this._startedAt != null ? 'reload' : 'load';
this.loadEvent(this.selectedEventIndex, type);
} else if (event.id === this.nextEventId) {
// roll needs to recalculate
if (this.state === 'roll') {
this.rollLoad();
if (previousIndex + 1 >= this._eventlist.length) {
this._eventlist.push(event);
} else {
this._eventlist.splice(previousIndex + 1, 0, event);
}
try {
// check if entry is running
if (event.id === this.selectedEventId) {
// handle reload selected
// Reload data if running
const type =
this.selectedEventId === event.id && this._startedAt != null ? 'reload' : 'load';
this.loadEvent(this.selectedEventIndex, type);
} else if (event.id === this.nextEventId) {
// roll needs to recalculate
if (this.state === 'roll') {
this.rollLoad();
}
}
}
// load titles
if ('title' in event || 'subtitle' in event || 'presenter' in event) {
this._loadTitlesNext();
this._loadTitlesNow();
// load titles
if ('title' in event || 'subtitle' in event || 'presenter' in event) {
this._loadTitlesNext();
this._loadTitlesNow();
}
} catch (error) {
this.socket.error('SERVER', error);
}
} catch (error) {
this.socket.error('SERVER', error);
}
// update clients
@@ -815,21 +820,6 @@ export class EventTimer extends Timer {
this.runCycle();
}
/**
* @description inserts an event in the first position of the list
* @param event
*/
insertEventAtStart(event) {
// Insert at beginning
this._eventlist.unshift(event);
// update clients
this.broadcastState();
// run cycle
this.runCycle();
}
/**
* Deleted an event from the list by its id
* @param {string} eventId