Revert "feat(speaker-stats): add search in native"

This reverts commit 03f10770ba.
This commit is contained in:
Calinteodor 2022-02-01 16:52:42 +02:00 committed by GitHub
parent 1d81204294
commit 5639dfd3d1
5 changed files with 14 additions and 115 deletions

View File

@ -1,15 +1,10 @@
// @flow
import React, { useCallback, useEffect } from 'react';
import { useDispatch } from 'react-redux';
import React from 'react';
import JitsiScreen from '../../../base/modal/components/JitsiScreen';
import { escapeRegexp } from '../../../base/util';
import { resetSearchCriteria, initSearch } from '../../actions';
import SpeakerStatsList from './SpeakerStatsList';
import SpeakerStatsSearch from './SpeakerStatsSearch';
import style from './styles';
/**
@ -17,22 +12,11 @@ import style from './styles';
*
* @returns {React$Element<any>}
*/
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>
);
};
const SpeakerStats = () => (
<JitsiScreen
style = { style.speakerStatsContainer }>
<SpeakerStatsList />
</JitsiScreen>
);
export default SpeakerStats;

View File

@ -60,15 +60,14 @@ const SpeakerStatsItem = (props: Props) =>
}
</View>
<View style = { style.speakerStatsNameTime } >
<Text style = { [ style.speakerStatsText, props.hasLeft && style.speakerStatsLeft ] }>
<Text style = { style.speakerStatsText }>
{props.displayName}
</Text>
<TimeElapsed
style = { [
style.speakerStatsText,
style.speakerStatsTime,
props.isDominantSpeaker && style.speakerStatsDominant,
props.hasLeft && style.speakerStatsLeft
props.isDominantSpeaker && style.speakerStatsDominant
] }
time = { props.dominantSpeakerTime } />
</View>

View File

@ -1,60 +0,0 @@
// @flow
import React from 'react';
import { useTranslation } from 'react-i18next';
import { withTheme } from 'react-native-paper';
import { useSelector } from 'react-redux';
import { IconSearch, Icon } from '../../../base/icons';
import ClearableInput from '../../../participants-pane/components/native/ClearableInput';
import { isSpeakerStatsSearchDisabled } from '../../functions';
import styles from './styles';
/**
* The type of the React {@code Component} props of {@link SpeakerStatsSearch}.
*/
type Props = {
/**
* The function to initiate the change in the speaker stats table.
*/
onSearch: Function,
/**
* Theme used for styles.
*/
theme: Object
};
/**
* React component for display an individual user's speaker stats.
*
* @returns {React$Element<any>}
*/
function SpeakerStatsSearch({ onSearch, theme }: Props) {
const { t } = useTranslation();
const disableSpeakerStatsSearch = useSelector(isSpeakerStatsSearchDisabled);
if (disableSpeakerStatsSearch) {
return null;
}
return (
<ClearableInput
customStyles = { styles.speakerStatsSearch }
onChange = { onSearch }
placeholder = { t('speakerStats.search') }
placeholderColor = { theme.palette.text03 }
prefixComponent = {
<Icon
color = { theme.palette.text03 }
size = { 20 }
src = { IconSearch }
style = { styles.speakerStatsSearch.searchIcon } />
}
selectionColor = { theme.palette.text01 } />
);
}
export default withTheme(SpeakerStatsSearch);

View File

@ -5,7 +5,7 @@ export default {
flexDirection: 'column',
flex: 1,
height: 'auto',
paddingHorizontal: BaseTheme.spacing[3],
paddingHorizontal: 16,
backgroundColor: BaseTheme.palette.ui02
},
speakerStatsItemContainer: {
@ -17,7 +17,7 @@ export default {
speakerStatsAvatar: {
width: 32,
height: 32,
marginRight: BaseTheme.spacing[3]
marginRight: 16
},
speakerStatsNameTime: {
flexDirection: 'row',
@ -37,25 +37,7 @@ export default {
},
speakerStatsDominant: {
backgroundColor: BaseTheme.palette.success02
},
speakerStatsLeft: {
color: BaseTheme.palette.text03
},
speakerStatsSearch: {
wrapper: {
marginLeft: 0,
marginRight: 0,
marginVertical: BaseTheme.spacing[3],
flexDirection: 'row',
alignItems: 'center'
},
input: {
textAlign: 'left'
},
searchIcon: {
width: 10,
height: 20,
marginLeft: BaseTheme.spacing[3]
}
}
};

View File

@ -73,15 +73,9 @@ type Props = {
function SpeakerStatsSearch({ onSearch }: Props) {
const classes = useStyles();
const { t } = useTranslation();
const disableSpeakerStatsSearch = useSelector(isSpeakerStatsSearchDisabled);
const [ searchValue, setSearchValue ] = useState<string>('');
/**
* Callback for the onChange event of the field.
*
* @param {Object} evt - The static event.
* @returns {void}
*/
const onChange = useCallback((evt: Event) => {
const value = getFieldValue(evt);