2021-09-09 22:46:41 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import {
|
|
|
|
INIT_SEARCH,
|
|
|
|
INIT_UPDATE_STATS,
|
|
|
|
UPDATE_STATS,
|
2021-12-13 14:11:07 +00:00
|
|
|
INIT_REORDER_STATS,
|
|
|
|
RESET_SEARCH_CRITERIA
|
2021-09-09 22:46:41 +00:00
|
|
|
} from './actionTypes';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Starts a search by criteria.
|
|
|
|
*
|
2021-09-24 16:39:24 +00:00
|
|
|
* @param {string | null} criteria - The search criteria.
|
2021-09-09 22:46:41 +00:00
|
|
|
* @returns {Object}
|
|
|
|
*/
|
2021-09-24 16:39:24 +00:00
|
|
|
export function initSearch(criteria: string | null) {
|
2021-09-09 22:46:41 +00:00
|
|
|
return {
|
|
|
|
type: INIT_SEARCH,
|
|
|
|
criteria
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the new stats and triggers update.
|
|
|
|
*
|
|
|
|
* @param {Function} getSpeakerStats - Function to get the speaker stats.
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
export function initUpdateStats(getSpeakerStats: Function) {
|
|
|
|
return {
|
|
|
|
type: INIT_UPDATE_STATS,
|
|
|
|
getSpeakerStats
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the stats with new stats.
|
|
|
|
*
|
|
|
|
* @param {Object} stats - The new stats.
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
export function updateStats(stats: Object) {
|
|
|
|
return {
|
|
|
|
type: UPDATE_STATS,
|
|
|
|
stats
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initiates reordering of the stats.
|
|
|
|
*
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
export function initReorderStats() {
|
|
|
|
return {
|
|
|
|
type: INIT_REORDER_STATS
|
|
|
|
};
|
|
|
|
}
|
2021-12-13 14:11:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Resets the search criteria.
|
|
|
|
*
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
|
|
|
export function resetSearchCriteria() {
|
|
|
|
return {
|
|
|
|
type: RESET_SEARCH_CRITERIA
|
|
|
|
};
|
|
|
|
}
|