Skip to content

Commit d2b30f0

Browse files
committed
feat: options for reset/no reset on air in oneMinuteBeforeAction
1 parent e1a95bd commit d2b30f0

File tree

1 file changed

+45
-7
lines changed

1 file changed

+45
-7
lines changed

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

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ interface ITimingWarningProps {
180180
playlist: DBRundownPlaylist
181181
inActiveRundownView?: boolean
182182
studioMode: boolean
183-
oneMinuteBeforeAction: (e: Event) => void
183+
oneMinuteBeforeAction: (e: Event, noResetOnActivate: boolean) => void
184184
}
185185

186186
interface ITimingWarningState {
@@ -233,12 +233,12 @@ const WarningDisplay = withTranslation()(
233233
})
234234
}
235235

236-
oneMinuteBeforeAction = (e: any) => {
236+
oneMinuteBeforeAction = (e: any, noResetOnActivate: boolean) => {
237237
this.setState({
238238
plannedStartCloseShow: false,
239239
})
240240

241-
this.props.oneMinuteBeforeAction(e)
241+
this.props.oneMinuteBeforeAction(e, noResetOnActivate)
242242
}
243243

244244
render(): JSX.Element | null {
@@ -249,9 +249,18 @@ const WarningDisplay = withTranslation()(
249249
return (
250250
<ModalDialog
251251
title={t('Start time is close')}
252-
acceptText={t('Activate "On Air"')}
252+
acceptText={t('Reset and Activate "On Air"')}
253253
secondaryText={t('Cancel')}
254-
onAccept={this.oneMinuteBeforeAction}
254+
actions={[
255+
{
256+
label: t('Activate "On Air"'),
257+
classNames: 'btn-secondary',
258+
on: (e) => {
259+
this.oneMinuteBeforeAction(e as Event, true) // this one activates without resetting
260+
},
261+
},
262+
]}
263+
onAccept={(e) => this.oneMinuteBeforeAction(e as Event, false)}
255264
onDiscard={this.discard}
256265
onSecondary={this.discard}
257266
show={
@@ -263,7 +272,7 @@ const WarningDisplay = withTranslation()(
263272
>
264273
<p>
265274
{t(
266-
'You are in rehearsal mode, the broadcast starts in less than 1 minute. Do you want to reset the rundown and go into On-Air mode?'
275+
'You are in rehearsal mode, the broadcast starts in less than 1 minute. Do you want to go into On-Air mode?'
267276
)}
268277
</p>
269278
</ModalDialog>
@@ -1018,6 +1027,33 @@ const RundownHeader = withTranslation()(
10181027
}
10191028
}
10201029

1030+
activateRundown = (e: any) => {
1031+
// Called from the ModalDialog, 1 minute before broadcast starts
1032+
if (this.props.userPermissions.studio) {
1033+
const { t } = this.props
1034+
this.rewindSegments() // Do a rewind right away
1035+
1036+
doUserAction(
1037+
t,
1038+
e,
1039+
UserAction.ACTIVATE_RUNDOWN_PLAYLIST,
1040+
(e, ts) => MeteorCall.userAction.activate(e, ts, this.props.playlist._id, false),
1041+
(err) => {
1042+
if (!err) {
1043+
if (typeof this.props.onActivate === 'function') this.props.onActivate(false)
1044+
} else if (ClientAPI.isClientResponseError(err)) {
1045+
if (err.error.key === UserErrorMessage.RundownAlreadyActiveNames) {
1046+
this.handleAnotherPlaylistActive(this.props.playlist._id, false, err.error, () => {
1047+
if (typeof this.props.onActivate === 'function') this.props.onActivate(false)
1048+
})
1049+
return false
1050+
}
1051+
}
1052+
}
1053+
)
1054+
}
1055+
}
1056+
10211057
resetAndActivateRundown = (e: any) => {
10221058
// Called from the ModalDialog, 1 minute before broadcast starts
10231059
if (this.props.userPermissions.studio) {
@@ -1148,7 +1184,9 @@ const RundownHeader = withTranslation()(
11481184
studioMode={this.props.userPermissions.studio}
11491185
inActiveRundownView={this.props.inActiveRundownView}
11501186
playlist={this.props.playlist}
1151-
oneMinuteBeforeAction={this.resetAndActivateRundown}
1187+
oneMinuteBeforeAction={(e, noResetOnActivate) =>
1188+
noResetOnActivate ? this.activateRundown(e) : this.resetAndActivateRundown(e)
1189+
}
11521190
/>
11531191
<div className="row flex-row first-row super-dark">
11541192
<div className="flex-col left horizontal-align-left">

0 commit comments

Comments
 (0)