Files
jitsi-meet/react/features/transcribing/reducer.ts

63 lines
1.4 KiB
TypeScript
Raw Normal View History

2022-09-01 14:00:49 +03:00
import ReducerRegistry from '../base/redux/ReducerRegistry';
import {
TRANSCRIBER_JOINED,
TRANSCRIBER_LEFT
} from './actionTypes';
/**
* Returns initial state for transcribing feature part of Redux store.
*
* @returns {{
* isTranscribing: boolean,
* transcriberJID: null
* }}
* @private
*/
function _getInitialState() {
return {
/**
* Indicates whether there is currently an active transcriber in the
2021-11-04 22:10:43 +01:00
* room.
*
* @type {boolean}
*/
isTranscribing: false,
/**
2021-11-04 22:10:43 +01:00
* The JID of the active transcriber.
*
* @type { string }
*/
transcriberJID: null
};
}
2022-09-01 14:00:49 +03:00
export interface ITranscribingState {
isTranscribing: boolean;
transcriberJID?: string | null;
2022-09-01 14:00:49 +03:00
}
/**
* Reduces the Redux actions of the feature features/transcribing.
*/
2022-09-05 12:05:07 +03:00
ReducerRegistry.register<ITranscribingState>('features/transcribing',
(state = _getInitialState(), action): ITranscribingState => {
switch (action.type) {
case TRANSCRIBER_JOINED:
return {
...state,
isTranscribing: true,
transcriberJID: action.transcriberJID
};
case TRANSCRIBER_LEFT:
return {
...state,
isTranscribing: false,
transcriberJID: undefined
};
default:
return state;
}
});