2021-04-21 13:48:05 +00:00
|
|
|
import { ReducerRegistry } from '../base/redux';
|
|
|
|
|
|
|
|
import {
|
|
|
|
PARTICIPANTS_PANE_CLOSE,
|
2021-07-01 10:12:38 +00:00
|
|
|
PARTICIPANTS_PANE_OPEN,
|
|
|
|
SET_VOLUME
|
2021-04-21 13:48:05 +00:00
|
|
|
} from './actionTypes';
|
|
|
|
import { REDUCER_KEY } from './constants';
|
|
|
|
|
|
|
|
const DEFAULT_STATE = {
|
2021-07-01 10:12:38 +00:00
|
|
|
isOpen: false,
|
|
|
|
participantsVolume: {}
|
2021-04-21 13:48:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2021-11-04 21:10:43 +00:00
|
|
|
* Listen for actions that mutate the participants pane state.
|
2021-04-21 13:48:05 +00:00
|
|
|
*/
|
|
|
|
ReducerRegistry.register(
|
|
|
|
REDUCER_KEY, (state = DEFAULT_STATE, action) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case PARTICIPANTS_PANE_CLOSE:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
isOpen: false
|
|
|
|
};
|
|
|
|
|
|
|
|
case PARTICIPANTS_PANE_OPEN:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
isOpen: true
|
|
|
|
};
|
|
|
|
|
2021-07-01 10:12:38 +00:00
|
|
|
case SET_VOLUME:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
participantsVolume: {
|
|
|
|
...state.participantsVolume,
|
|
|
|
|
|
|
|
[action.participantId]: action.volume
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-04-21 13:48:05 +00:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
2021-11-04 21:10:43 +00:00
|
|
|
}
|
2021-04-21 13:48:05 +00:00
|
|
|
);
|