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.

actions.web.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // @flow
  2. import type { Dispatch } from 'redux';
  3. import VideoLayout from '../../../modules/UI/videolayout/VideoLayout';
  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. * @returns {{
  12. * participant: Participant,
  13. * type: OPEN_CHAT
  14. * }}
  15. */
  16. export function openChat(participant: Object) {
  17. return function(dispatch: (Object) => Object) {
  18. dispatch({
  19. participant,
  20. type: OPEN_CHAT
  21. });
  22. };
  23. }
  24. /**
  25. * Toggles display of the chat panel.
  26. *
  27. * @returns {Function}
  28. */
  29. export function toggleChat() {
  30. return (dispatch: Dispatch<any>, getState: Function) => {
  31. const isOpen = getState()['features/chat'].isOpen;
  32. if (isOpen) {
  33. dispatch(closeChat());
  34. } else {
  35. dispatch(openChat());
  36. }
  37. // Recompute the large video size whenever we toggle the chat, as it takes chat state into account.
  38. VideoLayout.onResize();
  39. };
  40. }