Skip to content

Commit

Permalink
refactor(search): don't display results from explorers index
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelgerber committed Apr 2, 2024
1 parent 288a8d0 commit 93fa1af
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 72 deletions.
22 changes: 2 additions & 20 deletions site/search/Search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@
}

.search-results__pages-list,
.search-results__explorers-list,
.search-results__explorer-views-list,
.search-results__charts-list {
gap: var(--grid-gap);
Expand Down Expand Up @@ -228,7 +227,6 @@
display: block;
}

.search-results__explorer-hit a,
.search-results__explorer-view-hit a {
background-color: $blue-10;
height: 100%;
Expand Down Expand Up @@ -327,15 +325,13 @@
**/

.search-results__pages,
.search-results__explorers,
.search-results__explorer-views,
.search-results__charts {
display: none;
}

.search-results[data-active-filter="all"] {
.search-results__pages,
.search-results__explorers,
.search-results__explorer-views,
.search-results__charts {
// both needed for .search-results__show-more-container absolute-positioning
Expand Down Expand Up @@ -371,16 +367,6 @@
}
}

.search-results__explorer-hit {
display: none;
}

.search-results__explorer-hit {
&:nth-child(-n + 2) {
display: inline;
}
}

.search-results__explorer-view-hit {
display: none;

Expand All @@ -389,12 +375,8 @@
}
}

.search-results[data-active-filter="explorers"] .search-results__explorers,
.search-results[data-active-filter="explorers"]
.search-results__explorer-views {
display: inline;

.search-results__explorer-hit,
.search-results[data-active-filter="explorer-views"] {
.search-results__explorer-views,
.search-results__explorer-view-hit {
display: inline;
}
Expand Down
53 changes: 1 addition & 52 deletions site/search/SearchPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import {
import { action, observable } from "mobx"
import { observer } from "mobx-react"
import {
IExplorerHit,
IChartHit,
SearchCategoryFilter,
SearchIndexName,
Expand Down Expand Up @@ -139,20 +138,6 @@ function ExplorerViewHit({ hit }: { hit: IExplorerViewHit }) {
)
}

function ExplorerHit({ hit }: { hit: IExplorerHit }) {
return (
<a
data-algolia-index={getIndexName(SearchIndexName.Explorers)}
data-algolia-object-id={hit.objectID}
data-algolia-position={hit.__position}
href={`${BAKED_BASE_URL}/${EXPLORERS_ROUTE_FOLDER}/${hit.slug}`}
>
<h4 className="h3-bold">{hit.title}</h4>
{/* Explorer subtitles are mostly useless at the moment, so we're only showing titles */}
</a>
)
}

function ShowMore({
category,
cutoffNumber,
Expand Down Expand Up @@ -217,10 +202,6 @@ function Filters({
hitsLengthByIndexName
).reduce((a: number, b: number) => a + b, 0)

hitsLengthByIndexName[getIndexName(SearchIndexName.Explorers)] =
hitsLengthByIndexName[getIndexName(SearchIndexName.Explorers)] +
hitsLengthByIndexName[getIndexName(SearchIndexName.ExplorerViews)]

return (
<div className="search-filters">
<ul
Expand Down Expand Up @@ -366,38 +347,6 @@ const SearchResults = (props: SearchResultsProps) => {
/>
</section>
</NoResultsBoundary>
<Index indexName={getIndexName(SearchIndexName.Explorers)}>
<Configure
hitsPerPage={10}
distinct
clickAnalytics={hasClickAnalyticsConsent}
/>
<NoResultsBoundary>
<section className="search-results__explorers">
<header className="search-results__header">
<h2 className="h2-bold search-results__section-title">
Data Explorers
</h2>
<ShowMore
category={SearchIndexName.Explorers}
cutoffNumber={2}
activeCategoryFilter={activeCategoryFilter}
handleCategoryFilterClick={
handleCategoryFilterClick
}
/>
</header>
<Hits
classNames={{
root: "search-results__list-container",
list: "search-results__explorers-list grid grid-cols-2 grid-sm-cols-1",
item: "search-results__explorer-hit",
}}
hitComponent={ExplorerHit}
/>
</section>
</NoResultsBoundary>
</Index>
<Index indexName={getIndexName(SearchIndexName.ExplorerViews)}>
<Configure
hitsPerPage={10}
Expand All @@ -408,7 +357,7 @@ const SearchResults = (props: SearchResultsProps) => {
<section className="search-results__explorer-views">
<header className="search-results__header">
<h2 className="h2-bold search-results__section-title">
Data Explorer views
Data Explorers
</h2>
<ShowMore
category={SearchIndexName.ExplorerViews}
Expand Down

0 comments on commit 93fa1af

Please sign in to comment.