From 341bec9cbe4c5d6016e5ed47b7328c6fa6cd3607 Mon Sep 17 00:00:00 2001 From: Solomon Cammack Date: Tue, 16 May 2023 04:14:17 +0100 Subject: [PATCH] Add manual guest editor and dashboard style changes --- server/src/actions/update-broadcast.js | 9 +- website/src/assets/app.css | 9 +- .../components/broadcast/desk/CasterCam.vue | 3 + .../components/broadcast/desk/DeskOverlay.vue | 3 +- .../website/dashboard/DashboardModule.vue | 9 ++ .../website/dashboard/DeskEditor.vue | 124 +++++++++++++++++- .../website/dashboard/GuestEditor.vue | 22 ---- website/src/utils/content-utils.js | 7 + website/src/views/Dashboard.vue | 13 +- 9 files changed, 161 insertions(+), 38 deletions(-) delete mode 100644 website/src/components/website/dashboard/GuestEditor.vue diff --git a/server/src/actions/update-broadcast.js b/server/src/actions/update-broadcast.js index 98f0db8b..43bc7a90 100644 --- a/server/src/actions/update-broadcast.js +++ b/server/src/actions/update-broadcast.js @@ -3,18 +3,18 @@ const { safeInput } = require("../action-utils/action-utils"); module.exports = { key: "update-broadcast", auth: ["client"], - optionalParams: ["match", "advertise", "playerCams", "mapAttack", "title"], + optionalParams: ["match", "advertise", "playerCams", "mapAttack", "title", "manualGuests"], /*** * @param {AnyAirtableID} match * @param {ClientData} client * @returns {Promise} */ // eslint-disable-next-line no-empty-pattern - async handler({ match: matchID, advertise, playerCams, mapAttack, title }, { client }) { + async handler({ match: matchID, advertise, playerCams, mapAttack, title, manualGuests }, { client }) { let broadcast = await this.helpers.get(client?.broadcast?.[0]); if (!broadcast) throw ("No broadcast associated"); - console.log({ matchID, advertise, playerCams, mapAttack, title }); + console.log({ matchID, advertise, playerCams, mapAttack, title, manualGuests }); let validatedData = {}; if (matchID !== undefined) { @@ -40,6 +40,9 @@ module.exports = { if (title !== undefined) { validatedData["Title"] = safeInput(title); } + if (manualGuests !== undefined) { + validatedData["Manual Guests"] = safeInput(manualGuests); + } console.log(validatedData); diff --git a/website/src/assets/app.css b/website/src/assets/app.css index 7ded90f2..80ff9a3e 100644 --- a/website/src/assets/app.css +++ b/website/src/assets/app.css @@ -83,10 +83,6 @@ a:not(.link-text), a:not(.link-text):hover { background-color: var(--theme); } -.btn-primary { - background-color: var(--brand-theme); - border-color: var(--brand-theme); -} /*.btn:hover:not(:disabled), .btn.hover:not(:disabled) {*/ /* background-color: #00a367 !important;*/ /* border-color: #00a367 !important;*/ @@ -279,3 +275,8 @@ input.no-arrows[type=number] { width: 500px; height: 500px; } + +.table.border-no-top tr:first-child td, +.table.border-no-top tr:first-child th { + border-top: none; +} diff --git a/website/src/components/broadcast/desk/CasterCam.vue b/website/src/components/broadcast/desk/CasterCam.vue index 9b9b4d38..51a41dac 100644 --- a/website/src/components/broadcast/desk/CasterCam.vue +++ b/website/src/components/broadcast/desk/CasterCam.vue @@ -33,10 +33,12 @@ export default { return this.manualCamera ? true : this.apiVisible; }, useCam() { + if (this.guest?.webcam?.includes("view=")) return true; if (this.disableVideo) return null; return this.guest?.use_cam || false; }, streamID() { + if (this.guest?.webcam) return this.guest.webcam; if (this.relayPrefix) return this.relayPrefix; return this.guest?.cam_code || ""; }, @@ -175,6 +177,7 @@ export default { border-radius: 50%; box-shadow: 0 0 8px 0 black; background-size: cover; + background-position: center; transform: translate(0, -10%); transition: all .4s ease; } diff --git a/website/src/components/broadcast/desk/DeskOverlay.vue b/website/src/components/broadcast/desk/DeskOverlay.vue index a0c6c753..8819922d 100644 --- a/website/src/components/broadcast/desk/DeskOverlay.vue +++ b/website/src/components/broadcast/desk/DeskOverlay.vue @@ -67,8 +67,7 @@ export default { return manualGuests; }, guests: function() { - if (!this.broadcast?.guests) return []; - const guests = ReactiveArray("guests", { + const guests = (!this.broadcast?.guests) ? [] : ReactiveArray("guests", { player: ReactiveThing("player", { socials: ReactiveArray("socials") }), diff --git a/website/src/components/website/dashboard/DashboardModule.vue b/website/src/components/website/dashboard/DashboardModule.vue index 25c52e50..77f1bfa5 100644 --- a/website/src/components/website/dashboard/DashboardModule.vue +++ b/website/src/components/website/dashboard/DashboardModule.vue @@ -88,6 +88,15 @@ export default { border: none; } + .module-content >>> .table tr th:last-child, + .module-content >>> .table tr td:last-child { + border-right: none; + } + .module-content >>> .table tr th:first-child, + .module-content >>> .table tr td:first-child { + border-left: none; + } + .clip-swipe-down-enter-active, .clip-swipe-down-leave-active { transition: clip-path 200ms ease, max-height 200ms ease; diff --git a/website/src/components/website/dashboard/DeskEditor.vue b/website/src/components/website/dashboard/DeskEditor.vue index aab42b35..ea5a3069 100644 --- a/website/src/components/website/dashboard/DeskEditor.vue +++ b/website/src/components/website/dashboard/DeskEditor.vue @@ -1,23 +1,79 @@ diff --git a/website/src/components/website/dashboard/GuestEditor.vue b/website/src/components/website/dashboard/GuestEditor.vue deleted file mode 100644 index 0a66adf1..00000000 --- a/website/src/components/website/dashboard/GuestEditor.vue +++ /dev/null @@ -1,22 +0,0 @@ - - - - - diff --git a/website/src/utils/content-utils.js b/website/src/utils/content-utils.js index 079c81a7..bd1f14a6 100644 --- a/website/src/utils/content-utils.js +++ b/website/src/utils/content-utils.js @@ -429,6 +429,8 @@ export function createGuestObject(str) { if (part.startsWith("@")) { guest.twitter = part; + } else if (part.includes("view=")) { + guest.webcam = part; } else if (part.startsWith("http")) { guest.avatar = part; } else if (part.includes("/")) { @@ -439,3 +441,8 @@ export function createGuestObject(str) { }); return guest; } + +export function getGuestString(guest) { + delete guest.manual; + return Object.values(guest).join("|"); +} diff --git a/website/src/views/Dashboard.vue b/website/src/views/Dashboard.vue index 04ae09d7..22330c14 100644 --- a/website/src/views/Dashboard.vue +++ b/website/src/views/Dashboard.vue @@ -26,7 +26,8 @@ - + + @@ -144,6 +145,16 @@ export default { }) }) })(this.liveMatch); + }, + deskGuestSource() { + if (this.broadcast?.guests) { + return "Broadcast › Guests"; + } else if (this.liveMatch?.casters) { + return "Broadcast › Live Match › Casters"; + } else if (this.broadcast?.manual_guests) { + return "Broadcast › Manual Guests"; + } + return null; } }, methods: {