Fixes: 1) Replace deprecated context usage in `useAvatarUpload` mutation; 2) Resolve incorrect locale parsing in `useDate` utility and fix non-reactive cart state in `profile/cart.vue`; 3) Update stale imports and standardize type naming across composables; Extra: 1) Refactor i18n strings including order status and search-related texts; 2) Replace temporary workarounds with `apollo-upload-client` configuration and add `apollo-upload-link.ts` plugin; 3) Cleanup redundant files, comments, and improve SCSS structure with new variables and placeholders.
97 lines
No EOL
2.3 KiB
Vue
97 lines
No EOL
2.3 KiB
Vue
<template>
|
|
<div class="cart">
|
|
<div class="cart__top">
|
|
<div class="cart__top-left">
|
|
<p><span>{{ t('profile.cart.quantity') }}</span> {{ productsInCartQuantity }}</p>
|
|
<p><span>{{ t('profile.cart.total') }}: </span> {{ totalPrice }}{{ CURRENCY }}</p>
|
|
</div>
|
|
<ui-button class="cart__top-button">{{ t('buttons.checkout') }}</ui-button>
|
|
</div>
|
|
<div class="cart__list">
|
|
<div class="cart__list-inner" v-if="productsInCart.length">
|
|
<cards-product
|
|
v-for="product in productsInCart"
|
|
:key="product.node.uuid"
|
|
:product="product.node.product"
|
|
:isList="true"
|
|
:isToolsVisible="true"
|
|
/>
|
|
</div>
|
|
<p class="cart__empty">{{ t('profile.cart.empty') }}</p>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import {usePageTitle} from "~/composables/utils";
|
|
import {CURRENCY} from "~/config/constants";
|
|
|
|
const {t} = useI18n();
|
|
const cartStore = useCartStore();
|
|
|
|
const productsInCart = computed(() => {
|
|
return cartStore.currentOrder ? cartStore.currentOrder.orderProducts.edges : [];
|
|
});
|
|
const totalPrice = computed(() => {
|
|
return cartStore.currentOrder ? cartStore.currentOrder.totalPrice : 0;
|
|
});
|
|
const productsInCartQuantity = computed(() => {
|
|
let count = 0;
|
|
cartStore.currentOrder?.orderProducts?.edges.forEach((el) => {
|
|
count = count + el.node.quantity;
|
|
});
|
|
|
|
return count;
|
|
});
|
|
|
|
const { setPageTitle } = usePageTitle();
|
|
|
|
setPageTitle(t('breadcrumbs.cart'));
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.cart {
|
|
width: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 50px;
|
|
|
|
&__top {
|
|
width: 100%;
|
|
background-color: $white;
|
|
padding: 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
box-shadow: 0 0 20px 2px rgba(0, 0, 0, 0.2);
|
|
border-radius: $default_border_radius;
|
|
|
|
& p {
|
|
font-weight: 600;
|
|
}
|
|
|
|
&-button {
|
|
width: fit-content;
|
|
padding-inline: 20px;
|
|
}
|
|
}
|
|
|
|
&__list {
|
|
width: 100%;
|
|
padding: 20px;
|
|
background-color: $white;
|
|
box-shadow: 0 0 20px 2px rgba(0, 0, 0, 0.2);
|
|
border-radius: $default_border_radius;
|
|
|
|
&-inner {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 20px;
|
|
}
|
|
}
|
|
|
|
&__empty {
|
|
font-weight: 600;
|
|
}
|
|
}
|
|
</style> |