Files
jitsi-meet/react/features/reactions/reducer.js
robertpin 601ee219e7 feat(reactions) Added Reactions (#9465)
* Created desktop reactions menu

Moved raise hand functionality to reactions menu

* Added reactions to chat

* Added animations

* Added reactions to the web mobile version

Redesigned the overflow menu. Added the reactions menu and reactions animations

* Make toolbar visible on animation start

* Bug fix

* Cleanup

* Fixed overflow menu desktop

* Revert mobile menu changes

* Removed unused CSS

* Fixed iOS safari issue

* Fixed overflow issue on mobile

* Added keyboard shortcuts for reactions

* Disabled double tap zoom on reaction buttons

* Refactored actions

* Updated option symbol for keyboard shortcuts

* Actions refactor

* Refactor

* Fixed linting errors

* Updated BottomSheet

* Added reactions on native

* Code cleanup

* Code review refactor

* Color fix

* Hide reactions on one participant

* Removed console log

* Lang fix

* Update schortcuts
2021-07-13 09:50:08 +03:00

91 lines
1.9 KiB
JavaScript

// @flow
import { ReducerRegistry } from '../base/redux';
import {
TOGGLE_REACTIONS_VISIBLE,
SET_REACTIONS_MESSAGE,
CLEAR_REACTIONS_MESSAGE,
SET_REACTION_QUEUE
} from './actionTypes';
/**
* Returns initial state for reactions' part of Redux store.
*
* @private
* @returns {{
* visible: boolean,
* message: string,
* timeoutID: number,
* queue: Array
* }}
*/
function _getInitialState() {
return {
/**
* The indicator that determines whether the reactions menu is visible.
*
* @type {boolean}
*/
visible: false,
/**
* A string that contains the message to be added to the chat.
*
* @type {string}
*/
message: '',
/**
* A number, non-zero value which identifies the timer created by a call
* to setTimeout().
*
* @type {number|null}
*/
timeoutID: null,
/**
* The array of reactions to animate
*
* @type {Array}
*/
queue: []
};
}
ReducerRegistry.register(
'features/reactions',
(state: Object = _getInitialState(), action: Object) => {
switch (action.type) {
case TOGGLE_REACTIONS_VISIBLE:
return {
...state,
visible: !state.visible
};
case SET_REACTIONS_MESSAGE:
return {
...state,
message: action.message,
timeoutID: action.timeoutID
};
case CLEAR_REACTIONS_MESSAGE:
return {
...state,
message: '',
timeoutID: null
};
case SET_REACTION_QUEUE: {
return {
...state,
queue: action.value
};
}
}
return state;
});