Compiles, no show plan loaded
This commit is contained in:
parent
d038c752cb
commit
b03990b846
5 changed files with 118 additions and 79 deletions
|
@ -13,10 +13,25 @@ import Keys from "keymaster";
|
|||
import { Track, MYRADIO_NON_API_BASE, AuxItem } from "../api";
|
||||
import { AppThunk } from "../store";
|
||||
import { RootState } from "../rootReducer";
|
||||
import { audioEngine, ChannelMapping } from "./audio";
|
||||
|
||||
import {
|
||||
audioEngine,
|
||||
ChannelMapping,
|
||||
INTERNAL_OUTPUT_ID,
|
||||
PLAYER_COUNT,
|
||||
PLAYER_ID_PREVIEW,
|
||||
DEFAULT_TRIM_DB,
|
||||
OFF_LEVEL_DB,
|
||||
BED_LEVEL_DB,
|
||||
FULL_LEVEL_DB,
|
||||
} from "./audio";
|
||||
|
||||
import * as TheNews from "./the_news";
|
||||
import { sendBAPSicleChannel } from "../bapsicle";
|
||||
|
||||
import { changeSetting } from "../optionsMenu/settingsState";
|
||||
import { PLAYER_COUNTER_UPDATE_PERIOD_MS } from "../showplanner/Player";
|
||||
|
||||
const playerGainTweens: Array<{
|
||||
target: VolumePresetEnum;
|
||||
tweens: Between[];
|
||||
|
@ -31,14 +46,13 @@ type VolumePresetEnum = "off" | "bed" | "full";
|
|||
type MicVolumePresetEnum = "off" | "full";
|
||||
export type MicErrorEnum = "NO_PERMISSION" | "NOT_SECURE_CONTEXT" | "UNKNOWN";
|
||||
|
||||
const defaultTrimDB = -6; // The default trim applied to channel players.
|
||||
|
||||
interface PlayerState {
|
||||
loadedItem: PlanItem | Track | AuxItem | null;
|
||||
loading: number;
|
||||
loadError: boolean;
|
||||
state: PlayerStateEnum;
|
||||
volume: number;
|
||||
volumeEnum: VolumePresetEnum;
|
||||
gain: number;
|
||||
trim: number;
|
||||
micAutoDuck: boolean;
|
||||
|
@ -73,8 +87,8 @@ const BasePlayerState: PlayerState = {
|
|||
volume: 1,
|
||||
volumeEnum: "full",
|
||||
gain: 0,
|
||||
micAutoDuck: false,
|
||||
trim: DEFAULT_TRIM_DB,
|
||||
micAutoDuck: false,
|
||||
pfl: false,
|
||||
timeCurrent: 0,
|
||||
timeRemaining: 0,
|
||||
|
@ -127,7 +141,7 @@ const mixerState = createSlice({
|
|||
if (action.payload.customOutput) {
|
||||
state.players[action.payload.player].trim = 0;
|
||||
} else if (action.payload.resetTrim) {
|
||||
state.players[action.payload.player].trim = defaultTrimDB;
|
||||
state.players[action.payload.player].trim = DEFAULT_TRIM_DB;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -838,7 +852,8 @@ export const redrawWavesurfers = (): AppThunk => () => {
|
|||
const FADE_TIME_SECONDS = 1;
|
||||
export const setVolume = (
|
||||
player: number,
|
||||
level: VolumePresetEnum
|
||||
level: VolumePresetEnum,
|
||||
fade: boolean = true
|
||||
): AppThunk => (dispatch, getState) => {
|
||||
let volume: number;
|
||||
let uiLevel: number;
|
||||
|
|
|
@ -115,7 +115,7 @@ export function NavBarMyRadio() {
|
|||
className="dropdown-item"
|
||||
onClick={() =>
|
||||
sessionState.currentTimeslot !== null &&
|
||||
dispatch(setItemPlayed({ itemId: "all", played: false }))
|
||||
dispatch(setItemPlayed("all", false))
|
||||
}
|
||||
>
|
||||
Mark All Items Unplayed
|
||||
|
@ -395,18 +395,18 @@ export function CombinedNavAlertBar() {
|
|||
return (
|
||||
<>
|
||||
<AlertBar />
|
||||
(!process.env.REACT_APP_BAPSICLE_INTERFACE &&
|
||||
<>
|
||||
<header className="navbar navbar-myradio navbar-expand-sm hover-menu p-0 bd-navbar">
|
||||
<span className="hover-label hover-label-hide text-light text-center">
|
||||
Hover for MyRadio Menu
|
||||
</span>
|
||||
<nav className="container-fluid px-0">
|
||||
<NavBarMyRadio />
|
||||
</nav>
|
||||
</header>
|
||||
</>
|
||||
)
|
||||
{!process.env.REACT_APP_BAPSICLE_INTERFACE && (
|
||||
<>
|
||||
<header className="navbar navbar-myradio navbar-expand-sm hover-menu p-0 bd-navbar">
|
||||
<span className="hover-label hover-label-hide text-light text-center">
|
||||
Hover for MyRadio Menu
|
||||
</span>
|
||||
<nav className="container-fluid px-0">
|
||||
<NavBarMyRadio />
|
||||
</nav>
|
||||
</header>
|
||||
</>
|
||||
)}
|
||||
<header className="navbar navbar-main navbar-expand-sm p-0 bd-navbar">
|
||||
<nav className="container-fluid px-0">
|
||||
<NavBarMain />
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import { combineReducers } from "@reduxjs/toolkit";
|
||||
|
||||
import { persistReducer, PersistConfig } from "redux-persist";
|
||||
import {
|
||||
persistReducer,
|
||||
PersistConfig,
|
||||
createMigrate,
|
||||
PersistedState,
|
||||
} from "redux-persist";
|
||||
import webStorage from "redux-persist/lib/storage";
|
||||
import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2";
|
||||
|
||||
|
@ -11,6 +16,7 @@ import sessionReducer from "./session/state";
|
|||
import NavbarReducer from "./navbar/state";
|
||||
import OptionsMenuReducer from "./optionsMenu/state";
|
||||
import SettingsState from "./optionsMenu/settingsState";
|
||||
import produce from "immer";
|
||||
|
||||
import BAPSSessionReducer from "./bapsiclesession/state";
|
||||
|
||||
|
@ -25,15 +31,28 @@ const rootReducer = combineReducers({
|
|||
bapsSession: BAPSSessionReducer,
|
||||
});
|
||||
|
||||
export type RootState = ReturnType<typeof rootReducer>;
|
||||
const persistMigrations = createMigrate({
|
||||
0: (state) =>
|
||||
produce(
|
||||
state,
|
||||
(x: PersistedState & Pick<_InternalRootState, "settings">) => {
|
||||
x.settings.saveShowPlanChanges = true;
|
||||
}
|
||||
),
|
||||
});
|
||||
|
||||
const persistenceConfig: PersistConfig<RootState> = {
|
||||
type _InternalRootState = ReturnType<typeof rootReducer>;
|
||||
|
||||
const persistenceConfig: PersistConfig<_InternalRootState> = {
|
||||
key: "root",
|
||||
storage: webStorage,
|
||||
whitelist: ["settings"],
|
||||
stateReconciler: autoMergeLevel2,
|
||||
version: 0,
|
||||
migrate: persistMigrations,
|
||||
};
|
||||
|
||||
const persistedReducer = persistReducer(persistenceConfig, rootReducer);
|
||||
|
||||
export type RootState = ReturnType<typeof persistedReducer>;
|
||||
export default persistedReducer;
|
||||
|
|
|
@ -102,44 +102,48 @@ function LibraryColumn() {
|
|||
|
||||
return (
|
||||
<>
|
||||
(!process.env.REACT_APP_BAPSICLE_INTERFACE &&
|
||||
<LibraryUploadModal
|
||||
isOpen={showLibraryUploadModal}
|
||||
close={() => setShowLibraryModal(false)}
|
||||
/>
|
||||
<ImporterModal
|
||||
close={() => setShowImporterModal(false)}
|
||||
isOpen={showImporterModal}
|
||||
/>
|
||||
)
|
||||
{!process.env.REACT_APP_BAPSICLE_INTERFACE && (
|
||||
<>
|
||||
<LibraryUploadModal
|
||||
isOpen={showLibraryUploadModal}
|
||||
close={() => setShowLibraryModal(false)}
|
||||
/>
|
||||
<ImporterModal
|
||||
close={() => setShowImporterModal(false)}
|
||||
isOpen={showImporterModal}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<div className="library-column">
|
||||
<div className="mx-2 mb-2">
|
||||
<h2>
|
||||
<FaBookOpen className="mx-2" size={28} />
|
||||
Libraries
|
||||
</h2>
|
||||
(!process.env.REACT_APP_BAPSICLE_INTERFACE &&
|
||||
<Button
|
||||
className="mr-1"
|
||||
color="primary"
|
||||
title="Import From Showplan"
|
||||
size="sm"
|
||||
outline={true}
|
||||
onClick={() => setShowImporterModal(true)}
|
||||
>
|
||||
<FaFileImport /> Import
|
||||
</Button>
|
||||
<Button
|
||||
className="mr-1"
|
||||
color="primary"
|
||||
title="Upload to Library"
|
||||
size="sm"
|
||||
outline={true}
|
||||
onClick={() => setShowLibraryModal(true)}
|
||||
>
|
||||
<FaUpload /> Upload
|
||||
</Button>
|
||||
)
|
||||
{!process.env.REACT_APP_BAPSICLE_INTERFACE && (
|
||||
<>
|
||||
<Button
|
||||
className="mr-1"
|
||||
color="primary"
|
||||
title="Import From Showplan"
|
||||
size="sm"
|
||||
outline={true}
|
||||
onClick={() => setShowImporterModal(true)}
|
||||
>
|
||||
<FaFileImport /> Import
|
||||
</Button>
|
||||
<Button
|
||||
className="mr-1"
|
||||
color="primary"
|
||||
title="Upload to Library"
|
||||
size="sm"
|
||||
outline={true}
|
||||
onClick={() => setShowLibraryModal(true)}
|
||||
>
|
||||
<FaUpload /> Upload
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<div className="px-2">
|
||||
<select
|
||||
|
@ -153,14 +157,17 @@ function LibraryColumn() {
|
|||
Choose a library
|
||||
</option>
|
||||
<option value={"CentralMusicLibrary"}>Central Music Library</option>
|
||||
(!process.env.REACT_APP_BAPSICLE_INTERFACE &&
|
||||
<option disabled>Personal Resources</option>
|
||||
{userPlaylists.map((playlist) => (
|
||||
<option key={playlist.managedid} value={playlist.managedid}>
|
||||
{playlist.title}
|
||||
</option>
|
||||
))}
|
||||
)<option disabled>Shared Resources</option>
|
||||
{!process.env.REACT_APP_BAPSICLE_INTERFACE && (
|
||||
<>
|
||||
<option disabled>Personal Resources</option>
|
||||
{userPlaylists.map((playlist) => (
|
||||
<option key={playlist.managedid} value={playlist.managedid}>
|
||||
{playlist.title}
|
||||
</option>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
<option disabled>Shared Resources</option>
|
||||
{auxPlaylists.map((playlist: any) => (
|
||||
<option
|
||||
key={"aux-" + playlist.managedid}
|
||||
|
@ -486,8 +493,7 @@ const Showplanner: React.FC<{ timeslotId: number }> = function({ timeslotId }) {
|
|||
<div id="sidebar">
|
||||
<LibraryColumn />
|
||||
<div className="border-top"></div>
|
||||
(!process.env.REACT_APP_BAPSICLE_INTERFACE) &&
|
||||
<MicControl />)
|
||||
{!process.env.REACT_APP_BAPSICLE_INTERFACE && <MicControl />}
|
||||
</div>
|
||||
</DragDropContext>
|
||||
</div>
|
||||
|
@ -499,14 +505,20 @@ const Showplanner: React.FC<{ timeslotId: number }> = function({ timeslotId }) {
|
|||
<FaCircleNotch /> Mark Unplayed
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
(!process.env.REACT_APP_BAPSICLE_INTERFACE) &&
|
||||
<OptionsMenu />
|
||||
<WelcomeModal
|
||||
isOpen={showWelcomeModal}
|
||||
close={() => setShowWelcomeModal(false)}
|
||||
/>
|
||||
<PisModal close={() => setShowPisModal(false)} isOpen={showPisModal} />
|
||||
<MicLiveIndicator />)
|
||||
{!process.env.REACT_APP_BAPSICLE_INTERFACE && (
|
||||
<>
|
||||
<OptionsMenu />
|
||||
<WelcomeModal
|
||||
isOpen={showWelcomeModal}
|
||||
close={() => setShowWelcomeModal(false)}
|
||||
/>
|
||||
<PisModal
|
||||
close={() => setShowPisModal(false)}
|
||||
isOpen={showPisModal}
|
||||
/>
|
||||
<MicLiveIndicator />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -542,13 +542,6 @@ export const removeItem = (
|
|||
if (getState().settings.saveShowPlanChanges) {
|
||||
const result = await api.updateShowplan(timeslotId, ops);
|
||||
if (!result.every((x) => x.status)) {
|
||||
raygun("send", {
|
||||
error: new Error("Showplan update failure [removeItem]"),
|
||||
customData: {
|
||||
ops,
|
||||
result,
|
||||
},
|
||||
});
|
||||
dispatch(
|
||||
showplan.actions.planSaveError("Failed to update show plan.")
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue