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 984B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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({ participant,
  19. type: OPEN_CHAT });
  20. VideoLayout.onResize();
  21. };
  22. }
  23. /**
  24. * Toggles display of the chat panel.
  25. *
  26. * @returns {Function}
  27. */
  28. export function toggleChat() {
  29. return (dispatch: Dispatch<any>, getState: Function) => {
  30. const isOpen = getState()['features/chat'].isOpen;
  31. if (isOpen) {
  32. dispatch(closeChat());
  33. } else {
  34. dispatch(openChat());
  35. }
  36. };
  37. }