Features: 1) Add appStore integration for managing search overlay state in search.vue; 2) Enhance expiration date formatting in promocodes.vue with detailed and localized time display; 3) Replace avatar image handling in settings.vue with nuxt-img for better performance and format support;
Fixes: 1) Add missing type annotations for `isSearchActive` in `useSearchUi.ts`; 2) Resolve improper conditional rendering in empty state templates across multiple files; 3) Remove unnecessary `console.log` calls in `goTo` function; Extra: 1) Update SCSS styles including border thickness, colors, and padding tweaks; 2) Refactor `loader.vue` to use `<span>` instead of `<li>` for dots and adjust size; 3) Clean up obsolete TODOs, comments, and unused imports.
This commit is contained in:
parent
4957039fc5
commit
64730a1d4e
11 changed files with 49 additions and 21 deletions
|
|
@ -69,6 +69,7 @@ import { useSearchUI } from "@/composables/search";
|
||||||
|
|
||||||
const {t} = useI18n();
|
const {t} = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const appStore = useAppStore();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
query,
|
query,
|
||||||
|
|
@ -93,10 +94,17 @@ function submitSearch() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => isSearchActive.value,
|
||||||
|
(state) => {
|
||||||
|
appStore.setOverflowHidden(state);
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
|
||||||
function goTo(category: string, item: any) {
|
function goTo(category: string, item: any) {
|
||||||
let path = "/";
|
let path = "/";
|
||||||
console.log('c', category)
|
|
||||||
console.log(item)
|
|
||||||
switch (category) {
|
switch (category) {
|
||||||
case "products":
|
case "products":
|
||||||
path = `/product/${item.slug}`;
|
path = `/product/${item.slug}`;
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,8 @@ const { logout } = useLogout();
|
||||||
|
|
||||||
@include hover {
|
@include hover {
|
||||||
color: $accentDark;
|
color: $accentDark;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
border-color: #f5f5f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="loader">
|
<div class="loader">
|
||||||
<li class="loader__dots" id="dot-1"></li>
|
<span class="loader__dots" id="dot-1"></span>
|
||||||
<li class="loader__dots" id="dot-2"></li>
|
<span class="loader__dots" id="dot-2"></span>
|
||||||
<li class="loader__dots" id="dot-3"></li>
|
<span class="loader__dots" id="dot-3"></span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -17,8 +17,8 @@
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
|
||||||
&__dots {
|
&__dots {
|
||||||
width: 12px;
|
width: 10px;
|
||||||
height: 12px;
|
height: 10px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background-color: $white;
|
background-color: $white;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { useDebounceFn } from '@vueuse/core';
|
||||||
|
|
||||||
export function useSearchUI() {
|
export function useSearchUI() {
|
||||||
const query = ref('');
|
const query = ref('');
|
||||||
const isSearchActive = ref(false);
|
const isSearchActive = ref<boolean>(false);
|
||||||
const { search, loading, searchResults } = useSearch();
|
const { search, loading, searchResults } = useSearch();
|
||||||
|
|
||||||
const filteredSearchResults = computed(() => {
|
const filteredSearchResults = computed(() => {
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<client-only>
|
<client-only>
|
||||||
<div class="characteristics" id="characteristics">
|
<div class="characteristics" id="characteristics" v-if="attributes.length">
|
||||||
<div class="characteristics__wrapper">
|
<div class="characteristics__wrapper">
|
||||||
<h6 class="characteristics__title">{{ t('product.characteristics') }}</h6>
|
<h6 class="characteristics__title">{{ t('product.characteristics') }}</h6>
|
||||||
<div class="characteristics__list">
|
<div class="characteristics__list">
|
||||||
|
|
@ -330,7 +330,7 @@ watch(
|
||||||
gap: 25px;
|
gap: 25px;
|
||||||
|
|
||||||
&-description {
|
&-description {
|
||||||
color: $accent;
|
color: $black;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
:isToolsVisible="true"
|
:isToolsVisible="true"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<p class="cart__empty">{{ t('profile.cart.empty') }}</p>
|
<p class="cart__empty" v-else>{{ t('profile.cart.empty') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {usePageTitle} from "~/composables/utils";
|
import {usePageTitle} from "~/composables/utils";
|
||||||
import {useOrders} from "~/composables/orders";
|
import {useOrders} from "~/composables/orders";
|
||||||
import {CURRENCY, orderStatuses} from "~/config/constants";
|
import {orderStatuses} from "~/config/constants";
|
||||||
import {useDate} from "~/composables/date";
|
|
||||||
import {useRouteQuery} from "@vueuse/router";
|
import {useRouteQuery} from "@vueuse/router";
|
||||||
|
|
||||||
const {t} = useI18n();
|
const {t} = useI18n();
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,23 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="promocodes__item-right">
|
<div class="promocodes__item-right">
|
||||||
<p class="promocodes__item-text">{{ promocode.node.discount }} {{ promocode.node.discountType === 'percent' ? '%' : CURRENCY }}</p>
|
<p class="promocodes__item-text">{{ promocode.node.discount }} {{ promocode.node.discountType === 'percent' ? '%' : CURRENCY }}</p>
|
||||||
<div class="promocodes__item-expire">{{ t('profile.promocodes.until') }} {{ useDate(promocode.node.endTime, locale) }}</div>
|
<div class="promocodes__item-expire">
|
||||||
|
{{ t('profile.promocodes.until') }}
|
||||||
|
{{
|
||||||
|
useDate(promocode.node.endTime, locale, {
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'long',
|
||||||
|
day: '2-digit',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
second: '2-digit'
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p class="promocodes__empty">{{ t('profile.promocodes.empty') }}</p>
|
<p class="promocodes__empty" v-else>{{ t('profile.promocodes.empty') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -49,7 +61,7 @@ const copyCode = (code: string) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// TODO: display time for expire date
|
|
||||||
const { setPageTitle } = usePageTitle();
|
const { setPageTitle } = usePageTitle();
|
||||||
|
|
||||||
setPageTitle(t('breadcrumbs.promocodes'));
|
setPageTitle(t('breadcrumbs.promocodes'));
|
||||||
|
|
@ -73,7 +85,7 @@ setPageTitle(t('breadcrumbs.promocodes'));
|
||||||
|
|
||||||
&__item {
|
&__item {
|
||||||
border-radius: $default_border_radius;
|
border-radius: $default_border_radius;
|
||||||
border: 1px solid $accent;
|
border: 2px solid $accent;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
@ -82,7 +94,7 @@ setPageTitle(t('breadcrumbs.promocodes'));
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
padding: 7px 25px;
|
padding: 7px 15px;
|
||||||
|
|
||||||
& p {
|
& p {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,14 @@
|
||||||
<div class="settings__avatar">
|
<div class="settings__avatar">
|
||||||
<input type="file" id="avatar" @change="uploadAvatar" />
|
<input type="file" id="avatar" @change="uploadAvatar" />
|
||||||
<label for="avatar">
|
<label for="avatar">
|
||||||
<img class="settings__avatar-image" v-if="user?.avatar" :src="user?.avatar" alt="">
|
<nuxt-img
|
||||||
|
class="settings__avatar-image"
|
||||||
|
v-if="user?.avatar"
|
||||||
|
:src="user?.avatar"
|
||||||
|
alt="avatar"
|
||||||
|
format="webp"
|
||||||
|
densities="x1"
|
||||||
|
/>
|
||||||
<icon name="material-symbols-light:person-outline-rounded" size="100" v-else />
|
<icon name="material-symbols-light:person-outline-rounded" size="100" v-else />
|
||||||
<span class="settings__avatar-inner">
|
<span class="settings__avatar-inner">
|
||||||
<icon name="material-symbols:upload" size="40" />
|
<icon name="material-symbols:upload" size="40" />
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p class="wishlist__empty">{{ t('profile.wishlist.empty') }}</p>
|
<p class="wishlist__empty" v-else>{{ t('profile.wishlist.empty') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ export default defineNuxtPlugin((nuxtApp) => {
|
||||||
const runtime = useRuntimeConfig();
|
const runtime = useRuntimeConfig();
|
||||||
const localeCookie = useCookie(useAppConfig().COOKIES_LOCALE_KEY);
|
const localeCookie = useCookie(useAppConfig().COOKIES_LOCALE_KEY);
|
||||||
const token = useCookie(useAppConfig().COOKIES_ACCESS_TOKEN_KEY).value || '';
|
const token = useCookie(useAppConfig().COOKIES_ACCESS_TOKEN_KEY).value || '';
|
||||||
const { $apollo } = nuxtApp;
|
const { $apollo } = nuxtApp as any;
|
||||||
|
|
||||||
const errorLink = onError((err) => {
|
const errorLink = onError((err) => {
|
||||||
nuxtApp.callHook('apollo:error', err);
|
nuxtApp.callHook('apollo:error', err);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue