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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // @flow
  2. import {
  3. INIT_SEARCH,
  4. INIT_UPDATE_STATS,
  5. UPDATE_STATS,
  6. INIT_REORDER_STATS,
  7. RESET_SEARCH_CRITERIA,
  8. TOGGLE_FACE_EXPRESSIONS
  9. } from './actionTypes';
  10. /**
  11. * Starts a search by criteria.
  12. *
  13. * @param {string | null} criteria - The search criteria.
  14. * @returns {Object}
  15. */
  16. export function initSearch(criteria: string | null) {
  17. return {
  18. type: INIT_SEARCH,
  19. criteria
  20. };
  21. }
  22. /**
  23. * Gets the new stats and triggers update.
  24. *
  25. * @param {Function} getSpeakerStats - Function to get the speaker stats.
  26. * @returns {Object}
  27. */
  28. export function initUpdateStats(getSpeakerStats: Function) {
  29. return {
  30. type: INIT_UPDATE_STATS,
  31. getSpeakerStats
  32. };
  33. }
  34. /**
  35. * Updates the stats with new stats.
  36. *
  37. * @param {Object} stats - The new stats.
  38. * @returns {Object}
  39. */
  40. export function updateStats(stats: Object) {
  41. return {
  42. type: UPDATE_STATS,
  43. stats
  44. };
  45. }
  46. /**
  47. * Initiates reordering of the stats.
  48. *
  49. * @returns {Object}
  50. */
  51. export function initReorderStats() {
  52. return {
  53. type: INIT_REORDER_STATS
  54. };
  55. }
  56. /**
  57. * Resets the search criteria.
  58. *
  59. * @returns {Object}
  60. */
  61. export function resetSearchCriteria() {
  62. return {
  63. type: RESET_SEARCH_CRITERIA
  64. };
  65. }
  66. /**
  67. * Toggles the face expressions grid.
  68. *
  69. * @returns {Object}
  70. */
  71. export function toggleFaceExpressions() {
  72. return {
  73. type: TOGGLE_FACE_EXPRESSIONS
  74. };
  75. }