Skip to content

Commit

Permalink
Show TBA in case of undefined or null price
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffersontuc committed Sep 19, 2019
1 parent 16ec74e commit 4848e53
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## Added

- Show TBA in case of undefined or null price.

## [0.1.0] - 2019-08-28

## Added
Expand Down
3 changes: 2 additions & 1 deletion messages/context.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"store/price.Free": "FREE"
"store/price.Free": "FREE",
"store/price.TBA": "TBA"
}
3 changes: 2 additions & 1 deletion messages/en.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"store/price.Free": "FREE"
"store/price.Free": "FREE",
"store/price.TBA": "TBA"
}
3 changes: 2 additions & 1 deletion messages/es.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"store/price.Free": "GRATIS"
"store/price.Free": "GRATIS",
"store/price.TBA": "TBA"
}
3 changes: 2 additions & 1 deletion messages/pt.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"store/price.Free": "GRÁTIS"
"store/price.Free": "GRÁTIS",
"store/price.TBA": "TBA"
}
7 changes: 7 additions & 0 deletions react/FormattedPrice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ defineMessages({
id: 'store/price.Free',
defaultMessage: 'FREE',
},

TBA: {
id: 'store/price.TBA',
defaultMessage: 'TBA',
},
})

const FormattedPrice: FC<FormattedPriceProps & InjectedIntlProps> = ({
Expand All @@ -21,6 +26,8 @@ const FormattedPrice: FC<FormattedPriceProps & InjectedIntlProps> = ({
<Fragment>
{value === 0 ? (
<FormattedMessage id="store/price.Free" />
) : value === null || value === undefined ? (
<FormattedMessage id="store/price.TBA" />
) : (
<FormattedCurrency value={value} />
)}
Expand Down

0 comments on commit 4848e53

Please sign in to comment.