Skip to content

Commit

Permalink
Merge pull request #157 from jailsonacct/feature/qta-38
Browse files Browse the repository at this point in the history
QTA-138-Added prop alwaysShowAddToCart  show add to cart button quick order
  • Loading branch information
Rudge authored Aug 24, 2023
2 parents 03cf924 + 63fab60 commit 248043c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Added

- Added prop alwaysShowAddToCart to hide or show the add to cart button when there was an invalid SKU

## [3.12.7] - 2023-03-28

### Added

- Define product result limit for category component

## [3.12.6] - 2023-02-14

### Fixed

- Bug fixed on UI adding to cart flow

- Bug fixed on UI adding to cart flow

### Added

Expand All @@ -36,7 +40,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [3.12.4] - 2022-12-13

### Changed

- Fixed XLSX package version

## [3.12.3] - 2022-11-23

### Added
Expand Down
4 changes: 3 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ To use these blocks, follow the instructions below.
"componentOnly": false,
"text": "Upload",
"description": "Upload a Spreadsheet with two columns (SKU, Quantity) to bulk order",
"downloadText": "Click here to download a spreadsheet model"
"downloadText": "Click here to download a spreadsheet model",
"alwaysShowAddToCart:": true
}
},

Expand Down Expand Up @@ -164,6 +165,7 @@ Especially, the `quickorder-upload` block also can use the following prop:
| Prop name | Type | Description | Default value |
| -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------- |
| `downloadText` | `string` | Defines a text for the spreadsheet download button. Use this prop to explain users how to properly download the spreadsheet model provided by the component. | `undefined` |
| `alwaysShowAddToCart` | `boolean` | Property that defines if the add to cart button will appear even if it has some invalid Sku. | `undefined` |

In addition, the `quickorder-upload` and the `quickorder-textarea` block can use the following prop:

Expand Down
9 changes: 4 additions & 5 deletions react/UploadBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const UploadBlock: FunctionComponent<
downloadText,
componentOnly,
intl,
alwaysShowAddToCart,
}: any) => {
let productsArray: any = []
const [state, setState] = useState<any>({
Expand Down Expand Up @@ -115,16 +116,13 @@ const UploadBlock: FunctionComponent<

const onReviewItems = (items: any) => {
if (items) {
const show =
items.filter((item: any) => {
return item.error
}).length === 0
const show = !items.some((item: any) => item.error)

setState({
...state,
reviewItems: items,
reviewState: true,
showAddToCart: show,
showAddToCart: alwaysShowAddToCart || show,
textAreaValue: GetText(items),
})
}
Expand Down Expand Up @@ -478,6 +476,7 @@ interface UploadBlockInterface {
description?: string
componentOnly?: boolean
downloadText?: string
alwaysShowAddToCart?: boolean
}

export default injectIntl(UploadBlock)
5 changes: 5 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sonar.projectKey=vtex-apps_quickorder
sonar.organization=vtex-apps
sonar.coverage.exclusions=**/*.test.*, */__mocks__/**.*, */node_modules/**.*, node/index.ts
sonar.language=ts
sonar.javascript.lcov.reportPaths=./node/coverage/lcov.info

0 comments on commit 248043c

Please sign in to comment.