Repository navigation
feat: meilisearch rework #526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
apps/herbatika/src/components/search/search-entity-results.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| 'use client' | ||
|
|
||
| import { Link } from '@techsio/ui-kit/atoms/link' | ||
| import NextLink from 'next/link' | ||
| import type { SearchAutocompleteSuggestion, SearchAutocompleteResponse } from '@/lib/search-autocomplete/search-autocomplete-types' | ||
| import { SearchAutocompleteMedia } from './search-autocomplete-media' | ||
|
|
||
| type SearchEntityResultSectionProps = { | ||
| items: SearchAutocompleteSuggestion[] | ||
| title: string | ||
| } | ||
|
|
||
| type SearchEntityResultsProps = Pick<SearchAutocompleteResponse, 'brands' | 'categories' | 'content'> | ||
|
|
||
| function SearchEntityResultSection({ items, title }: SearchEntityResultSectionProps) { | ||
| if (items.length === 0) { | ||
| return null | ||
| } | ||
|
|
||
| return ( | ||
| <section className = 'space-y-200'> | ||
| <h3 className = 'font-semibold text-fg-primary text-lg'> | ||
| { title } | ||
| </h3> | ||
|
|
||
| <ul className = 'grid gap-300 sm:grid-cols-2 lg:grid-cols-3'> | ||
| { | ||
| items.map((item) => ( | ||
| <li key = { item.type + '-' + item.id }> | ||
| <Link | ||
| as = { NextLink } | ||
| className = 'group flex h-full min-w-0 items-center gap-300 rounded-lg border border-border-secondary bg-surface px-400 py-250 text-fg-primary shadow-sm transition-colors hover:border-primary/30 hover:bg-fill-secondary' | ||
| href = { item.href } | ||
| > | ||
| <SearchAutocompleteMedia | ||
| item = { item } | ||
| /> | ||
|
|
||
| <span className = 'min-w-0'> | ||
| <span className = 'block truncate font-semibold text-sm'> | ||
| { item.title } | ||
| </span> | ||
|
|
||
| { | ||
| item.subtitle ? ( | ||
| <span className = 'block truncate text-fg-secondary text-xs'> | ||
| { item.subtitle } | ||
| </span> | ||
| ) : null | ||
| } | ||
| </span> | ||
| </Link> | ||
| </li> | ||
| )) | ||
| } | ||
| </ul> | ||
| </section> | ||
| ) | ||
| } | ||
|
|
||
| export function SearchEntityResults({ brands, categories, content }: SearchEntityResultsProps) { | ||
| if (brands.length + categories.length + content.length === 0) { | ||
| return null | ||
| } | ||
|
|
||
| return ( | ||
| <section | ||
| aria-labelledby = 'search-related-results-heading' | ||
| className = 'space-y-400 rounded-lg border border-border-secondary bg-base p-400' | ||
| > | ||
| <h2 | ||
| className = 'font-bold text-2xl text-fg-primary' | ||
| id = 'search-related-results-heading' | ||
| > | ||
| Súvisiace výsledky | ||
| </h2> | ||
|
|
||
| <SearchEntityResultSection | ||
| items = { categories } | ||
| title = 'Kategórie' | ||
| /> | ||
|
|
||
| <SearchEntityResultSection | ||
| items = { brands } | ||
| title = 'Výrobcovia' | ||
| /> | ||
|
|
||
| <SearchEntityResultSection | ||
| items = { content } | ||
| title = 'Obsah' | ||
| /> | ||
| </section> | ||
| ) | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
fix: localise the entity-result labels.
The component renders Slovak labels directly. Non-Slovak locales will show these labels in Slovak.
Use
useTranslations("search")and add translation keys for the related-results heading and each entity section. Keep the keys consistent withSearchResults.🤖 Prompt for AI Agents