Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
jitsi-meet/react/features/breakout-rooms/reducer.ts

46 lines
1011 B

import ReducerRegistry from '../base/redux/ReducerRegistry';
import {
_RESET_BREAKOUT_ROOMS,
_UPDATE_ROOM_COUNTER,
UPDATE_BREAKOUT_ROOMS
} from './actionTypes';
import { FEATURE_KEY } from './constants';
import { IRooms } from './types';
const DEFAULT_STATE = {
rooms: {},
roomCounter: 0
};
export interface IBreakoutRoomsState {
roomCounter: number;
rooms: IRooms;
}
/**
* Listen for actions for the breakout-rooms feature.
*/
ReducerRegistry.register<IBreakoutRoomsState>(FEATURE_KEY, (state = DEFAULT_STATE, action): IBreakoutRoomsState => {
switch (action.type) {
case _UPDATE_ROOM_COUNTER:
return {
...state,
roomCounter: action.roomCounter
};
case UPDATE_BREAKOUT_ROOMS: {
const { roomCounter, rooms } = action;
return {
...state,
roomCounter,
rooms
};
}
case _RESET_BREAKOUT_ROOMS: {
return DEFAULT_STATE;
}
}
return state;
});