mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-06 14:59:09 +00:00
indicate next
small improvements
This commit is contained in:
@@ -57,15 +57,20 @@ export default function EventList(props) {
|
|||||||
|
|
||||||
// ask for playstate
|
// ask for playstate
|
||||||
socket.emit('get-selected-id');
|
socket.emit('get-selected-id');
|
||||||
|
socket.emit('get-next-id');
|
||||||
|
|
||||||
// Handle playstate
|
// Handle playstate
|
||||||
socket.on('selected-id', (data) => {
|
socket.on('selected-id', (data) => {
|
||||||
setSelected(data);
|
setSelected(data);
|
||||||
});
|
});
|
||||||
|
socket.on('next-id', (data) => {
|
||||||
|
setNext(data);
|
||||||
|
});
|
||||||
|
|
||||||
// Clear listener
|
// Clear listener
|
||||||
return () => {
|
return () => {
|
||||||
socket.off('selected-id');
|
socket.off('selected-id');
|
||||||
|
socket.off('next-id');
|
||||||
};
|
};
|
||||||
}, [socket]);
|
}, [socket]);
|
||||||
|
|
||||||
@@ -76,6 +81,8 @@ export default function EventList(props) {
|
|||||||
console.log('EventList: events in event list', events);
|
console.log('EventList: events in event list', events);
|
||||||
let cumulativeDelay = 0;
|
let cumulativeDelay = 0;
|
||||||
|
|
||||||
|
console.log('debug next id', next)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={style.eventContainer}>
|
<div className={style.eventContainer}>
|
||||||
{cursor === -1 && <div className={style.cursor} />}
|
{cursor === -1 && <div className={style.cursor} />}
|
||||||
@@ -90,7 +97,7 @@ export default function EventList(props) {
|
|||||||
index={index}
|
index={index}
|
||||||
data={e}
|
data={e}
|
||||||
selected={selected === e.id}
|
selected={selected === e.id}
|
||||||
next={next === index}
|
next={next === e.id}
|
||||||
eventsHandler={eventsHandler}
|
eventsHandler={eventsHandler}
|
||||||
delay={cumulativeDelay}
|
delay={cumulativeDelay}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export default function EventListItem(props) {
|
|||||||
index={index}
|
index={index}
|
||||||
data={data}
|
data={data}
|
||||||
selected={selected}
|
selected={selected}
|
||||||
next={next === index}
|
next={next}
|
||||||
eventsHandler={eventsHandler}
|
eventsHandler={eventsHandler}
|
||||||
delay={delay}
|
delay={delay}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class EventTimer extends Timer {
|
|||||||
|
|
||||||
selectedEvent = null;
|
selectedEvent = null;
|
||||||
selectedEventId = null;
|
selectedEventId = null;
|
||||||
|
nextEventId = null;
|
||||||
numEvents = null;
|
numEvents = null;
|
||||||
_eventlist = null;
|
_eventlist = null;
|
||||||
|
|
||||||
@@ -78,6 +79,7 @@ class EventTimer extends Timer {
|
|||||||
this.io.emit('timer', this.getObject());
|
this.io.emit('timer', this.getObject());
|
||||||
this.io.emit('playstate', this.state);
|
this.io.emit('playstate', this.state);
|
||||||
this.io.emit('selected-id', this.selectedEventId);
|
this.io.emit('selected-id', this.selectedEventId);
|
||||||
|
this.io.emit('next-id', this.nextEventId);
|
||||||
this.io.emit('titles', this.titles);
|
this.io.emit('titles', this.titles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,6 +207,7 @@ class EventTimer extends Timer {
|
|||||||
socket.emit('timer', this.getObject());
|
socket.emit('timer', this.getObject());
|
||||||
socket.emit('playstate', this.state);
|
socket.emit('playstate', this.state);
|
||||||
socket.emit('selected-id', this.selectedEventId);
|
socket.emit('selected-id', this.selectedEventId);
|
||||||
|
socket.emit('next-id', this.nextEventId);
|
||||||
socket.emit('titles', this.titles);
|
socket.emit('titles', this.titles);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -234,6 +237,10 @@ class EventTimer extends Timer {
|
|||||||
socket.emit('selected-id', this.selectedEventId);
|
socket.emit('selected-id', this.selectedEventId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on('get-next-id', () => {
|
||||||
|
socket.emit('next-id', this.nextEventId);
|
||||||
|
});
|
||||||
|
|
||||||
socket.on('get-titles', () => {
|
socket.on('get-titles', () => {
|
||||||
socket.emit('titles', this.titles);
|
socket.emit('titles', this.titles);
|
||||||
});
|
});
|
||||||
@@ -371,19 +378,11 @@ class EventTimer extends Timer {
|
|||||||
this.titles.titleNext = null;
|
this.titles.titleNext = null;
|
||||||
this.titles.subtitleNext = null;
|
this.titles.subtitleNext = null;
|
||||||
this.titles.presenterNext = null;
|
this.titles.presenterNext = null;
|
||||||
|
this.nextEventId = null;
|
||||||
|
|
||||||
// look for event after
|
// look for event after
|
||||||
if (eventIndex < this.numEvents - 1) {
|
this._loadNext(eventIndex);
|
||||||
for (let i = eventIndex + 1; i < this.numEvents; i++) {
|
|
||||||
// check that is the right type
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.broadcastState();
|
this.broadcastState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,8 +412,15 @@ class EventTimer extends Timer {
|
|||||||
this.titles.titleNext = null;
|
this.titles.titleNext = null;
|
||||||
this.titles.subtitleNext = null;
|
this.titles.subtitleNext = null;
|
||||||
this.titles.presenterNext = null;
|
this.titles.presenterNext = null;
|
||||||
|
this.nextEventId = null;
|
||||||
|
|
||||||
// look for event after
|
// look for event after
|
||||||
|
this._loadNext(eventIndex);
|
||||||
|
|
||||||
|
this.broadcastState();
|
||||||
|
}
|
||||||
|
|
||||||
|
_loadNext(eventIndex) {
|
||||||
if (eventIndex < this.numEvents - 1) {
|
if (eventIndex < this.numEvents - 1) {
|
||||||
for (let i = eventIndex + 1; i < this.numEvents; i++) {
|
for (let i = eventIndex + 1; i < this.numEvents; i++) {
|
||||||
// check that is the right type
|
// check that is the right type
|
||||||
@@ -422,11 +428,11 @@ class EventTimer extends Timer {
|
|||||||
this.titles.titleNext = this._eventList[i].title;
|
this.titles.titleNext = this._eventList[i].title;
|
||||||
this.titles.subtitleNext = this._eventList[i].subtitle;
|
this.titles.subtitleNext = this._eventList[i].subtitle;
|
||||||
this.titles.presenterNext = this._eventList[i].presenter;
|
this.titles.presenterNext = this._eventList[i].presenter;
|
||||||
|
this.nextEventId = this._eventList[i].id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.broadcastState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_resetSelection() {
|
_resetSelection() {
|
||||||
|
|||||||
Reference in New Issue
Block a user