Add Party Mode

This commit is contained in:
Marks Polakovs 2021-03-13 10:42:18 +00:00
parent 71c1138d34
commit d6c09da29a
4 changed files with 52 additions and 7 deletions

View file

@ -305,6 +305,25 @@ export function AdvancedTab() {
/>
<label className="form-check-label">Enable recording</label>
</div>
<div className="form-check">
<input
className="form-check-input"
type="checkbox"
checked={settings.partyMode}
onChange={(e) =>
dispatch(
changeSetting({
key: "partyMode",
val: e.target.checked,
})
)
}
/>
<label>
Party Mode (no, seriously, don't enable this unless you know what
you're doing)
</label>
</div>
</>
);
}

View file

@ -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<K extends keyof Settings>(

View file

@ -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({
>
<span className={"icon " + x.type} />
&nbsp;
{x.title.toString()}
{"artist" in x && x.artist !== "" && " - " + x.artist}
{showName && (
<>
{x.title.toString()}
{"artist" in x && x.artist !== "" && " - " + x.artist}
</>
)}
<small
className={
"border rounded border-danger text-danger p-1 m-1" +

View file

@ -220,11 +220,20 @@ function LoadedTrackInfo({ id }: { id: number }) {
(state: RootState) => 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 (
<span className="card-title">
<strong>
{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({
<span className="text-muted">
{playerState.loadedItem !== null && playerState.loading === -1
? "artist" in playerState.loadedItem &&
!partyMode &&
playerState.loadedItem.artist
: ""}
&nbsp;