Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

actions.web.ts 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // @ts-expect-error
  2. import VideoLayout from '../../../modules/UI/videolayout/VideoLayout';
  3. import { IStore } from '../app/types';
  4. import { OPEN_CHAT } from './actionTypes';
  5. import { closeChat } from './actions.any';
  6. export * from './actions.any';
  7. /**
  8. * Displays the chat panel.
  9. *
  10. * @param {Object} participant - The recipient for the private chat.
  11. * @param {Object} _disablePolls - Used on native.
  12. * @returns {{
  13. * participant: Participant,
  14. * type: OPEN_CHAT
  15. * }}
  16. */
  17. export function openChat(participant?: Object, _disablePolls?: boolean) {
  18. return function(dispatch: IStore['dispatch']) {
  19. dispatch({
  20. participant,
  21. type: OPEN_CHAT
  22. });
  23. };
  24. }
  25. /**
  26. * Toggles display of the chat panel.
  27. *
  28. * @returns {Function}
  29. */
  30. export function toggleChat() {
  31. return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
  32. const isOpen = getState()['features/chat'].isOpen;
  33. if (isOpen) {
  34. dispatch(closeChat());
  35. } else {
  36. dispatch(openChat());
  37. }
  38. // Recompute the large video size whenever we toggle the chat, as it takes chat state into account.
  39. VideoLayout.onResize();
  40. };
  41. }