Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return update(state, { controllers: { [controllerIndex]: { mapping: { [mappingIndex]: { active: { $set: active } } } } } })
case constants.ADD_SCENE_TO_MIDI:
return update(state, { controllers: { [controllerIndex]: { mapping: { [mappingIndex]: { scenes: { $push: [sceneId] } } } } } })
case constants.ADD_SCENES_TO_MIDI: {
// Get the current scenes to merge them with the new scenes
const oldSceneIds = state.controllers[controllerIndex].mapping[mappingIndex].scenes
// Only add scenes that are not part of the MIDI element yet
const newSceneIds = sceneIds.filter(sceneId => !oldSceneIds.includes(sceneId))
return update(state, { controllers: { [controllerIndex]: { mapping: { [mappingIndex]: { scenes: { $push: newSceneIds } } } } } })
}
case constants.REMOVE_SCENE_FROM_MIDI: {
sceneIndex = state.controllers[controllerIndex].mapping[mappingIndex].scenes.indexOf(sceneId)
return update(state, { controllers: { [controllerIndex]: { mapping: { [mappingIndex]: { scenes: { $splice: [[sceneIndex, 1]] } } } } } })
}
case constants.LEARN_MIDI:
return update(state, { learning: { $set: mappingIndex } })
case constants.REMOVE_MIDI:
return update(state, { controllers: { $splice: [[controllerIndex, 1]] } })
default:
return state
}
}
return state.map((fixture, i) => {
// fixtureBatch contains properties for the fixture in state
if (fixtureBatch[fixture.id] !== undefined) {
return update(state[i], { properties: { $merge: fixtureBatch[fixture.id].properties } })
} else {
return state[i]
}
})
const luminaveServer = (state = {
reconnect: false,
connected: false,
url: 'ws://localhost:4000/graphql',
thorium: {
scenes: []
}
}, {
type,
data
}) => {
switch (type) {
case SET_LUMINAVE_SERVER: {
return update(state, { $merge: { ...data } })
}
default:
return state
}
}
}
case ADD_VENUE_SLOT: {
return update(state, { [venueIndex]: { slots: { $push: [slot] } } })
}
case SET_VENUE_SLOT: {
const slotIndex = state[venueIndex].slots.findIndex(_slot => _slot.id === slot.id)
return update(state, { [venueIndex]: { slots: { [slotIndex]: { $merge: slot } } } })
}
case REMOVE_VENUE_SLOT: {
const slotIndex = state[venueIndex].slots.findIndex(_slot => _slot.id === slot.id)
return update(state, { [venueIndex]: { slots: { $splice: [[slotIndex, 1]] } } })
}
default:
return state
}
}
const modvManager = (state = {
reconnect: false,
connected: false,
url: 'ws://localhost:3006/luminave'
}, {
type,
data
}) => {
switch (type) {
case SET_MODV: {
return update(state, { $merge: { ...data } })
}
default:
return state
}
}
export const live = (state = false, { type, value }) => {
switch (type) {
case constants.SET_LIVE:
return update(state, { $set: value })
default:
return state
}
}
scenes: [],
playing: false,
progress: 0
}, { type, sceneId, scene, sceneIndex, playing, progress }) => {
if (scene !== undefined && scene.sceneId !== undefined) {
sceneIndex = state.scenes.findIndex(_scene => _scene.sceneId === scene.sceneId)
}
if (sceneId !== undefined) {
sceneIndex = state.scenes.findIndex(scene => scene.sceneId === sceneId)
}
switch (type) {
case PLAY_TIMELINE:
return update(state, { playing: { $set: playing } })
case ADD_SCENE_TO_TIMELINE: {
return update(state, { scenes: { $push: [scene] } })
}
case SET_SCENE_ON_TIMELINE: {
return sceneIndex === -1
? state
: update(state, { scenes: { [sceneIndex]: { $merge: scene } } })
}
case REMOVE_SCENE_FROM_TIMELINE: {
return sceneIndex === -1
? state
: update(state, { scenes: { $splice: [[sceneIndex, 1]] } })
}