"Fossies" - the Fresh Open Source Software Archive

Member "jitsi-meet-7555/react/features/reactions/actions.any.ts" (28 Sep 2023, 2516 Bytes) of package /linux/misc/jitsi-meet-7555.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 import { IStore } from '../app/types';
    2 
    3 import {
    4     ADD_REACTION_BUFFER,
    5     ADD_REACTION_MESSAGE,
    6     FLUSH_REACTION_BUFFER,
    7     PUSH_REACTIONS,
    8     SEND_REACTIONS,
    9     SET_REACTION_QUEUE,
   10     SHOW_SOUNDS_NOTIFICATION
   11 } from './actionTypes';
   12 import { IReactionEmojiProps } from './constants';
   13 import { IReactionsAction } from './reducer';
   14 
   15 /**
   16  * Sets the reaction queue.
   17  *
   18  * @param {Array} queue - The new queue.
   19  * @returns {IReactionsAction}
   20  */
   21 export function setReactionQueue(queue: Array<IReactionEmojiProps>): IReactionsAction {
   22     return {
   23         type: SET_REACTION_QUEUE,
   24         queue
   25     };
   26 }
   27 
   28 
   29 /**
   30  * Removes a reaction from the queue.
   31  *
   32  * @param {string} uid - Id of the reaction to be removed.
   33  * @returns {Function}
   34  */
   35 export function removeReaction(uid: string): any {
   36     return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
   37         const queue = getState()['features/reactions'].queue;
   38 
   39         dispatch(setReactionQueue(queue.filter((reaction: IReactionEmojiProps) => reaction.uid !== uid)));
   40     };
   41 }
   42 
   43 
   44 /**
   45  * Sends the reactions buffer to everyone in the conference.
   46  *
   47  * @returns {IReactionsAction}
   48  */
   49 export function sendReactions(): IReactionsAction {
   50     return {
   51         type: SEND_REACTIONS
   52     };
   53 }
   54 
   55 /**
   56  * Adds a reaction to the local buffer.
   57  *
   58  * @param {string} reaction - The reaction to be added.
   59  * @returns {IReactionsAction}
   60  */
   61 export function addReactionToBuffer(reaction: string): IReactionsAction {
   62     return {
   63         type: ADD_REACTION_BUFFER,
   64         reaction
   65     };
   66 }
   67 
   68 /**
   69  * Clears the reaction buffer.
   70  *
   71  * @returns {IReactionsAction}
   72  */
   73 export function flushReactionBuffer(): IReactionsAction {
   74     return {
   75         type: FLUSH_REACTION_BUFFER
   76     };
   77 }
   78 
   79 /**
   80  * Adds a reaction message to the chat.
   81  *
   82  * @param {string} message - The reaction message.
   83  * @returns {IReactionsAction}
   84  */
   85 export function addReactionsToChat(message: string): IReactionsAction {
   86     return {
   87         type: ADD_REACTION_MESSAGE,
   88         message
   89     };
   90 }
   91 
   92 /**
   93  * Adds reactions to the animation queue.
   94  *
   95  * @param {Array} reactions - The reactions to be animated.
   96  * @returns {IReactionsAction}
   97  */
   98 export function pushReactions(reactions: Array<string>): IReactionsAction {
   99     return {
  100         type: PUSH_REACTIONS,
  101         reactions
  102     };
  103 }
  104 
  105 /**
  106  * Displays the disable sounds notification.
  107  *
  108  * @returns {void}
  109  */
  110 export function displayReactionSoundsNotification(): IReactionsAction {
  111     return {
  112         type: SHOW_SOUNDS_NOTIFICATION
  113     };
  114 }