Skip to content

Commit f14f212

Browse files
committed
feat: consistent rundown activation
1 parent bd3aeaa commit f14f212

File tree

3 files changed

+90
-27
lines changed

3 files changed

+90
-27
lines changed

packages/webui/src/client/lib/ModalDialog.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,17 @@ export function ModalDialog({
203203
</div>
204204
) : null}
205205
<div
206-
className={ClassNames('mod', {
207-
alright: !secondaryText,
208-
})}
206+
className={ClassNames(
207+
'mod',
208+
{
209+
alright: !secondaryText,
210+
},
211+
'modal-dialog-actions'
212+
)}
209213
>
210214
{secondaryText && (
211215
<button
212-
className="btn btn-secondary"
216+
className="btn btn-secondary cancel-btn"
213217
onClick={handleSecondary}
214218
onKeyDown={preventClickOnEnter}
215219
onKeyUp={emulateClick}

packages/webui/src/client/styles/modalDialog.scss

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
padding: 0;
55
border: none;
66
pointer-events: auto;
7+
min-width: 500px;
78

89
.big {
910
max-width: 500px;
@@ -18,14 +19,40 @@
1819
}
1920
}
2021

22+
.modal-dialog-actions {
23+
display: flex;
24+
justify-content: space-between;
25+
26+
.cancel-btn {
27+
margin-right: 2rem;
28+
margin-left: 0px;
29+
}
30+
}
31+
2132
.dark .border-box {
2233
color: #fff;
2334
}
2435

36+
.btn {
37+
font-weight: 100;
38+
min-width: fit-content;
39+
}
40+
41+
.btn.btn-primary {
42+
font-weight: 500;
43+
border: #fffcfc;
44+
border-width: 1px;
45+
border-style: solid;
46+
}
47+
48+
2549
.btn.btn-primary.btn-warn {
2650
background: #e62421;
2751
border-color: #e62421;
2852
color: #ffffff;
53+
border: #ffffff;
54+
border-width: 1px;
55+
border-style: solid;
2956
}
3057

3158
.btn.btn-secondary.btn-warn {

packages/webui/src/client/ui/RundownView.tsx

Lines changed: 55 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -502,17 +502,18 @@ const RundownHeader = withTranslation()(
502502
),
503503
acceptOnly: false,
504504
warning: true,
505-
yes: t('Activate (Rehearsal)'),
505+
yes: t('Activate "On Air"'),
506+
no: t('Cancel'),
506507
actions: [
507508
{
508-
label: t('Activate (On-Air)'),
509-
classNames: 'btn-primary',
509+
label: t('Activate "Rehearsal"'),
510+
classNames: 'btn-secondary',
510511
on: (e) => {
511512
doUserAction(
512513
t,
513514
e,
514515
UserAction.DEACTIVATE_OTHER_RUNDOWN_PLAYLIST,
515-
(e, ts) => MeteorCall.userAction.forceResetAndActivate(e, ts, this.props.playlist._id, false),
516+
(e, ts) => MeteorCall.userAction.forceResetAndActivate(e, ts, this.props.playlist._id, true),
516517
handleResult
517518
)
518519
},
@@ -524,7 +525,7 @@ const RundownHeader = withTranslation()(
524525
t,
525526
e,
526527
UserAction.ACTIVATE_RUNDOWN_PLAYLIST,
527-
(e, ts) => MeteorCall.userAction.activate(e, ts, this.props.playlist._id, true),
528+
(e, ts) => MeteorCall.userAction.activate(e, ts, this.props.playlist._id, false),
528529
handleResult
529530
)
530531
},
@@ -625,24 +626,24 @@ const RundownHeader = withTranslation()(
625626
doModalDialog({
626627
title: t('Another Rundown is Already Active!'),
627628
message: t(
628-
'The rundown "{{rundownName}}" will need to be deactivated in order to activate this one.\n\nAre you sure you want to activate this one anyway?',
629+
'The rundown: "{{rundownName}}" will need to be deactivated in order to activate this one.\n\nAre you sure you want to activate this one anyway?',
629630
{
630631
// TODO: this is a bit of a hack, could a better string sent from the server instead?
631632
rundownName: err.message.args?.names ?? '',
632633
}
633634
),
634-
yes: t('Activate Anyway (Rehearsal)'),
635+
yes: t('Activate "On Air"'),
635636
no: t('Cancel'),
636637
actions: [
637638
{
638-
label: t('Activate Anyway (On-Air)'),
639-
classNames: 'btn-primary',
639+
label: t('Activate "Rehearsal"'),
640+
classNames: 'btn-secondary',
640641
on: (e) => {
641642
doUserAction(
642643
t,
643644
e,
644645
UserAction.DEACTIVATE_OTHER_RUNDOWN_PLAYLIST,
645-
(e, ts) => MeteorCall.userAction.forceResetAndActivate(e, ts, playlistId, false),
646+
(e, ts) => MeteorCall.userAction.forceResetAndActivate(e, ts, playlistId, rehersal),
646647
handleResult
647648
)
648649
},
@@ -654,7 +655,7 @@ const RundownHeader = withTranslation()(
654655
t,
655656
e,
656657
UserAction.DEACTIVATE_OTHER_RUNDOWN_PLAYLIST,
657-
(e, ts) => MeteorCall.userAction.forceResetAndActivate(e, ts, playlistId, rehersal),
658+
(e, ts) => MeteorCall.userAction.forceResetAndActivate(e, ts, playlistId, false),
658659
handleResult
659660
)
660661
},
@@ -693,12 +694,33 @@ const RundownHeader = withTranslation()(
693694
}
694695
)
695696
}
697+
698+
const doActivateAndReset = () => {
699+
this.rewindSegments()
700+
doUserAction(
701+
t,
702+
e,
703+
UserAction.RESET_AND_ACTIVATE_RUNDOWN_PLAYLIST,
704+
(e, ts) => MeteorCall.userAction.resetAndActivate(e, ts, this.props.playlist._id),
705+
(err) => {
706+
if (!err) {
707+
onSuccess()
708+
} else if (ClientAPI.isClientResponseError(err)) {
709+
if (err.error.key === UserErrorMessage.RundownAlreadyActiveNames) {
710+
this.handleAnotherPlaylistActive(this.props.playlist._id, false, err.error, onSuccess)
711+
return false
712+
}
713+
}
714+
}
715+
)
716+
}
717+
696718
if (!this.rundownShouldHaveStarted()) {
697719
// The broadcast hasn't started yet
698720
doModalDialog({
699-
title: this.props.playlist.name,
721+
title: 'Activate "On Air"',
700722
message: t('Do you want to activate this Rundown?'),
701-
yes: 'Activate (On-Air)',
723+
yes: 'Activate "On Air"',
702724
onAccept: () => {
703725
this.rewindSegments()
704726
doUserAction(
@@ -725,11 +747,21 @@ const RundownHeader = withTranslation()(
725747
} else {
726748
// The broadcast has ended, going into active mode is probably not what you want to do
727749
doModalDialog({
728-
title: this.props.playlist.name,
750+
title: 'Activate "On Air"',
729751
message: t('The planned end time has passed, are you sure you want to activate this Rundown?'),
730-
yes: 'Activate (On-Air)',
752+
yes: 'Activate "On Air"',
753+
actions: [
754+
{
755+
label: 'Reset and Activate "On Air"',
756+
classNames: 'btn-secondary',
757+
on: () => {
758+
doActivateAndReset()
759+
},
760+
},
761+
],
762+
acceptOnly: false,
731763
onAccept: () => {
732-
doActivate()
764+
doActivate() // this one should activate without resetting
733765
},
734766
})
735767
}
@@ -787,9 +819,9 @@ const RundownHeader = withTranslation()(
787819
} else if (!this.props.playlist.rehearsal) {
788820
// Active, and not in rehearsal
789821
doModalDialog({
790-
title: this.props.playlist.name,
822+
title: 'Activate "Rehearsal"',
791823
message: t('Are you sure you want to activate Rehearsal Mode?'),
792-
yes: 'Activate (Rehearsal)',
824+
yes: 'Activate "Rehearsal"',
793825
onAccept: () => {
794826
doActivateRehersal()
795827
},
@@ -802,9 +834,9 @@ const RundownHeader = withTranslation()(
802834
if (!this.rundownShouldHaveEnded()) {
803835
// We are in the broadcast
804836
doModalDialog({
805-
title: this.props.playlist.name,
837+
title: 'Activate "Rehearsal"',
806838
message: t('Are you sure you want to activate Rehearsal Mode?'),
807-
yes: 'Activate (Rehearsal)',
839+
yes: 'Activate "Rehearsal"',
808840
onAccept: () => {
809841
doActivateRehersal()
810842
},
@@ -829,7 +861,7 @@ const RundownHeader = withTranslation()(
829861
)
830862
} else {
831863
doModalDialog({
832-
title: this.props.playlist.name,
864+
title: 'Deactivate "On Air"',
833865
message: t('Are you sure you want to deactivate this Rundown?\n(This will clear the outputs)'),
834866
warning: true,
835867
onAccept: () => {
@@ -887,7 +919,7 @@ const RundownHeader = withTranslation()(
887919
) {
888920
// The rundown is active and not in rehersal
889921
doModalDialog({
890-
title: this.props.playlist.name,
922+
title: 'Reset Rundown',
891923
message: t('The rundown can not be reset while it is active'),
892924
onAccept: () => {
893925
// nothing
@@ -3480,7 +3512,7 @@ export function handleRundownReloadResponse(
34803512
doModalDialog({
34813513
title: t('Remove rundown'),
34823514
message: t(
3483-
'Do you really want to remove just the rundown "{{rundownName}}" in the playlist {{playlistName}} from Sofie? This cannot be undone!',
3515+
'Do you really want to remove just the rundown "{{rundownName}}" in the playlist {{playlistName}} from Sofie? \n\nThis cannot be undone!',
34843516
{
34853517
rundownName: rundown?.name || 'N/A',
34863518
playlistName: playlist?.name || 'N/A',

0 commit comments

Comments
 (0)