2021-11-10 17:49:53 +00:00
|
|
|
// @flow
|
|
|
|
|
2021-12-28 14:35:21 +00:00
|
|
|
import React, { useCallback, useEffect } from 'react';
|
|
|
|
import { useDispatch } from 'react-redux';
|
2021-11-10 17:49:53 +00:00
|
|
|
|
|
|
|
import JitsiScreen from '../../../base/modal/components/JitsiScreen';
|
2021-12-28 14:35:21 +00:00
|
|
|
import { escapeRegexp } from '../../../base/util';
|
2022-09-27 07:10:28 +00:00
|
|
|
import { initSearch, resetSearchCriteria } from '../../actions';
|
2021-12-28 14:35:21 +00:00
|
|
|
|
2021-11-10 17:49:53 +00:00
|
|
|
|
|
|
|
import SpeakerStatsList from './SpeakerStatsList';
|
2021-12-28 14:35:21 +00:00
|
|
|
import SpeakerStatsSearch from './SpeakerStatsSearch';
|
2021-11-10 17:49:53 +00:00
|
|
|
import style from './styles';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Component that renders the list of speaker stats.
|
|
|
|
*
|
|
|
|
* @returns {React$Element<any>}
|
|
|
|
*/
|
2021-12-28 14:35:21 +00:00
|
|
|
const SpeakerStats = () => {
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
const onSearch = useCallback((criteria = '') => {
|
|
|
|
dispatch(initSearch(escapeRegexp(criteria)));
|
|
|
|
}
|
|
|
|
, [ dispatch ]);
|
|
|
|
|
|
|
|
useEffect(() => () => dispatch(resetSearchCriteria()), []);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<JitsiScreen
|
|
|
|
style = { style.speakerStatsContainer }>
|
|
|
|
<SpeakerStatsSearch onSearch = { onSearch } />
|
|
|
|
<SpeakerStatsList />
|
|
|
|
</JitsiScreen>
|
|
|
|
);
|
|
|
|
};
|
2021-11-10 17:49:53 +00:00
|
|
|
|
|
|
|
export default SpeakerStats;
|