mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-05 14:29:20 +00:00
style + cleanup
This commit is contained in:
@@ -41,10 +41,7 @@ const Transport = ({ selectedId, playbackControl }) => {
|
|||||||
<div className={style.playbackContainer}>
|
<div className={style.playbackContainer}>
|
||||||
<PrevIconBtn clickhandler={() => playbackControl('previous')} />
|
<PrevIconBtn clickhandler={() => playbackControl('previous')} />
|
||||||
<NextIconBtn clickhandler={() => playbackControl('next')} />
|
<NextIconBtn clickhandler={() => playbackControl('next')} />
|
||||||
<UnloadIconBtn
|
<UnloadIconBtn clickhandler={() => playbackControl('unload')} />
|
||||||
clickhandler={() => playbackControl('unload')}
|
|
||||||
disabled={!selectedId}
|
|
||||||
/>
|
|
||||||
<ReloadIconButton
|
<ReloadIconButton
|
||||||
clickhandler={() => playbackControl('reload')}
|
clickhandler={() => playbackControl('reload')}
|
||||||
disabled={!selectedId}
|
disabled={!selectedId}
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ export default function PlaybackControl() {
|
|||||||
<div className={style.mainContainer}>
|
<div className={style.mainContainer}>
|
||||||
<PlaybackTimer
|
<PlaybackTimer
|
||||||
timer={timer}
|
timer={timer}
|
||||||
|
playback={playback}
|
||||||
handleIncrement={(amount) => socket.emit('increment-timer', amount)}
|
handleIncrement={(amount) => socket.emit('increment-timer', amount)}
|
||||||
/>
|
/>
|
||||||
<PlaybackButtons
|
<PlaybackButtons
|
||||||
|
|||||||
@@ -35,18 +35,19 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: space-around;
|
justify-content: space-evenly;
|
||||||
}
|
}
|
||||||
|
|
||||||
.indRoll,
|
.indRoll,
|
||||||
.indDelay,
|
.indDelay,
|
||||||
.indNegative {
|
.indNegative {
|
||||||
background-color: rgba(0, 0, 0, 0.05);
|
background-color: rgba(0, 0, 0, 0.05);
|
||||||
margin: 0 auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.indRoll,
|
.indRoll,
|
||||||
|
.indRollActive,
|
||||||
.indDelay {
|
.indDelay {
|
||||||
|
margin: 0 auto;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
width: 0.8em;
|
width: 0.8em;
|
||||||
height: 0.8em;
|
height: 0.8em;
|
||||||
@@ -60,7 +61,7 @@
|
|||||||
.indNegativeActive {
|
.indNegativeActive {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
height: 0.3em
|
height: 0.3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.indNegativeActive {
|
.indNegativeActive {
|
||||||
|
|||||||
@@ -8,16 +8,18 @@ const areEqual = (prevProps, nextProps) => {
|
|||||||
return (
|
return (
|
||||||
prevProps.timer.running === nextProps.timer.running &&
|
prevProps.timer.running === nextProps.timer.running &&
|
||||||
prevProps.timer.expectedFinish === nextProps.timer.expectedFinish &&
|
prevProps.timer.expectedFinish === nextProps.timer.expectedFinish &&
|
||||||
prevProps.timer.startedAt === nextProps.timer.startedAt
|
prevProps.timer.startedAt === nextProps.timer.startedAt &&
|
||||||
|
prevProps.playback === nextProps.playback
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const PlaybackTimer = ({ timer, handleIncrement }) => {
|
const PlaybackTimer = (props) => {
|
||||||
|
const { timer, playback, handleIncrement } = props;
|
||||||
const started = stringFromMillis(timer.startedAt, true);
|
const started = stringFromMillis(timer.startedAt, true);
|
||||||
const finish = stringFromMillis(timer.expectedFinish, true);
|
const finish = stringFromMillis(timer.expectedFinish, true);
|
||||||
const isNegative = timer.running < 0;
|
const isNegative = timer.running < 0;
|
||||||
const isDelayed = false;
|
const isDelayed = false;
|
||||||
const isRolling = false;
|
const isRolling = playback === 'roll';
|
||||||
|
|
||||||
const incrementProps = {
|
const incrementProps = {
|
||||||
size: 'sm',
|
size: 'sm',
|
||||||
@@ -31,7 +33,7 @@ const PlaybackTimer = ({ timer, handleIncrement }) => {
|
|||||||
<>
|
<>
|
||||||
<div className={style.timeContainer}>
|
<div className={style.timeContainer}>
|
||||||
<div className={style.indicators}>
|
<div className={style.indicators}>
|
||||||
<div className={style.indRoll} />
|
<div className={isRolling ? style.indRollActive : style.indRoll} />
|
||||||
<div
|
<div
|
||||||
className={isNegative ? style.indNegativeActive : style.indNegative}
|
className={isNegative ? style.indNegativeActive : style.indNegative}
|
||||||
/>
|
/>
|
||||||
@@ -49,16 +51,32 @@ const PlaybackTimer = ({ timer, handleIncrement }) => {
|
|||||||
<span className={style.time}>{finish}</span>
|
<span className={style.time}>{finish}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className={style.btn}>
|
<div className={style.btn}>
|
||||||
<Button {...incrementProps} onClick={() => handleIncrement(-1)}>
|
<Button
|
||||||
|
{...incrementProps}
|
||||||
|
disabled={isRolling}
|
||||||
|
onClick={() => handleIncrement(-1)}
|
||||||
|
>
|
||||||
-1
|
-1
|
||||||
</Button>
|
</Button>
|
||||||
<Button {...incrementProps} onClick={() => handleIncrement(1)}>
|
<Button
|
||||||
|
{...incrementProps}
|
||||||
|
disabled={isRolling}
|
||||||
|
onClick={() => handleIncrement(1)}
|
||||||
|
>
|
||||||
+1
|
+1
|
||||||
</Button>
|
</Button>
|
||||||
<Button {...incrementProps} onClick={() => handleIncrement(-5)}>
|
<Button
|
||||||
|
{...incrementProps}
|
||||||
|
disabled={isRolling}
|
||||||
|
onClick={() => handleIncrement(-5)}
|
||||||
|
>
|
||||||
-5
|
-5
|
||||||
</Button>
|
</Button>
|
||||||
<Button {...incrementProps} onClick={() => handleIncrement(5)}>
|
<Button
|
||||||
|
{...incrementProps}
|
||||||
|
disabled={isRolling}
|
||||||
|
onClick={() => handleIncrement(5)}
|
||||||
|
>
|
||||||
+5
|
+5
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -544,18 +544,12 @@ class EventTimer extends Timer {
|
|||||||
if (e == null) return;
|
if (e == null) return;
|
||||||
|
|
||||||
// private title is always current
|
// private title is always current
|
||||||
this.titles.titleNow = e.title;
|
|
||||||
this.titles.subtitleNow = e.subtitle;
|
|
||||||
this.titles.presenterNow = e.presenter;
|
|
||||||
this.selectedEventId = e.id;
|
|
||||||
|
|
||||||
// check if current is also public
|
// check if current is also public
|
||||||
if (e.isPublic) {
|
if (e.isPublic) {
|
||||||
this.titlesPublic.titleNow = e.title;
|
this._loadThisTitles(e, 'now');
|
||||||
this.titlesPublic.subtitleNow = e.subtitle;
|
|
||||||
this.titlesPublic.presenterNow = e.presenter;
|
|
||||||
this.selectedPublicEventId = e.id;
|
|
||||||
} else {
|
} else {
|
||||||
|
this._loadThisTitles(e, 'now-private');
|
||||||
|
|
||||||
// assume there is no public event
|
// assume there is no public event
|
||||||
this.titlesPublic.titleNow = null;
|
this.titlesPublic.titleNow = null;
|
||||||
this.titlesPublic.subtitleNow = null;
|
this.titlesPublic.subtitleNow = null;
|
||||||
@@ -571,45 +565,70 @@ class EventTimer extends Timer {
|
|||||||
this._eventlist[i].type === 'event' &&
|
this._eventlist[i].type === 'event' &&
|
||||||
this._eventlist[i].isPublic
|
this._eventlist[i].isPublic
|
||||||
) {
|
) {
|
||||||
this.titlesPublic.titleNow = this._eventlist[i].title;
|
this._loadThisTitles(this._eventlist[i], 'now-public');
|
||||||
this.titlesPublic.subtitleNow = this._eventlist[i].subtitle;
|
|
||||||
this.titlesPublic.presenterNow = this._eventlist[i].presenter;
|
|
||||||
this.selectedPublicEventId = this._eventlist[i].id;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_loadThisTitles(eventIndex, type) {
|
_loadThisTitles(e, type) {
|
||||||
if (eventIndex < 0 || eventIndex >= this.numEvents) return;
|
if (e == null) return;
|
||||||
const e = this._eventlist[eventIndex];
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
// now, load to both public and private
|
// now, load to both public and private
|
||||||
case 'now':
|
case 'now':
|
||||||
|
// public
|
||||||
|
this.titlesPublic.titleNow = e.title;
|
||||||
|
this.titlesPublic.subtitleNow = e.subtitle;
|
||||||
|
this.titlesPublic.presenterNow = e.presenter;
|
||||||
|
this.selectedPublicEventId = e.id;
|
||||||
|
|
||||||
|
// private
|
||||||
|
this.titles.titleNow = e.title;
|
||||||
|
this.titles.subtitleNow = e.subtitle;
|
||||||
|
this.titles.presenterNow = e.presenter;
|
||||||
|
this.selectedEventId = e.id;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'now-public':
|
case 'now-public':
|
||||||
|
this.titlesPublic.titleNow = e.title;
|
||||||
|
this.titlesPublic.subtitleNow = e.subtitle;
|
||||||
|
this.titlesPublic.presenterNow = e.presenter;
|
||||||
|
this.selectedPublicEventId = e.id;
|
||||||
break;
|
break;
|
||||||
case 'now-private':
|
case 'now-private':
|
||||||
|
this.titles.titleNow = e.title;
|
||||||
|
this.titles.subtitleNow = e.subtitle;
|
||||||
|
this.titles.presenterNow = e.presenter;
|
||||||
|
this.selectedEventId = e.id;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// next, load to both public and private
|
// next, load to both public and private
|
||||||
case 'next':
|
case 'next':
|
||||||
this.titles.titleNext = e.title;
|
// public
|
||||||
this.titles.subtitleNext = e.subtitle;
|
|
||||||
this.titles.presenterNext = e.presenter;
|
|
||||||
this.nextEventId = e.id;
|
|
||||||
|
|
||||||
this.titlesPublic.titleNext = e.title;
|
this.titlesPublic.titleNext = e.title;
|
||||||
this.titlesPublic.subtitleNext = e.subtitle;
|
this.titlesPublic.subtitleNext = e.subtitle;
|
||||||
this.titlesPublic.presenterNext = e.presenter;
|
this.titlesPublic.presenterNext = e.presenter;
|
||||||
this.nextPublicEventId = e.id;
|
this.nextPublicEventId = e.id;
|
||||||
|
|
||||||
|
// private
|
||||||
|
this.titles.titleNext = e.title;
|
||||||
|
this.titles.subtitleNext = e.subtitle;
|
||||||
|
this.titles.presenterNext = e.presenter;
|
||||||
|
this.nextEventId = e.id;
|
||||||
break;
|
break;
|
||||||
case 'next-public':
|
case 'next-public':
|
||||||
|
this.titlesPublic.titleNext = e.title;
|
||||||
|
this.titlesPublic.subtitleNext = e.subtitle;
|
||||||
|
this.titlesPublic.presenterNext = e.presenter;
|
||||||
|
this.nextPublicEventId = e.id;
|
||||||
break;
|
break;
|
||||||
case 'next-private':
|
case 'next-private':
|
||||||
|
this.titles.titleNext = e.title;
|
||||||
|
this.titles.subtitleNext = e.subtitle;
|
||||||
|
this.titles.presenterNext = e.presenter;
|
||||||
|
this.nextEventId = e.id;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -641,19 +660,13 @@ class EventTimer extends Timer {
|
|||||||
if (this._eventlist[i].type === 'event') {
|
if (this._eventlist[i].type === 'event') {
|
||||||
// if we have not set private
|
// if we have not set private
|
||||||
if (!nextPrivate) {
|
if (!nextPrivate) {
|
||||||
this.titles.titleNext = this._eventlist[i].title;
|
this._loadThisTitles(this._eventlist[i], 'next-private');
|
||||||
this.titles.subtitleNext = this._eventlist[i].subtitle;
|
|
||||||
this.titles.presenterNext = this._eventlist[i].presenter;
|
|
||||||
this.nextEventId = this._eventlist[i].id;
|
|
||||||
nextPrivate = true;
|
nextPrivate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if event is public
|
// if event is public
|
||||||
if (this._eventlist[i].isPublic) {
|
if (this._eventlist[i].isPublic) {
|
||||||
this.titlesPublic.titleNext = this._eventlist[i].title;
|
this._loadThisTitles(this._eventlist[i], 'next-public');
|
||||||
this.titlesPublic.subtitleNext = this._eventlist[i].subtitle;
|
|
||||||
this.titlesPublic.presenterNext = this._eventlist[i].presenter;
|
|
||||||
this.nextPublicEventId = this._eventlist[i].id;
|
|
||||||
nextPublic = true;
|
nextPublic = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user