Skip to content

Commit

Permalink
[VectorSearch] #1279426 - Add description as tooltip in list
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreGauthier committed Mar 11, 2024
1 parent f130f1b commit e9214aa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ function ProductList(props: IProps): JSX.Element {
return (
<tr key={item.id}>
<td>{item.sku}</td>
<td>{item.name}</td>
<td title={item.description ? item.description.replace(/(<([^>]+)>)/, '') : ''}>
{item.name}
</td>
<RightAlignedCell>{item.score.toFixed(4)}</RightAlignedCell>
</tr>
)
Expand Down
5 changes: 5 additions & 0 deletions front/example-app/src/services/vectorSearchDocuments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ export function transformVectorSearchDocumentsIntoProducts(
document.source.name.length > 0
? (document.source?.name[0] as string)
: '',
description:
Array.isArray(document.source?.description) &&
document.source.description.length > 0
? (document.source?.description[0] as string)
: '',
score: Number(document.score),
image: document.source?.image as string,
stock: document.source?.stock ?? undefined,
Expand Down
1 change: 1 addition & 0 deletions front/example-app/src/types/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface IProductsHook extends IEntitiesHook {
export interface IProduct extends Omit<IGraphqlProduct, 'price'> {
price?: number
image?: string
description?: string
}

export interface IProductAutoComplete extends IProduct {
Expand Down

0 comments on commit e9214aa

Please sign in to comment.