Skip to content

Commit

Permalink
Merge pull request #2749 from starknet-io/Starknet-site-search-bug
Browse files Browse the repository at this point in the history
Bug - fixing starknet site search
  • Loading branch information
TalBenAvi authored Apr 11, 2024
2 parents cb998b3 + a8479a2 commit 7979398
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions workspaces/website/src/pages/(components)/MainSearch.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import "src/style/algolia/theme.css";
import "src/style/algolia/overrides.css";

import {
AutocompleteOptions,
getAlgoliaResults,
Expand Down Expand Up @@ -100,7 +99,7 @@ export interface Props {
readonly ALGOLIA_APP_ID: string;
readonly ALGOLIA_SEARCH_API_KEY: string;
};
seo: SEOTexts['search']
seo: SEOTexts["search"];
}

export function MainSearch({ env, seo }: Props): JSX.Element | null {
Expand All @@ -109,7 +108,6 @@ export function MainSearch({ env, seo }: Props): JSX.Element | null {
env.ALGOLIA_APP_ID,
env.ALGOLIA_SEARCH_API_KEY
);

const recentSearchesPlugin = createLocalStorageRecentSearchesPlugin({
key: "algolia-recent-searches-plugin",
limit: 3,
Expand Down Expand Up @@ -139,7 +137,7 @@ export function MainSearch({ env, seo }: Props): JSX.Element | null {
},
onSelect({ setIsOpen }) {
setIsOpen(true);
}
},
};
},
});
Expand Down Expand Up @@ -173,11 +171,10 @@ export function MainSearch({ env, seo }: Props): JSX.Element | null {
},
onSelect({ setIsOpen }) {
setIsOpen(true);
}
},
};
},
});

return { searchClient, recentSearchesPlugin, querySuggestionsPlugin };
}, [env.ALGOLIA_APP_ID, env.ALGOLIA_INDEX, env.ALGOLIA_SEARCH_API_KEY]);
const { locale } = usePageContext();
Expand All @@ -197,7 +194,6 @@ export function MainSearch({ env, seo }: Props): JSX.Element | null {
placeholder={seo?.search}
getSources={({ query }) => {
if (!query) return [];

return [
{
sourceId: "posts",
Expand All @@ -207,7 +203,6 @@ export function MainSearch({ env, seo }: Props): JSX.Element | null {
getItems() {
return getAlgoliaResults({
searchClient: data.searchClient,

queries: [
{
params: {
Expand Down Expand Up @@ -277,8 +272,7 @@ export function MainSearch({ env, seo }: Props): JSX.Element | null {
attributesToSnippet: ["title:8", "content:10"],
snippetEllipsisText: "...",
},

indexName: "starknet-docs-dev",
indexName: `starknet-docs-main`,
query,
},
],
Expand Down Expand Up @@ -378,10 +372,7 @@ export function PostItem({
components: { Highlight },
}: ItemProps<Post>) {
return (
<a
href={`/${hit.locale}/content/${hit.slug}`}
className="aa-ItemLink"
>
<a href={`/${hit.locale}/content/${hit.slug}`} className="aa-ItemLink">
<div className="aa-ItemContent">
<div className="aa-ItemIcon aa-ItemIcon--noBorder">
<svg
Expand Down

0 comments on commit 7979398

Please sign in to comment.