mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-11 10:23:54 +00:00
feat: presenter view
- connected to websockets - some styling changes - reusable components - some small bugfixes
This commit is contained in:
@@ -21,15 +21,20 @@ class EventTimer extends Timer {
|
||||
text: '',
|
||||
visible: false,
|
||||
};
|
||||
|
||||
titles = {
|
||||
title: '',
|
||||
subtitle: '',
|
||||
presenter: '',
|
||||
titleNow: null,
|
||||
subtitleNow: null,
|
||||
presenterNow: null,
|
||||
titleNext: null,
|
||||
subtitleNext: null,
|
||||
presenterNext: null,
|
||||
};
|
||||
|
||||
selectedEvent = null;
|
||||
selectedEventId = null;
|
||||
numEvents = null;
|
||||
_eventlist = null;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
@@ -77,9 +82,28 @@ class EventTimer extends Timer {
|
||||
this.selectedEventId = e.id;
|
||||
|
||||
// event titles
|
||||
this.titles.title = e.title;
|
||||
this.titles.subtitle = e.subtitle;
|
||||
this.titles.presenter = e.presenter;
|
||||
this.titles.titleNow = e.title;
|
||||
this.titles.subtitleNow = e.subtitle;
|
||||
this.titles.presenterNow = e.presenter;
|
||||
|
||||
// assume tere is no next event
|
||||
this.titles.titleNext = null;
|
||||
this.titles.subtitleNext = null;
|
||||
this.titles.presenterNext = null;
|
||||
|
||||
// look for event after
|
||||
if (eventIndex < this.numEvents - 1) {
|
||||
for (let i = eventIndex + 1 ; i < this.numEvents; i++) {
|
||||
// check that is the right type
|
||||
console.log(this._eventList[i]);
|
||||
if (this._eventList[i].type === 'event') {
|
||||
this.titles.titleNext = this._eventList[i].title;
|
||||
this.titles.subtitleNext = this._eventList[i].subtitle;
|
||||
this.titles.presenterNext = this._eventList[i].presenter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print() {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
class Timer {
|
||||
clock = null;
|
||||
duration = null;
|
||||
current = null;
|
||||
_finishAt = null;
|
||||
@@ -21,6 +22,7 @@ class Timer {
|
||||
setupWithSeconds(seconds, autoStart = false) {
|
||||
// aux
|
||||
const now = this._getCurrentTime();
|
||||
this.clock = now;
|
||||
|
||||
// populate targets
|
||||
this.duration = seconds * 1000;
|
||||
@@ -43,6 +45,7 @@ class Timer {
|
||||
update() {
|
||||
// get current time
|
||||
const now = this._getCurrentTime();
|
||||
this.clock = now;
|
||||
|
||||
// check playstate
|
||||
switch (this.state) {
|
||||
@@ -101,7 +104,9 @@ class Timer {
|
||||
this.update();
|
||||
|
||||
return {
|
||||
clock: this.clock,
|
||||
currentSeconds: Timer.toSeconds(this.current),
|
||||
durationSeconds: Timer.toSeconds(this.duration),
|
||||
expectedFinish: this._getExpectedFinish(),
|
||||
startedAt: this._startedAt,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user