Compare commits

17 Commits

Author SHA1 Message Date
Veselov
a2ca4ec35e add README.md
Some checks failed
Deploy / build-and-deploy (push) Failing after 6s
2025-08-10 13:46:48 +03:00
Veselov
316d305cba index.vue
Some checks failed
Deploy / build-and-deploy (push) Failing after 7s
2025-08-10 13:43:32 +03:00
Veselov
b4bb0f9036 index.vue
Some checks failed
Deploy / build-and-deploy (push) Failing after 5s
2025-08-04 16:41:09 +03:00
Veselov
e2e031b7c5 add nuxt/ui
Some checks failed
Deploy / build-and-deploy (push) Failing after 7s
2025-08-04 01:24:20 +03:00
Никита Круглицкий
e5d0c2464d ci/cd
Some checks failed
Deploy / build-and-deploy (push) Failing after 5s
2025-07-31 06:01:42 +06:00
Никита Круглицкий
9e6eb9f8b2 ci/cd
Some checks failed
Deploy / build-and-deploy (push) Failing after 5s
2025-07-31 06:00:52 +06:00
Никита Круглицкий
c0fa763ce8 ci/cd
Some checks failed
Deploy / build-and-deploy (push) Failing after 9s
2025-07-31 05:54:24 +06:00
Никита Круглицкий
b78155bb6a ci/cd
Some checks failed
Deploy / build-and-deploy (push) Failing after 5s
2025-07-31 05:53:54 +06:00
Никита Круглицкий
eb1941c16a ci/cd
Some checks failed
Deploy / build-and-deploy (push) Failing after 5s
2025-07-31 05:45:30 +06:00
Никита Круглицкий
b0138067b2 ci/cd
Some checks failed
Deploy / build-and-deploy (push) Failing after 38s
2025-07-31 05:41:50 +06:00
Никита Круглицкий
28f8b038c1 ci/cd
Some checks failed
Deploy / build-and-deploy (push) Failing after 34s
2025-07-31 05:38:40 +06:00
Никита Круглицкий
2d96a0d9e7 ci/cd
Some checks failed
Deploy / build-and-deploy (push) Failing after 40s
2025-07-31 05:22:25 +06:00
Veselov
bce683c0eb from v1 to v3
Some checks failed
Deploy / build-and-deploy (push) Failing after 37s
2025-07-28 18:47:33 +03:00
Veselov
cd32863494 Страница по uid
Some checks failed
Deploy / build-and-deploy (push) Failing after 29s
2025-07-28 17:49:59 +03:00
Veselov
c5603e6789 Merge branch 'from-WP2-to-WC3'
Some checks failed
Deploy / build-and-deploy (push) Failing after 39s
2025-07-28 15:29:38 +03:00
Никита Круглицкий
7baf2fbf0c ci/cd
Some checks failed
Deploy / build-and-deploy (push) Failing after 1m5s
2025-07-24 14:29:23 +06:00
Никита Круглицкий
0905a4662e ci/cd
Some checks failed
Deploy / build-and-deploy (push) Failing after 30s
2025-07-24 14:22:36 +06:00
31 changed files with 9731 additions and 4534 deletions

View File

@@ -10,8 +10,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: LS
run: cd / && cat .dockerenv
- name: Test SSH access
run: ssh -Tv git@koptilnya.xyz
- name: Checkout code
uses: actions/checkout@v4
with:
ssh-key: '${{ secrets.SSH_PRIVATE_KEY }}'
ssh-strict: false
persist-credentials: false
- name: Install dependencies
run: |

View File

@@ -1,75 +1,7 @@
# Nuxt Minimal Starter
node.js 20.19.0
Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
yarn
## Setup
Make sure to install dependencies:
```bash
# npm
npm install
# pnpm
pnpm install
# yarn
yarn install
# bun
bun install
```
## Development Server
Start the development server on `http://localhost:3000`:
```bash
# npm
npm run dev
# pnpm
pnpm dev
# yarn
yarn dev
# bun
bun run dev
```
## Production
Build the application for production:
```bash
# npm
npm run build
# pnpm
pnpm build
# yarn
yarn build
# bun
bun run build
```
Locally preview production build:
```bash
# npm
npm run preview
# pnpm
pnpm preview
# yarn
yarn preview
# bun
bun run preview
```
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
https://wp.koptilnya.xyz/wp-admin/edit.php?post_type=product

12724
api/Api.ts

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
import api from '~/api/instance'
export const getProductsDetail = async (productId: number) =>
await api.wc.v1ProductsDetail(productId)
await api.wc.v3ProductsDetail(productId)

View File

@@ -0,0 +1,4 @@
import api from '~/api/instance'
export const getProductsVariationsList = async (productId: number) =>
await api.wc.v3ProductsVariationsList(productId)

View File

@@ -1 +1,2 @@
export * from './getProductsDetail'
export * from './getProductsVariationsList'

View File

@@ -1 +1,2 @@
export * from './useGetProductsDetail'
export * from './useGetProductsVariationsList'

View File

@@ -1,14 +1,10 @@
import { useQuery } from '@tanstack/vue-query'
import { unref, watch } from 'vue'
import { unref } from 'vue'
import { getProductsDetail } from '~/api/endpoints'
export const useGetProductsDetail = (productId: MaybeRef<number>) => {
const q = useQuery({
queryKey: ['get-products-detail', unref(productId)],
return useQuery({
queryKey: ['get-products-detail', productId],
queryFn: () => getProductsDetail(unref(productId)),
})
watch(() => productId, () => q.refetch())
return q
}

View File

@@ -0,0 +1,10 @@
import { useQuery } from '@tanstack/vue-query'
import { unref } from 'vue'
import { getProductsVariationsList } from '~/api/endpoints'
export const useGetProductsVariationsList = (productId: MaybeRef<number>) => {
return useQuery({
queryKey: ['get-products-variations-list', productId],
queryFn: () => getProductsVariationsList(unref(productId)),
})
}

View File

@@ -1,11 +1,7 @@
<template>
<div>
<UApp>
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
</div>
</UApp>
</template>
<style lang="scss">
@use '@/assets/scss/main' as *;
</style>

2
assets/css/main.css Normal file
View File

@@ -0,0 +1,2 @@
@import "tailwindcss";
@import "@nuxt/ui";

View File

@@ -1,6 +0,0 @@
// Breakpoints
$breakpoint-sm: 576px;
$breakpoint-md: 768px;
$breakpoint-lg: 992px;
$breakpoint-xl: 1200px;
$breakpoint-xxl: 1400px;

View File

@@ -1,70 +0,0 @@
/* Modern CSS Reset */
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
/* Remove default margin and padding */
body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
margin: 0;
}
/* Set core body defaults */
body {
min-height: 100vh;
scroll-behavior: smooth;
text-rendering: optimizeSpeed;
line-height: 1.5;
}
/* Remove list styles on ul, ol elements */
ul,
ol {
list-style: none;
}
/* A elements that don't have a class get default styles */
a:not([class]) {
text-decoration-skip-ink: auto;
}
/* Make images easier to work with */
img,
picture {
max-width: 100%;
display: block;
}
/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
font: inherit;
}
/* Remove all animations and transitions for people that prefer not to see them */
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}

View File

@@ -1,88 +0,0 @@
// Brand Colors
$brand-primary: #4f46e5; // Основной цвет бренда
$brand-secondary: #10b981; // Вторичный цвет бренда
// Neutral Colors
$neutral-50: #f9fafb; // Самый светлый оттенок
$neutral-100: #f3f4f6; // Светлый фон
$neutral-200: #e5e7eb; // Светлая граница
$neutral-300: #d1d5db; // Светлый текст
$neutral-400: #9ca3af; // Неактивный текст
$neutral-500: #6b7280; // Средний текст
$neutral-600: #4b5563; // Основной текст
$neutral-700: #374151; // Темный текст
$neutral-800: #1f2937; // Очень темный текст
$neutral-900: #111827; // Самый темный оттенок
// Semantic Colors
$text-primary: $neutral-900; // Основной текст
$text-secondary: $neutral-600; // Вторичный текст
$text-muted: $neutral-400; // Неактивный текст
$background-primary: $neutral-50; // Основной фон
$background-secondary: $neutral-100; // Вторичный фон
$border-color: $neutral-200; // Цвет границ
// Status Colors
$success: #10b981; // Успех
$warning: #f59e0b; // Предупреждение
$error: #ef4444; // Ошибка
$info: #3b82f6; // Информация
// Basic Colors
$black: #000000;
$dark-background: #13141c;
$dark-grey: #171821;
$grey-selector: #1b1b24;
$grey-blocks: #1e1f2b;
$grey-text-highlight: #23242c;
$grey-blocks-hover: #262736;
$grey-menu: #292a32;
$grey-stroke: #323442;
$grey-paginator: #323442;
$grey-icons: #5b5e6d;
$grey-text: #7f808b;
$grey-text2: #9A9BAB;
$white: #ffffff;
$greeen: #9fff00;
$greeen-dark: #43611b;
$red: #ff4141;
$red-dark: #3e232c;
$green: #20b26c;
$green-dark: #133324;
$gold: #ffc35c;
// Form Elements
$grey-form: #1c1d26;
$grey-form-stroke: #323442;
$grey-button: #21222d;
$grey-button-2: #32323c;
$grey-button-stroke: #5b5e6d;
// Export colors for JavaScript
:export {
black: $black;
darkBackground: $dark-background;
darkGrey: $dark-grey;
greySelector: $grey-selector;
greyBlocks: $grey-blocks;
greyTextHighlight: $grey-text-highlight;
greyBlocksHover: $grey-blocks-hover;
greyMenu: $grey-menu;
greyStroke: $grey-stroke;
greyPaginator: $grey-paginator;
greyIcons: $grey-icons;
greyText: $grey-text;
white: $white;
greeen: $greeen;
greeenDark: $greeen-dark;
red: $red;
redDark: $red-dark;
green: $green;
greenDark: $green-dark;
greyForm: $grey-form;
greyFormStroke: $grey-form-stroke;
greyButton: $grey-button;
greyButton2: $grey-button-2;
greyButtonStroke: $grey-button-stroke;
gold: $gold;
}

View File

@@ -1,12 +0,0 @@
@use 'main' as *;
body {
font-family: 'Inter', sans-serif;
color: $text-color;
margin: 0;
padding: 0;
}
.container {
@include container;
}

View File

@@ -1,23 +1,6 @@
@use 'reset';
@use 'colors' as *;
@use 'typography' as *;
@use 'utils' as *;
// Base styles
html {
font-size: 16px;
line-height: 1.5;
scroll-behavior: smooth;
}
body {
font-family: $font-family-base;
color: white;
background-color: black;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
// Typography
h1,
h2,
@@ -25,7 +8,6 @@ h3,
h4,
h5,
h6 {
font-weight: $font-weight-semibold;
line-height: 100%;
color: #ffffff;
}
@@ -42,37 +24,7 @@ h3 {
@include h3('h3');
}
a {
color: inherit;
text-decoration: none;
transition: all 0.2s ease;
}
// Buttons
button {
cursor: pointer;
font-family: inherit;
font-size: inherit;
line-height: inherit;
border: none;
background: none;
padding: 0;
}
// Forms
input,
textarea,
select {
font-family: inherit;
font-size: inherit;
line-height: inherit;
color: inherit;
border-radius: 0.25rem;
padding: 0.5rem 1rem;
transition: all 0.2s ease;
&:focus {
outline: none;
border-color: $brand-primary;
}
}

View File

@@ -1,16 +1,7 @@
@use 'sass:color';
@use 'sass:math';
@use 'breakpoints' as *;
// Mixins
@mixin responsive($breakpoint) {
@media (min-width: $breakpoint) {
@content;
}
}
@mixin mobile {
@media (max-width: $breakpoint-md) {
@media (max-width: 768px) {
@content;
}
}

View File

@@ -0,0 +1,132 @@
<template>
<div class="product-description">
<h1>{{ productsData?.name }}</h1>
<h2>{{ currentVariant?.price }} <Icon name="ph:currency-rub" /></h2>
<div class="product-description__variations">
<div
v-for="variation in productsVariationsData"
:key="variation?.id"
@click="() => currentVariantId = variation?.id"
>
<div class="product-description__variation">
<img width="80" :src="variation?.image?.src" :alt="variation?.image?.src">
</div>
</div>
</div>
<div>
{{ `Цвет: ${t(`colors.${currentColor}`)}` }}
</div>
<div>
{{ `Материал: ${t(`materials.${currentMaterial}`)}` }}
</div>
<div>
Размер
</div>
<div class="product-description__sizes">
<div
v-for="size in sizes"
:key="size"
class="product-description__size"
@click="() => currentSize = size"
>
<UButton block :label="size" :variant="currentSize === size ? undefined : 'outline'" />
</div>
</div>
<UButton class="justify-content-center" label="Добавить в корзину" size="xl" />
<UAccordion :items="items" />
</div>
</template>
<script setup lang="ts">
import type { AccordionItem } from '@nuxt/ui'
import { useCurrentProduct, useProduct } from '~/composables'
const { t } = useI18n()
const { productsData, productsVariationsData, sizes } = useProduct()
const { currentVariant, currentVariantId, currentColor, currentMaterial } = useCurrentProduct()
const currentSize = ref(0)
const items = ref<AccordionItem[]>([
{
label: 'Описание товара',
icon: 'i-heroicons-document-text',
content: productsData?.value?.description,
},
{
label: 'Состав и параметры',
icon: 'i-heroicons-beaker',
content: 'хлопок 100%',
},
{
label: 'Рекомендации по уходу',
icon: 'i-heroicons-sparkles',
content: 'Бережная стирка при максимальной температуре 30ºС\nНе отбеливать\nМашинная сушка запрещена\nГлажение при 110ºС\nПрофессиональная сухая чистка',
},
{
label: 'Доставка и оплата',
icon: 'i-heroicons-truck',
content: 'Доставка в пункт выдачи',
},
{
label: 'Возврат и обмен',
icon: 'i-heroicons-arrow-path',
content: 'Возврат в течение 14 дней\nОбмен размера в течение 7 дней',
},
])
</script>
<style scoped lang="scss">
.product-description {
padding-top: 50px;
display: flex;
flex-direction: column;
gap: 10px;
width: 400px;
padding-inline: 30px;
&__variations {
padding: 10px;
border-radius: 10px;
background: white;
display: flex;
flex-direction: row;
gap: 4px;
}
&__sizes {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 4px;
}
&__size {
width: 65px;
}
&__variation {
img {
border-radius: 10px;
}
}
h2 {
display: flex;
flex-direction: row;
gap: 4px;
align-items: center;
text-align: center;
}
}
</style>

View File

@@ -0,0 +1,25 @@
<template>
<div class="product-images">
<div
v-for="image in currentVariantImages?.slice(0, 5)"
:key="image?.id"
>
<img width="100%" :src="image?.src" :alt="image?.src">
</div>
</div>
</template>
<script setup lang="ts">
import { useCurrentProduct } from '~/composables'
const { currentVariantImages } = useCurrentProduct()
</script>
<style lang="scss">
.product-images {
position: relative;
width: 100%;
display: flex;
flex-direction: column;
}
</style>

2
composables/index.ts Normal file
View File

@@ -0,0 +1,2 @@
export * from './useCurrentProduct'
export * from './useProduct'

View File

@@ -0,0 +1,31 @@
import { createSharedComposable } from '@vueuse/core'
import { computed, ref, watch } from 'vue'
export const useCurrentProduct = createSharedComposable(() => {
const { defaultVariant, productsData, productsVariationsData, getAttribute } = useProduct()
const currentVariantId = ref(defaultVariant?.value?.id)
const currentVariant = computed(() =>
productsVariationsData?.value?.find(variation => variation?.id === currentVariantId?.value))
const currentColor = computed(() => getAttribute(currentVariant?.value?.attributes, 'color')?.option)
const currentMaterial = computed(() => getAttribute(currentVariant?.value?.attributes, 'material')?.option)
const currentVariantImages = computed(() =>
productsData?.value?.images?.filter(img => img?.src?.includes(`${currentColor.value}_${currentMaterial.value}_`)))
watch(() => defaultVariant.value, (newValue) => {
if (newValue) {
currentVariantId.value = newValue.id
}
})
return {
currentVariantId,
currentVariant,
currentColor,
currentMaterial,
currentVariantImages,
}
})

39
composables/useProduct.ts Normal file
View File

@@ -0,0 +1,39 @@
import { useGetProductsDetail, useGetProductsVariationsList } from '~/api/queries'
export const useProduct = () => {
const { data: productsData } = useGetProductsDetail(79)
const { data: productsVariationsData } = useGetProductsVariationsList(79)
function getAttribute(attributes: string[], name: string) {
return attributes?.find(attribute => attribute?.name === name)
}
const defaultColor = computed(() => getAttribute(productsData?.value?.default_attributes, 'color')?.option)
const defaultMaterial = computed(() => getAttribute(productsData?.value?.default_attributes, 'material')?.option)
const defaultSize = computed(() => getAttribute(productsData?.value?.default_attributes, 'size')?.option)
const defaultVariant = computed(() => {
return productsVariationsData?.value?.find(variation => getAttribute(variation?.attributes, 'color')?.option === defaultColor?.value)
&& productsVariationsData?.value?.find(variation => getAttribute(variation?.attributes, 'material')?.option === defaultMaterial?.value)
})
const colors = computed(() => getAttribute(productsData?.value?.attributes, 'color')?.options)
const materials = computed(() => getAttribute(productsData?.value?.attributes, 'material')?.options)
const sizes = computed(() => getAttribute(productsData?.value?.attributes, 'size')?.options)
return {
productsData,
productsVariationsData,
defaultColor,
defaultMaterial,
defaultSize,
defaultVariant,
colors,
materials,
sizes,
getAttribute,
}
}

5
i18n/locales/en.json Normal file
View File

@@ -0,0 +1,5 @@
{
"colors": {
"black": "black"
}
}

11
i18n/locales/ru.json Normal file
View File

@@ -0,0 +1,11 @@
{
"colors": {
"black": "черный",
"beige": "бежевый",
"grey": "серый"
},
"materials": {
"cotton": "хлопок",
"cotton-polyester": "хлопок-полиэстер"
}
}

View File

@@ -1,13 +1,17 @@
<template>
<div class="layout">
<header class="header">
Header
<div class="header__container">
<h1 class="header__headline">
PAXTON
</h1>
</div>
</header>
<main class="main">
<div class="container">
<UContainer class="container">
<slot />
</div>
</UContainer>
</main>
<footer class="footer">
@@ -17,25 +21,18 @@
</template>
<style lang="scss" scoped>
@use '@/assets/scss/colors.scss' as colors;
@use '@/assets/scss/main.scss' as main;
@use '@/assets/scss/utils.scss' as utils;
.layout {
display: flex;
flex-direction: column;
min-height: 100vh;
background: colors.$dark-grey;
}
.container {
max-width: 1000px;
margin: 48px auto 100px;
--ui-container: 100%;
max-width: 100%;
@media (max-width: 1280px) {
margin: 24px auto 52px;
padding: 0 24px;
}
margin: 0;
padding: 0;
}
.header {
@@ -45,11 +42,27 @@
right: 0;
z-index: 100;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
height: 54px;
background: white;
&__container {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
text-align: center;
}
&__headline {
height: 100%;
font-size: 32px;
color: black;
}
}
.main {
flex: 1;
margin-top: 64px;
margin-top: 54px;
}
.footer {

View File

@@ -2,5 +2,15 @@
export default defineNuxtConfig({
compatibilityDate: '2025-05-15',
devtools: { enabled: true },
modules: ['@nuxt/ui', '@nuxt/image', '@nuxt/icon', '@nuxt/fonts'],
modules: ['@nuxt/ui', '@nuxt/image', '@nuxt/icon', '@nuxt/fonts', '@nuxtjs/i18n'],
css: ['~/assets/css/main.css', '~/assets/scss/main.scss'],
i18n: {
locales: [
{ code: 'en', name: 'English', file: 'en.json' },
{ code: 'ru', name: 'Русский', file: 'ru.json' },
],
defaultLocale: 'ru',
strategy: 'prefix_except_default',
detectBrowserLanguage: false,
},
})

View File

@@ -17,6 +17,7 @@
"@nuxt/icon": "1.15.0",
"@nuxt/image": "1.10.0",
"@nuxt/ui": "3.2.0",
"@nuxtjs/i18n": "^10.0.4",
"@tanstack/vue-query": "^5.75.5",
"@vueuse/core": "^13.1.0",
"dayjs": "^1.11.13",

View File

@@ -1,20 +1,17 @@
<template>
<div>
<pre>
{{ productsData?.images?.filter(img => img?.src?.includes(colorVariants.blackCottonPolyester)) }}
</pre>
<div class="card">
<ProductImages />
<ProductDescription />
</div>
</template>
<script setup lang="ts">
import { useGetProductsDetail } from '~/api/queries'
const { data: productsData } = useGetProductsDetail(79)
const colorVariants = {
beigeCottonPolyester: 'beige_cotton-polyester_',
blackCotton: 'black_cotton_',
greyCottonPolyester: 'grey_cotton-polyester_',
blackCottonPolyester: 'black_cotton-polyester_',
}
</script>
<style lang="scss">
.card {
width: 100%;
display: flex;
flex-direction: row;
}
</style>

View File

@@ -1,11 +0,0 @@
<script setup lang="ts">
</script>
<template>
boroda
</template>
<style scoped>
</style>

16
tailwind.config.ts Normal file
View File

@@ -0,0 +1,16 @@
// tailwind.config.ts
import type { Config } from 'tailwindcss'
const config: Config = {
content: [], // Nuxt сам заполняет content автоматически
theme: {
extend: {
fontFamily: {
sans: ['Inter', 'sans-serif'], // если используешь @nuxt/fonts или свою кастомную типографику
},
},
},
plugins: [],
}
export default config

833
yarn.lock

File diff suppressed because it is too large Load Diff