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.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import {
  2. CLOSE_PANEL,
  3. SET_VISIBLE_PANEL,
  4. TOGGLE_CHAT,
  5. TOGGLE_PROFILE,
  6. TOGGLE_SETTINGS
  7. } from './actionTypes';
  8. /**
  9. * Dispatches an action to close the currently displayed side panel.
  10. *
  11. * @returns {Function}
  12. */
  13. export function closePanel() {
  14. return (dispatch, getState) => {
  15. dispatch({
  16. type: CLOSE_PANEL,
  17. current: getState()['features/side-panel'].current
  18. });
  19. };
  20. }
  21. /**
  22. * Updates the redux store with the currently displayed side panel.
  23. *
  24. * @param {string|null} name - The name of the side panel being displayed. Null
  25. * (or falsy) should be set if no side panel is being displayed.
  26. * @returns {{
  27. * type: SET_VISIBLE_PANEL,
  28. * current: string
  29. * }}
  30. */
  31. export function setVisiblePanel(name = null) {
  32. return {
  33. type: SET_VISIBLE_PANEL,
  34. current: name
  35. };
  36. }
  37. /**
  38. * Toggles display of the chat side panel.
  39. *
  40. * @returns {{
  41. * type: TOGGLE_CHAT
  42. * }}
  43. */
  44. export function toggleChat() {
  45. return {
  46. type: TOGGLE_CHAT
  47. };
  48. }
  49. /**
  50. * Toggles display of the profile side panel.
  51. *
  52. * @returns {{
  53. * type: TOGGLE_PROFILE
  54. * }}
  55. */
  56. export function toggleProfile() {
  57. return {
  58. type: TOGGLE_PROFILE
  59. };
  60. }
  61. /**
  62. * Toggles display of the settings side panel.
  63. *
  64. * @returns {{
  65. * type: TOGGLE_SETTINGS
  66. * }}
  67. */
  68. export function toggleSettings() {
  69. return {
  70. type: TOGGLE_SETTINGS
  71. };
  72. }