Skip to content

Commit

Permalink
Consolidate the two break display editors into a single tabbed modal
Browse files Browse the repository at this point in the history
  • Loading branch information
slmnio committed Jan 25, 2023
1 parent 11c3b37 commit 2ed8f0b
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 141 deletions.
Original file line number Diff line number Diff line change
@@ -1,53 +1,45 @@
<template>
<div class="break-automation-modal">
<div v-b-modal.break-automation>
<b-button size="sm" :class="{ active: automationIsActive }" :variant="automationIsActive ? 'primary' : ''">
<DashboardModalIcon/> Automation<span v-if="activeRotationOptions"> ({{ activeRotationOptions.length }})</span>
</b-button>
<div class="break-automation-tab">
<div class="mb-3">
<p class="mb-0">Automation is currently <b :class="automationIsActive ? 'text-success' : 'text-danger'">{{ automationIsActive ? 'active' : 'inactive' }}</b>.</p>
<p class="mb-0" v-if="!automationIsActive && broadcastBreakDisplay">Break display is currently <b>{{ broadcastBreakDisplay }}</b>.</p>
</div>

<b-modal id="break-automation" ref="modal" title="Break Automation" @show="resetOptions(activeOptions)"
ok-only ok-title="Save" ok-variant="success" :ok-disabled="processing" @ok.prevent="saveOptions">
<div class="mb-3">
<p class="mb-0">Automation is currently <b :class="automationIsActive ? 'text-success' : 'text-danger'">{{ automationIsActive ? 'active' : 'inactive' }}</b>.</p>
<p class="mb-0" v-if="!automationIsActive && broadcastBreakDisplay">Break display is currently <b>{{ broadcastBreakDisplay }}</b>.</p>
</div>

<b-form-group label="Break display rotation options" label-class="font-weight-bold">
<b-form-checkbox v-for="option in rotationOptions" :key="option.value" :value="option.value" v-model="selectedRotationOptions">
<b-form-group label="Break display rotation options" label-class="font-weight-bold">
<b-form-checkbox v-for="option in rotationOptions" :key="option.value" :value="option.value" v-model="selectedRotationOptions">
<span v-if="option.text === 'Matchup' && matchupText" class="text-muted">
{{ option.text }} (Won't show, {{ matchupText }})
</span>
<span v-else>{{ option.text }}</span>
</b-form-checkbox>
</b-form-group>
<span v-else>{{ option.text }}</span>
</b-form-checkbox>
</b-form-group>

<b-form-group label="Ending break display (countdown 30 seconds or lower)" label-class="font-weight-bold">
<b-form-checkbox v-for="option in endingOptions" :key="option.value" :value="option.value" v-model="selectedEndingOptions">
<b-form-group label="Ending break display (countdown 30 seconds or lower)" label-class="font-weight-bold">
<b-form-checkbox v-for="option in endingOptions" :key="option.value" :value="option.value" v-model="selectedEndingOptions">
<span v-if="option.text === 'Matchup' && matchupText" class="text-muted">
{{ option.text }} (Won't show, {{ matchupText }})
</span>
<span v-else>{{ option.text }}</span>
</b-form-checkbox>
</b-form-group>
</b-modal>
<span v-else>{{ option.text }}</span>
</b-form-checkbox>
</b-form-group>

<div class="d-flex">
<div class="w-100"></div>
<b-button variant="success" :disabled="processing" @click="saveOptions">Save</b-button>
</div>
</div>
</template>

<script>
import { BButton, BFormCheckbox, BFormGroup, BModal, VBModal } from "bootstrap-vue";
import { BButton, BFormCheckbox, BFormGroup, VBModal } from "bootstrap-vue";
import { updateBreakAutomation } from "@/utils/dashboard";
import DashboardModalIcon from "@/components/website/dashboard/DashboardModalIcon.vue";
export default {
name: "BreakAutomationModal",
name: "BreakAutomationTab",
components: {
DashboardModalIcon,
BButton,
BFormCheckbox,
BFormGroup,
BModal,
BButton
BFormGroup
},
directives: {
BModal: VBModal
Expand Down Expand Up @@ -95,9 +87,6 @@ export default {
return "live match isn't showing";
}
return null;
},
activeRotationOptions() {
return this.activeOptions.filter(option => this.rotationOptions.find(ro => ro.value === option));
}
},
watch: {
Expand Down
102 changes: 0 additions & 102 deletions website/src/components/website/dashboard/BreakDisplayModal.vue

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<template>
<div class="break-display-modal">
<div v-b-modal.break-display>
<b-button size="sm" :class="{ active: broadcast && broadcast.break_display }" :variant="broadcast && broadcast.break_display ? 'primary' : ''">
<DashboardModalIcon/> {{ autoText }}
</b-button>
</div>
<b-modal ref="modal" id="break-display" title="Break display settings" @show="selectedTab = 'Display'" :hide-footer="selectedTab !== 'Display'">
<b-form-radio-group class="w-100 mb-3" v-model="selectedTab" :options="tabs" buttons button-variant="outline-primary" />
<BreakDisplayTab :broadcast="broadcast" v-if="selectedTab === 'Display'"/>
<BreakAutomationTab :broadcast="broadcast" v-if="selectedTab === 'Automation'" />

<template v-slot:modal-footer>
<div v-if="selectedTab === 'Display'" class="w-100 flex-center text-center">
These settings will change the break scene's display instantly.<br>
Make sure that your show is ready for these graphics to appear.
</div>
</template>
</b-modal>
</div>
</template>

<script>
import DashboardModalIcon from "@/components/website/dashboard/DashboardModalIcon.vue";
import { BButton, BFormRadioGroup, BModal, VBModal } from "bootstrap-vue";
import BreakDisplayTab from "@/components/website/dashboard/BreakDisplayTab.vue";
import BreakAutomationTab from "@/components/website/dashboard/BreakAutomationTab.vue";
export default {
name: "BreakDisplayMultiModal",
components: { BreakAutomationTab, BreakDisplayTab, BFormRadioGroup, BModal, BButton, DashboardModalIcon },
directives: { BModal: VBModal },
props: {
broadcast: Object
},
data: () => ({
selectedTab: "Display",
tabs: [
"Display",
"Automation"
]
}),
computed: {
autoText() {
return this.broadcast?.break_display ? `Display: ${this.broadcast.break_display}` : "Display";
}
}
};
</script>
<style scoped>
</style>
81 changes: 81 additions & 0 deletions website/src/components/website/dashboard/BreakDisplayTab.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<template>
<div class="break-display-tab">
<div class="flex-center">
<div class="buttons d-inline-flex flex-column">
<b-button class="mb-1" v-for="option in options" :key="option.value"
@click="setOption(option.value)"
:disabled="processing && (selected === option.value)"
:class="{ 'active': selected === option.value }"
:variant="selected === option.value && !processing ? 'primary' : 'secondary'">
{{ option.text }}
</b-button>
</div>
</div>
</div>
</template>

<script>
import { BButton } from "bootstrap-vue";
import { updateBreakDisplay } from "@/utils/dashboard";
export default {
name: "BreakDisplayTab",
components: { BButton },
props: { broadcast: Object },
data: () => ({
options: [
{ value: "Automated", text: "Automated break display" },
{ value: "Schedule", text: "Schedule" },
{ value: "Standings", text: "Standings" },
{ value: "Image", text: "Image" },
{ value: "Bracket", text: "Bracket" },
{ value: "Staff", text: "Event staff" },
{ value: "Matchup", text: "Matchup" },
{ value: "Title", text: "Title" },
{ value: "Other Streams", text: "Other Streams" },
{ value: "Other Info", text: "Other Info" }
],
selected: null,
processing: false
}),
computed: {
activeOption() {
return this.broadcast?.break_display;
}
},
watch: {
activeOption: {
immediate: true,
handler(newOption) {
this.resetOption(newOption);
}
},
selectedEndingOptions(options) {
if (options.length > 1) {
this.selectedEndingOptions = [options.pop()];
}
}
},
methods: {
async setOption(option) {
this.selected = option;
this.processing = true;
try {
const response = await updateBreakDisplay(this.$root.auth, this.selected);
if (!response.error) {
this.$notyf.success(`Break display set to ${this.selected}`);
}
} finally {
this.processing = false;
}
},
resetOption(option) {
this.selected = option;
}
}
};
</script>
<style scoped>
</style>
9 changes: 3 additions & 6 deletions website/src/components/website/dashboard/BroadcastEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
<div class="group-top">Break Display</div>
<div class="group-bottom">
<div class="fake-btn-group">
<BreakDisplayModal :broadcast="broadcast" />
<BreakAutomationModal :broadcast="broadcast" />
<BreakDisplayMultiModal :broadcast="broadcast" />
</div>
</div>
</div>
Expand All @@ -61,8 +60,7 @@ import {
updateBroadcastData
} from "@/utils/dashboard";
import ObserverSettingsModal from "@/components/website/dashboard/ObserverSettingsModal.vue";
import BreakAutomationModal from "@/components/website/dashboard/BreakAutomationModal.vue";
import BreakDisplayModal from "@/components/website/dashboard/BreakDisplayModal.vue";
import BreakDisplayMultiModal from "@/components/website/dashboard/BreakDisplayMultiModal.vue";
export default {
name: "BroadcastEditor",
Expand All @@ -72,8 +70,7 @@ export default {
broadcastUpdateTimeout: null
}),
components: {
BreakDisplayModal,
BreakAutomationModal,
BreakDisplayMultiModal,
ObserverSettingsModal,
BFormCheckbox,
BButtonGroup,
Expand Down

0 comments on commit 2ed8f0b

Please sign in to comment.