From d6c09da29a2cdce14b1db7b4cfcf84c8f537ca78 Mon Sep 17 00:00:00 2001 From: Marks Polakovs Date: Sat, 13 Mar 2021 10:42:18 +0000 Subject: [PATCH 1/2] Add Party Mode --- src/optionsMenu/AdvancedTab.tsx | 19 +++++++++++++++++++ src/optionsMenu/settingsState.ts | 2 ++ src/showplanner/Item.tsx | 24 ++++++++++++++++++------ src/showplanner/Player.tsx | 14 +++++++++++++- 4 files changed, 52 insertions(+), 7 deletions(-) diff --git a/src/optionsMenu/AdvancedTab.tsx b/src/optionsMenu/AdvancedTab.tsx index a29f38c..69cb9f6 100644 --- a/src/optionsMenu/AdvancedTab.tsx +++ b/src/optionsMenu/AdvancedTab.tsx @@ -305,6 +305,25 @@ export function AdvancedTab() { /> +
+ + dispatch( + changeSetting({ + key: "partyMode", + val: e.target.checked, + }) + ) + } + /> + +
); } diff --git a/src/optionsMenu/settingsState.ts b/src/optionsMenu/settingsState.ts index 2d7aa19..08dd4ee 100644 --- a/src/optionsMenu/settingsState.ts +++ b/src/optionsMenu/settingsState.ts @@ -12,6 +12,7 @@ interface Settings { channelOutputIds: string[]; resetTrimOnLoad: boolean; saveShowPlanChanges: boolean; + partyMode: boolean; } const settingsState = createSlice({ @@ -27,6 +28,7 @@ const settingsState = createSlice({ channelOutputIds: Array(PLAYER_COUNT).fill(INTERNAL_OUTPUT_ID), resetTrimOnLoad: true, saveShowPlanChanges: true, + partyMode: false, } as Settings, reducers: { changeSetting( diff --git a/src/showplanner/Item.tsx b/src/showplanner/Item.tsx index fb90ea7..1573d01 100644 --- a/src/showplanner/Item.tsx +++ b/src/showplanner/Item.tsx @@ -41,6 +41,9 @@ export const Item = memo(function Item({ (state: RootState) => state.settings.showDebugInfo ); + const partyMode = useSelector((state: RootState) => state.settings.partyMode); + const showName = !partyMode || !isTrack(x) || ("played" in x && x.played); + function triggerClick() { if (column > -1) { dispatch(MixerState.load(column, x)); @@ -76,11 +79,16 @@ export const Item = memo(function Item({ } function generateTooltipData() { - let data = ["Title: " + x.title.toString()]; + let data = []; + if (partyMode) { + data.push("Title: πŸŽ‰πŸŽ‰πŸŽ‰PARTY MODEπŸŽ‰πŸŽ‰πŸŽ‰"); + } else { + data.push("Title: " + x.title.toString()); - if ("artist" in x && x.artist !== "") data.push("Artist: " + x.artist); - if ("album" in x && x.album.title !== "") - data.push("Album: " + x.album.title); + if ("artist" in x && x.artist !== "") data.push("Artist: " + x.artist); + if ("album" in x && x.album.title !== "") + data.push("Album: " + x.album.title); + } data.push("Length: " + x.length); if ("intro" in x) data.push( @@ -133,8 +141,12 @@ export const Item = memo(function Item({ >   - {x.title.toString()} - {"artist" in x && x.artist !== "" && " - " + x.artist} + {showName && ( + <> + {x.title.toString()} + {"artist" in x && x.artist !== "" && " - " + x.artist} + + )} state.mixer.players[id].loadError ); + const partyMode = useSelector((state: RootState) => state.settings.partyMode); + const showName = + !partyMode || + loadedItem === null || + !ShowPlanState.isTrack(loadedItem) || + ("played" in loadedItem && loadedItem.played); + return ( {loadedItem !== null && loading === -1 - ? loadedItem.title + ? showName + ? loadedItem.title + : "" : loading !== -1 ? `LOADING` : loadError @@ -272,6 +281,8 @@ export function Player({ ) ); + const partyMode = useSelector((state: RootState) => state.settings.partyMode); + useBeforeunload((event) => { console.log("Checking player " + id + " for un-ended tracklists."); const tracklistItemID = playerState.tracklistItemID; @@ -381,6 +392,7 @@ export function Player({ {playerState.loadedItem !== null && playerState.loading === -1 ? "artist" in playerState.loadedItem && + !partyMode && playerState.loadedItem.artist : ""}   From 2e2c05b2641a8e13e61cbe5d1da51ddd3ff41558 Mon Sep 17 00:00:00 2001 From: Marks Polakovs Date: Sat, 13 Mar 2021 10:53:18 +0000 Subject: [PATCH 2/2] Show names in the sidebar because we're not monsters --- src/showplanner/Item.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/showplanner/Item.tsx b/src/showplanner/Item.tsx index 1573d01..1f7be36 100644 --- a/src/showplanner/Item.tsx +++ b/src/showplanner/Item.tsx @@ -42,7 +42,8 @@ export const Item = memo(function Item({ ); const partyMode = useSelector((state: RootState) => state.settings.partyMode); - const showName = !partyMode || !isTrack(x) || ("played" in x && x.played); + const showName = + !partyMode || column > 2 || !isTrack(x) || ("played" in x && x.played); function triggerClick() { if (column > -1) {