lol
This commit is contained in:
parent
a6b24072b8
commit
7b8da70aea
3 changed files with 43 additions and 29 deletions
|
@ -129,7 +129,6 @@ export const load = (player: number, item: PlanItem | Track): AppThunk => (
|
|||
|
||||
export const play = (player: number): AppThunk => dispatch => {
|
||||
try {
|
||||
console.log("PLAY YOU FASCIST")
|
||||
playerSources[player].mediaElement.play();
|
||||
dispatch(
|
||||
mixerState.actions.setPlayerState({ player, state: "playing" })
|
||||
|
@ -199,7 +198,6 @@ export const setVolume = (
|
|||
const currentLevel = getState().mixer.players[player].volume;
|
||||
playerGainTweens[player] = new (Between as any)(currentLevel, volume)
|
||||
.on("update", (value: number) => {
|
||||
console.log(value);
|
||||
dispatch(mixerState.actions.setPlayerVolume({ player, volume }));
|
||||
if (playerGains[player]) {
|
||||
playerGains[player].gain.value = value;
|
||||
|
|
|
@ -72,6 +72,7 @@ function Item({
|
|||
ref={provided.innerRef}
|
||||
key={id}
|
||||
className={`sp-track ${
|
||||
column > 0 &&
|
||||
playerState.loadedItem !== null &&
|
||||
itemId(playerState.loadedItem) === id
|
||||
? "sp-track-active"
|
||||
|
@ -131,10 +132,19 @@ function Player({ id }: { id: number }) {
|
|||
</button>
|
||||
</div>
|
||||
<div className="sp-mixer-buttons">
|
||||
<div className="sp-mixer-buttons-backdrop" style={{ width: playerState.volume * 100 + "%" }}></div>
|
||||
<button onClick={() => dispatch(PlayerState.setVolume(id, "off"))}>Off</button>
|
||||
<button onClick={() => dispatch(PlayerState.setVolume(id, "bed"))}>Bed</button>
|
||||
<button onClick={() => dispatch(PlayerState.setVolume(id, "full"))}>Full</button>
|
||||
<div
|
||||
className="sp-mixer-buttons-backdrop"
|
||||
style={{ width: playerState.volume * 100 + "%" }}
|
||||
></div>
|
||||
<button onClick={() => dispatch(PlayerState.setVolume(id, "off"))}>
|
||||
Off
|
||||
</button>
|
||||
<button onClick={() => dispatch(PlayerState.setVolume(id, "bed"))}>
|
||||
Bed
|
||||
</button>
|
||||
<button onClick={() => dispatch(PlayerState.setVolume(id, "full"))}>
|
||||
Full
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@ -267,7 +277,7 @@ const Showplanner: React.FC<{ timeslotId: number }> = function({ timeslotId }) {
|
|||
const data = CML_CACHE[result.draggableId];
|
||||
const newItem: TimeslotItem = {
|
||||
type: "central",
|
||||
timeslotitemid: "CHANGEME",
|
||||
timeslotitemid: "CHANGEME" + Math.random(),
|
||||
channel: parseInt(result.destination!.droppableId, 10),
|
||||
weight: result.destination!.index,
|
||||
...data
|
||||
|
|
|
@ -98,6 +98,9 @@ const showplan = createSlice({
|
|||
insertGhost(state, action: PayloadAction<ItemGhost>) {
|
||||
state.plan!.push(action.payload);
|
||||
},
|
||||
addItem(state, action: PayloadAction<TimeslotItem>) {
|
||||
state.plan!.push(action.payload);
|
||||
},
|
||||
replaceGhost(
|
||||
state,
|
||||
action: PayloadAction<{ ghostId: string; newItemData: TimeslotItem }>
|
||||
|
@ -267,32 +270,35 @@ export const addItem = (
|
|||
// Now, we're going to insert a "ghost" item into the plan while we wait for it to save
|
||||
// Note that we're going to flush the move-over operations to Redux now, so that the hole
|
||||
// is there - then, once we get a timeslotitemid, replace it with a proper item
|
||||
//
|
||||
// TODO: no we won't, we'll just insert it directly
|
||||
dispatch(showplan.actions.applyOps(ops));
|
||||
dispatch(showplan.actions.addItem(newItemData));
|
||||
|
||||
const ghostId = Math.random().toString(10);
|
||||
const newItemTitle =
|
||||
newItemData.type === "central"
|
||||
? newItemData.artist + "-" + newItemData.title
|
||||
: newItemData.title;
|
||||
const ghost: ItemGhost = {
|
||||
ghostid: ghostId,
|
||||
channel: newItemData.channel,
|
||||
weight: newItemData.weight,
|
||||
title: newItemTitle
|
||||
};
|
||||
// const ghostId = Math.random().toString(10);
|
||||
// const newItemTitle =
|
||||
// newItemData.type === "central"
|
||||
// ? newItemData.artist + "-" + newItemData.title
|
||||
// : newItemData.title;
|
||||
// const ghost: ItemGhost = {
|
||||
// ghostid: ghostId,
|
||||
// channel: newItemData.channel,
|
||||
// weight: newItemData.weight,
|
||||
// title: newItemTitle
|
||||
// };
|
||||
|
||||
const idForServer =
|
||||
newItemData.type === "central"
|
||||
? `${newItemData.album.recordid}-${newItemData.trackid}`
|
||||
: `ManagedDB-${newItemData.auxid}`;
|
||||
// const idForServer =
|
||||
// newItemData.type === "central"
|
||||
// ? `${newItemData.album.recordid}-${newItemData.trackid}`
|
||||
// : `ManagedDB-${newItemData.auxid}`;
|
||||
|
||||
dispatch(showplan.actions.insertGhost(ghost));
|
||||
ops.push({
|
||||
op: "AddItem",
|
||||
channel: newItemData.channel,
|
||||
weight: newItemData.weight,
|
||||
id: idForServer
|
||||
});
|
||||
// dispatch(showplan.actions.insertGhost(ghost));
|
||||
// ops.push({
|
||||
// op: "AddItem",
|
||||
// channel: newItemData.channel,
|
||||
// weight: newItemData.weight,
|
||||
// id: idForServer
|
||||
// });
|
||||
// const result = await api.updateShowplan(timeslotId, ops);
|
||||
// if (!result.every(x => x.status)) {
|
||||
// dispatch(showplan.actions.planSaveError("Server says no!"));
|
||||
|
|
Loading…
Reference in a new issue