Skip to content

Commit

Permalink
refactor: rename PricePrice to PricePriceRow
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Apr 12, 2024
1 parent c6ed008 commit 13a3797
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/components/PriceCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<v-img v-if="product && product.image_url" :src="product.image_url" style="max-height:100px;width:100px" @click="goToProduct()"></v-img>
<v-img v-else :src="productImageDefault" style="height:100px;width:100px;filter:invert(.9);"></v-img>
</v-col>
<v-col style="max-width:75%">
<v-col :style="hideProductImage ? '' : 'max-width:75%'">
<h3 v-if="!hideProductTitle" @click="goToProduct()">{{ getPriceProductTitle() }}</h3>

<p v-if="!hideProductDetails && !hasCategoryTag" class="mb-2">
Expand All @@ -23,7 +23,7 @@
</span>
</p>

<PricePrice v-if="price" :price="price" :productQuantity="product ? product.product_quantity : null" :productQuantityUnit="product ? product.product_quantity_unit : null" :hidePriceDate="hidePriceDate"></PricePrice>
<PricePriceRow v-if="price" :price="price" :productQuantity="product ? product.product_quantity : null" :productQuantityUnit="product ? product.product_quantity_unit : null" :hidePriceDate="hidePriceDate"></PricePriceRow>
</v-col>
</v-row>

Expand All @@ -43,7 +43,7 @@ export default {
'ProductMissingChip': defineAsyncComponent(() => import('../components/ProductMissingChip.vue')),
'PriceOrigins': defineAsyncComponent(() => import('../components/PriceOrigins.vue')),
'PriceLabels': defineAsyncComponent(() => import('../components/PriceLabels.vue')),
'PricePrice': defineAsyncComponent(() => import('../components/PricePrice.vue')),
'PricePriceRow': defineAsyncComponent(() => import('../components/PricePriceRow.vue')),
'PriceFooterRow': defineAsyncComponent(() => import('../components/PriceFooterRow.vue'))
},
props: {
Expand Down
32 changes: 17 additions & 15 deletions src/components/PricePrice.vue → src/components/PricePriceRow.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
<template>
<p>
<span class="mr-1">{{ getPriceValueDisplay(priceValue) }}</span>
<span v-if="hasProductQuantity" class="mr-1">({{ getPricePerUnit(priceValue) }})</span>
<span v-if="price.price_is_discounted">
<v-chip class="mr-1" color="red" variant="outlined" size="small" density="comfortable">
{{ $t('PriceCard.Discount') }}
<v-tooltip v-if="priceWithoutDiscountValue" activator="parent" open-on-click location="top">{{ $t('PriceCard.FullPrice') }} {{ getPriceValueDisplay(priceWithoutDiscountValue) }}</v-tooltip>
</v-chip>
</span>
<i18n-t v-if="!hidePriceDate" keypath="PriceCard.PriceDate" tag="span">
<template v-slot:date>
<i>{{ getDateFormatted(price.date) }}</i>
</template>
</i18n-t>
</p>
<v-row style="margin-top:0;">
<v-col cols="12">
<span class="mr-1">{{ getPriceValueDisplay(priceValue) }}</span>
<span v-if="hasProductQuantity" class="mr-1">({{ getPricePerUnit(priceValue) }})</span>
<span v-if="price.price_is_discounted">
<v-chip class="mr-1" color="red" variant="outlined" size="small" density="comfortable">
{{ $t('PriceCard.Discount') }}
<v-tooltip v-if="priceWithoutDiscountValue" activator="parent" open-on-click location="top">{{ $t('PriceCard.FullPrice') }} {{ getPriceValueDisplay(priceWithoutDiscountValue) }}</v-tooltip>
</v-chip>
</span>
<i18n-t v-if="!hidePriceDate" keypath="PriceCard.PriceDate" tag="span">
<template v-slot:date>
<i>{{ getDateFormatted(price.date) }}</i>
</template>
</i18n-t>
</v-col>
</v-row>
</template>

<script>
Expand Down
4 changes: 2 additions & 2 deletions src/components/ProductCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<v-sheet v-if="latestPrice">
<v-divider class="mt-2 mb-2"></v-divider>
<h4>{{ $t('ProductCard.LatestPrice') }}</h4>
<PricePrice :price="latestPrice" :productQuantity="product.product_quantity" :productQuantityUnit="product.product_quantity_unit"></PricePrice>
<PricePriceRow :price="latestPrice" :productQuantity="product.product_quantity" :productQuantityUnit="product.product_quantity_unit"></PricePriceRow>
<PriceFooterRow :price="latestPrice"></PriceFooterRow>
</v-sheet>
</v-container>
Expand All @@ -46,7 +46,7 @@ export default {
'ProductCategoriesChip': defineAsyncComponent(() => import('../components/ProductCategoriesChip.vue')),
'ProductLabelsChip': defineAsyncComponent(() => import('../components/ProductLabelsChip.vue')),
'ProductMissingChip': defineAsyncComponent(() => import('../components/ProductMissingChip.vue')),
'PricePrice': defineAsyncComponent(() => import('../components/PricePrice.vue')),
'PricePriceRow': defineAsyncComponent(() => import('../components/PricePriceRow.vue')),
'PriceFooterRow': defineAsyncComponent(() => import('../components/PriceFooterRow.vue')),
},
props: {
Expand Down

0 comments on commit 13a3797

Please sign in to comment.