Skip to content

Commit

Permalink
refactor(Products): show error message if product source unknown. ref #…
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Feb 8, 2025
1 parent 99b3ba6 commit 46bedd0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/ProductMissingChip.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<v-chip label size="small" density="comfortable" color="error" data-name="product-missing-chip">
{{ $t('PriceCard.UnknownProduct') }}
{{ $t('Common.UnknownProduct') }}
</v-chip>
</template>
11 changes: 9 additions & 2 deletions src/components/ProductSourceChip.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<v-chip
v-if="hasProductSource"
:style="style"
label
size="small"
Expand All @@ -10,6 +11,9 @@
{{ getProductSourceName }}
</v-tooltip>
</v-chip>
<v-chip v-else label size="small" density="comfortable" color="error" data-name="product-source-missing-chip">
{{ $t('Common.UnknownSource') }}
</v-chip>
</template>

<script>
Expand All @@ -27,14 +31,17 @@ export default {
},
},
computed: {
hasProductSource() {
return !!this.product.source
},
getProductSourceIcon() {
if (this.product.source) {
if (this.hasProductSource) {
return constants[`${this.product.source.toUpperCase()}_ICON`]
}
return null
},
getProductSourceName() {
if (this.product.source) {
if (this.hasProductSource) {
return constants[`${this.product.source.toUpperCase()}_NAME`]
}
return null
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@
"Truncate": "Truncate",
"Truncated": "Truncated",
"Type": "Type",
"UnknownProduct":"Unknown product",
"UnknownProductSource": "Unknown product source",
"UnknownSource": "Unknown source",
"Unreadable": "Unreadable",
"Upload": "Upload",
"UploadMultipleImages": "Upload {count} image | Upload {count} images",
Expand Down

0 comments on commit 46bedd0

Please sign in to comment.