schon/storefront/app/pages/profile/promocodes.vue
Alexandr SaVBaD Waltz 556354a44d feat(storefront): overhaul theming system and unify SCSS variables
Revamped the theming system with new SCSS variables for consistent styling across light and dark themes. Replaced static color values with dynamic variables for maintainability and improved theme adaptability. Updated components and layouts to use the new variables.

- Moved theme plugin logic for optimized handling of theme cookies and attributes.
- Enhanced `useThemes` composable for simplified client-side updates and SSR support.
- Replaced redundant SCSS color definitions with centralized variables.
- Improved page structure by introducing `ui-title` for reusable section headers.
- Unified transitions and border-radius for consistent design language.

Breaking Changes:
Theming system restructured—migrate to `$main`, `$primary`, and related variables for SCSS colors. Remove usage of `--color-*` variables in templates and styles.
2026-03-01 20:16:05 +03:00

149 lines
No EOL
3.3 KiB
Vue

<template>
<div class="promocodes">
<h2 class="promocodes__title">{{ t('profile.promocodes.title') }}</h2>
<div class="promocodes__list" v-if="promocodes?.length">
<div
class="promocodes__item"
v-for="promocode in promocodes"
:key="promocode.node.uuid"
>
<div class="promocodes__item-left">
<icon
name="material-symbols:content-copy"
size="20"
class="promocodes__item-button"
@click="copyCode(promocode.node.code)"
/>
<p>{{ promocode.node.code }}</p>
</div>
<div class="promocodes__item-right">
<p class="promocodes__item-text">{{ promocode.node.discount }} {{ promocode.node.discountType === 'percent' ? '%' : '$' }}</p>
<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>
<p class="promocodes__empty" v-else>{{ t('profile.promocodes.empty') }}</p>
</div>
</template>
<script setup lang="ts">
import {usePageTitle} from '@composables/utils';
import {useDate} from '@composables/date';
const {t, locale} = useI18n();
const { $notify } = useNuxtApp();
const promocodeStore = usePromocodeStore();
const promocodes = computed(() => promocodeStore.promocodes);
const copyCode = (code: string) => {
navigator.clipboard.writeText(code)
.then(() => {
$notify({
message: t('popup.success.promocodeCopy'),
type: 'success'
});
})
.catch(err => {
console.error(err);
});
};
const { setPageTitle } = usePageTitle();
setPageTitle(t('breadcrumbs.promocodes'));
</script>
<style lang="scss" scoped>
.promocodes {
background-color: $main;
width: 100%;
border: 1px solid $border;
border-radius: $default_border_radius;
height: fit-content;
padding: 24px 32px;
&__title {
color: $primary;
font-family: "Playfair Display", sans-serif;
font-size: 24px;
font-weight: 700;
}
&__list {
margin-top: 50px;
display: flex;
flex-direction: column;
gap: 20px;
}
&__item {
border-radius: $less_border_radius;
border: 1px solid $border;
display: flex;
align-items: stretch;
justify-content: space-between;
&-left {
display: flex;
align-items: center;
gap: 20px;
padding: 7px 15px;
& p {
color: $secondary;
font-size: 16px;
font-weight: 400;
}
}
&-button {
cursor: pointer;
color: $secondary;
@include hover {
color: $secondary_hover;
}
}
&-right {
display: flex;
align-items: center;
gap: 20px;
}
&-text {
color: $secondary;
font-size: 16px;
font-weight: 700;
}
&-expire {
height: 100%;
background-color: $border;
padding-inline: 15px;
display: grid;
place-items: center;
color: $secondary;
}
}
&__empty {
margin-top: 50px;
font-weight: 600;
}
}
</style>