Skip to content

Commit

Permalink
Merge pull request #166 from rayssamfreitas/master
Browse files Browse the repository at this point in the history
fix to show product name on autocomplete options
  • Loading branch information
ataideverton authored Jun 13, 2024
2 parents 6556a03 + 8b904bb commit c9dda79
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
"changeProcessCWD": true
}
]
}
}
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [3.15.3] - 2024-06-10

### Changed

- Adjust autocomplete list to show product name rather than just the product sku name

## [3.15.2] - 2024-06-10

## [3.15.1] - 2024-05-27
Expand Down Expand Up @@ -587,4 +591,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Added

- Add css handles to selected sku on AutoComplete block.
- Add css handles to selected sku on AutoComplete block.
4 changes: 3 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@
},
"free": true,
"type": "free",
"availableCountries": ["*"]
"availableCountries": [
"*"
]
},
"$schema": "https://raw.githubusercontent.com/vtex/node-vtex-api/master/gen/manifest.schema"
}
32 changes: 15 additions & 17 deletions react/components/QuickOrderAutocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@ const CustomOption = (props: any) => {
)
}

const buttonClasses = `${
handles.customOptionButton
} bn w-100 tl pointer pa4 f6 ${roundedBottom ? 'br2 br--bottom' : ''} ${
highlightOption || selected ? 'bg-muted-5' : 'bg-base'
}`
const buttonClasses = `${handles.customOptionButton

Check failure on line 52 in react/components/QuickOrderAutocomplete.tsx

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Insert `⏎····`
} bn w-100 tl pointer pa4 f6 ${roundedBottom ? 'br2 br--bottom' : ''} ${highlightOption || selected ? 'bg-muted-5' : 'bg-base'

Check failure on line 53 in react/components/QuickOrderAutocomplete.tsx

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Replace `····}·bn·w-100·tl·pointer·pa4·f6·${roundedBottom·?·'br2·br--bottom'·:·''}·${` with `··}·bn·w-100·tl·pointer·pa4·f6·${roundedBottom·?·'br2·br--bottom'·:·''}·${⏎····`
}`

Check failure on line 54 in react/components/QuickOrderAutocomplete.tsx

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Delete `··`

const thumb = value.thumb ? value.thumb : ''

Expand Down Expand Up @@ -116,17 +114,17 @@ const QuickOrderAutocomplete: FunctionComponent<
value: !term.length
? []
: optionsResult
.filter((item: any) => {
return !!item.items[0].images[0].imageUrl
})
.map((item: any) => {
return {
value: item.items[0].itemId,
label: item.items[0].name,
slug: item.linkText,
thumb: getImageSrc(item.items[0].images[0].imageUrl),
}
}),
.filter((item: any) => {

Check failure on line 117 in react/components/QuickOrderAutocomplete.tsx

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Insert `··`
return !!item.items[0].images[0].imageUrl

Check failure on line 118 in react/components/QuickOrderAutocomplete.tsx

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Insert `··`
})

Check failure on line 119 in react/components/QuickOrderAutocomplete.tsx

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Insert `··`
.map((item: any) => {

Check failure on line 120 in react/components/QuickOrderAutocomplete.tsx

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Insert `··`
return {

Check failure on line 121 in react/components/QuickOrderAutocomplete.tsx

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Insert `··`
value: item.items[0].itemId,

Check failure on line 122 in react/components/QuickOrderAutocomplete.tsx

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Replace `············` with `··············`
label: item.productName,

Check failure on line 123 in react/components/QuickOrderAutocomplete.tsx

View workflow job for this annotation

GitHub Actions / QE / Lint Node.js

Insert `··`
slug: item.linkText,
thumb: getImageSrc(item.items[0].images[0].imageUrl),
}
}),
lastSearched: {
value: lastSearched,
label: 'Last searched products',
Expand Down Expand Up @@ -156,7 +154,7 @@ const QuickOrderAutocomplete: FunctionComponent<
setTerm(nterm)
}
},
onSearch: () => () => {},
onSearch: () => () => { },
onClear: () => setTerm(''),
placeholder: intl.formatMessage(messages.placeholder),
value: term,
Expand Down
2 changes: 2 additions & 0 deletions react/queries/autocomplete.gql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ query Autocomplete($inputValue: String!) {
productSuggestions(fullText: $inputValue, hideUnavailableItems: true)
@context(provider: "vtex.search-graphql") {
products {
productName
productId
items {
itemId
name
Expand Down

0 comments on commit c9dda79

Please sign in to comment.