diff --git a/src/features/search/Search.jsx b/src/features/search/Search.jsx index b323c4e4..7c92585b 100644 --- a/src/features/search/Search.jsx +++ b/src/features/search/Search.jsx @@ -1,9 +1,11 @@ /* global chrome */ import variables from 'config/variables'; -import { memo, createRef, useEffect, useState, useCallback } from 'react'; +import { memo, useRef, useEffect, useState, useCallback } from 'react'; import { MdSearch, MdMic } from 'react-icons/md'; import { Tooltip } from 'components/Elements'; +import EventBus from 'utils/eventbus'; + import './search.scss'; function Search() { @@ -12,7 +14,7 @@ function Search() { localStorage.getItem('widgetStyle') === 'legacy' ? 'searchIcons old' : 'searchIcons', ); - const micIcon = createRef(); + const micIcon = useRef(null); const startSpeechRecognition = useCallback(() => { const voiceSearch = new window.webkitSpeechRecognition(); @@ -64,8 +66,10 @@ function Search() { , ); + } else { + setMicrophone(null); } - }, [micIcon, startSpeechRecognition]); + }, [startSpeechRecognition]); useEffect(() => { init(); @@ -75,6 +79,12 @@ function Search() { element.focus(); } } + + EventBus.on('refresh', (data) => { + if (data === 'search') { + init(); + } + }); }, [init]); function searchButton(e) { diff --git a/src/features/search/options/SearchOptions.jsx b/src/features/search/options/SearchOptions.jsx index cb4a878a..70134579 100644 --- a/src/features/search/options/SearchOptions.jsx +++ b/src/features/search/options/SearchOptions.jsx @@ -6,47 +6,48 @@ import { Checkbox } from 'components/Form/Settings'; import EventBus from 'utils/eventbus'; -const SearchOptions = () => { - const SEARCH_SECTION = 'modals.main.settings.sections.search'; +const SEARCH_SECTION = 'modals.main.settings.sections.search'; - const ChromePolicyWarning = () => { - return ( -
- -
- Search Engine Selection Removed - {variables.getMessage(`${SEARCH_SECTION}.chrome_policy_warning`)} -
+const ChromePolicyWarning = () => { + return ( +
+ +
+ Search Engine Selection Removed + {variables.getMessage(`${SEARCH_SECTION}.chrome_policy_warning`)}
- ); - }; +
+ ); +}; - const AdditionalOptions = () => { - return ( - - - - {/* not supported on firefox */} - {navigator.userAgent.includes('Chrome') && typeof InstallTrigger === 'undefined' ? ( - - ) : null} +const AdditionalOptions = () => { + return ( + + + + {/* not supported on firefox */} + {navigator.userAgent.includes('Chrome') && typeof InstallTrigger === 'undefined' ? ( - - - ); - }; + ) : null} + + + + ); +}; + +const SearchOptions = () => { return ( <>