fix: remove algolia indices and urls from translations (#41043)
This commit is contained in:
committed by
GitHub
parent
149cf95310
commit
1e9dc8cea5
@@ -7,7 +7,7 @@ import qs from 'query-string';
|
||||
import { navigate } from 'gatsby';
|
||||
import Media from 'react-responsive';
|
||||
import algoliasearch from 'algoliasearch/lite';
|
||||
import { withTranslation } from 'react-i18next';
|
||||
import { newsIndex } from '../../utils/algolia-locale-setup';
|
||||
|
||||
import {
|
||||
isSearchDropdownEnabledSelector,
|
||||
@@ -32,7 +32,6 @@ const propTypes = {
|
||||
isDropdownEnabled: PropTypes.bool,
|
||||
location: PropTypes.object.isRequired,
|
||||
query: PropTypes.string,
|
||||
t: PropTypes.func.isRequired,
|
||||
toggleSearchDropdown: PropTypes.func.isRequired,
|
||||
updateSearchQuery: PropTypes.func.isRequired
|
||||
};
|
||||
@@ -126,11 +125,11 @@ class InstantSearchRoot extends Component {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { query, t } = this.props;
|
||||
const { query } = this.props;
|
||||
const MAX_MOBILE_HEIGHT = 768;
|
||||
return (
|
||||
<InstantSearch
|
||||
indexName={t('search.index-name')}
|
||||
indexName={newsIndex}
|
||||
onSearchStateChange={this.onSearchStateChange}
|
||||
searchClient={searchClient}
|
||||
searchState={{ query }}
|
||||
@@ -159,7 +158,7 @@ InstantSearchRoot.propTypes = propTypes;
|
||||
const InstantSearchRootConnected = connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withTranslation()(InstantSearchRoot));
|
||||
)(InstantSearchRoot);
|
||||
|
||||
const WithInstantSearch = ({ children }) => (
|
||||
<Location>
|
||||
|
@@ -7,6 +7,7 @@ import { SearchBox } from 'react-instantsearch-dom';
|
||||
import { HotKeys, ObserveKeys } from 'react-hotkeys';
|
||||
import { isEqual } from 'lodash';
|
||||
import { withTranslation } from 'react-i18next';
|
||||
import { searchPageUrl } from '../../../utils/algolia-locale-setup';
|
||||
|
||||
import {
|
||||
isSearchDropdownEnabledSelector,
|
||||
@@ -93,7 +94,7 @@ export class SearchBar extends Component {
|
||||
|
||||
handleSearch(e, query) {
|
||||
e.preventDefault();
|
||||
const { toggleSearchDropdown, updateSearchQuery, t } = this.props;
|
||||
const { toggleSearchDropdown, updateSearchQuery } = this.props;
|
||||
const { index, hits } = this.state;
|
||||
const selectedHit = hits[index];
|
||||
|
||||
@@ -116,9 +117,7 @@ export class SearchBar extends Component {
|
||||
// are hits besides the footer
|
||||
return query && hits.length > 1
|
||||
? window.location.assign(
|
||||
t('search.search-page-url', {
|
||||
searchQuery: encodeURIComponent(query)
|
||||
})
|
||||
`${searchPageUrl}?query=${encodeURIComponent(query)}`
|
||||
)
|
||||
: false;
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
||||
import { connectStateResults, connectHits } from 'react-instantsearch-dom';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { searchPageUrl } from '../../../utils/algolia-locale-setup';
|
||||
|
||||
import Suggestion from './SearchSuggestion';
|
||||
import NoHitsSuggestion from './NoHitsSuggestion';
|
||||
@@ -25,9 +26,7 @@ const CustomHits = connectHits(
|
||||
query: searchQuery,
|
||||
url: noHits
|
||||
? null
|
||||
: t('search.search-page-url', {
|
||||
searchQuery: encodeURIComponent(searchQuery)
|
||||
}),
|
||||
: `${searchPageUrl}?query=${encodeURIComponent(searchQuery)}`,
|
||||
title: t('search.see-results', { searchQuery: searchQuery }),
|
||||
_highlightResult: {
|
||||
query: {
|
||||
|
Reference in New Issue
Block a user