From 58e7ed2f060c934874c9e3933e3bf9dfe51c1aa0 Mon Sep 17 00:00:00 2001 From: Yevhen Odynets Date: Fri, 7 Feb 2025 11:51:43 +0200 Subject: [PATCH] final commit before execution --- app/[locale]/(auth)/layout.tsx | 1 - app/[locale]/(root)/(shop)/cart/page.tsx | 13 ++ components/auth/forms/login-form.tsx | 2 +- components/pages/cart/items.tsx | 111 +++++----- components/pages/product/carousel.tsx | 2 +- components/pages/product/index.tsx | 96 ++++++++- components/shared/header/controls.tsx | 2 +- components/shared/navbar/navbar-menu.tsx | 15 +- data/products.ts | 41 +++- lib/data.ts | 127 +++--------- messages/ru.json | 9 +- package-lock.json | 247 +++++++++++++++++++++-- package.json | 2 +- store/cart-store.ts | 1 + 14 files changed, 473 insertions(+), 196 deletions(-) diff --git a/app/[locale]/(auth)/layout.tsx b/app/[locale]/(auth)/layout.tsx index 404c168..d9daa85 100644 --- a/app/[locale]/(auth)/layout.tsx +++ b/app/[locale]/(auth)/layout.tsx @@ -8,7 +8,6 @@ export default async function AuthLayout({ return (
- {/**/} {children}
diff --git a/app/[locale]/(root)/(shop)/cart/page.tsx b/app/[locale]/(root)/(shop)/cart/page.tsx index 7dbdb2b..5d39718 100644 --- a/app/[locale]/(root)/(shop)/cart/page.tsx +++ b/app/[locale]/(root)/(shop)/cart/page.tsx @@ -3,9 +3,15 @@ import {useTranslations} from 'next-intl' import CartItems from '@/components/pages/cart/items' +import useCartStore from '@/store/cart-store' export default function Cart() { const t = useTranslations('cart') + const {cartItems} = useCartStore() + const totalSum = cartItems.reduce( + (total, product) => total + parseFloat(product.price) * product.quantity, + 0 + ) // const subtotal = items.reduce( // (total, item) => total + item.price * item.quantity, @@ -26,6 +32,13 @@ export default function Cart() {
{t('amount')}
+
+
+
{t('total')}:
+
+ {totalSum.toFixed(2)} грн +
+
diff --git a/components/auth/forms/login-form.tsx b/components/auth/forms/login-form.tsx index ee149e7..0240df0 100644 --- a/components/auth/forms/login-form.tsx +++ b/components/auth/forms/login-form.tsx @@ -94,7 +94,7 @@ export default function LoginForm() { diff --git a/components/pages/cart/items.tsx b/components/pages/cart/items.tsx index fa9fb43..cc16f2a 100644 --- a/components/pages/cart/items.tsx +++ b/components/pages/cart/items.tsx @@ -23,65 +23,64 @@ export default function CartItems() { removeItemFromCart(productId) } - if (cartItems && cartItems.length < 1) { + if (cartItems && cartItems.length > 0) { return ( -
-

Cart is Empty

- - Shop - -
- ) - } - - return ( - <> - {cartItems?.map((item: CartItem, i: number) => ( -
-
- {item.title} - -
-
-
- -
- {item.quantity} + <> + {cartItems?.map((item: CartItem, i: number) => ( +
+
+ {item.title} + +
+
+
+ +
+ {item.quantity} +
+
- +
+
+ {(item.price * item.quantity).toFixed(2)} грн
-
- {(item.price * item.quantity).toFixed(2)} грн -
-
- ))} - + ))} + + ) + } + return ( +
+

Cart is Empty

+ + Продовжити покупки + +
) } diff --git a/components/pages/product/carousel.tsx b/components/pages/product/carousel.tsx index 513df40..3d6f3d0 100644 --- a/components/pages/product/carousel.tsx +++ b/components/pages/product/carousel.tsx @@ -92,7 +92,7 @@ export default function ProductCarousel({ selected={index === selectedIndex} index={index} /> - + products.id === parseInt(id)) return (
@@ -80,10 +92,21 @@ export default async function ProductPageIndex({id}: {id: string}) { Інструкція -
+
+

+ {locale.headingTitle} +

+
+
+
-
+
{t('price')}: {toPrice(locale.price)}
+ {attrs && ( + <> + + +
Є в наявності
+ +
Характеристики
+ +
+
Категорія
+
+ + {locale.categoryTitle} + +
+
+ + + +
Склад
+
+ +
+
+ + Склад 1 капсула містить: +
+ сухий екстракт ламінарії (Laminaria japonica Extract 1% + iodine) – 15,0 мг (mg), що еквівалентно 150,0 мкг (μg) йоду, +
+ селенометіонін ̶ 250,0 мкг (μg), що еквівалентно 100,0 мкг (μg) + селену; +
+ допоміжні речовини: наповнювач: целюлоза мікрокристалічна, + антиспікаючий агент: кремнію діоксид колоїдний безводний, + кальцію стеарат. +
+
+ +
+
Форма
+
{attrs?.form}
+
+
+
Виробник
+
{attrs?.vendor}
+
+
+
Країна-виробник
+
{attrs?.country}
+
+ + )} + +
+ Завантажити інструкцію +
diff --git a/components/shared/header/controls.tsx b/components/shared/header/controls.tsx index 18e5995..a011031 100644 --- a/components/shared/header/controls.tsx +++ b/components/shared/header/controls.tsx @@ -9,7 +9,7 @@ export default function HeaderControls() { const t = useTranslations('cart') return ( -
+
diff --git a/components/shared/navbar/navbar-menu.tsx b/components/shared/navbar/navbar-menu.tsx index eafe551..925b664 100644 --- a/components/shared/navbar/navbar-menu.tsx +++ b/components/shared/navbar/navbar-menu.tsx @@ -1,5 +1,6 @@ 'use client' +import {useLocale} from 'next-intl' import {useState} from 'react' import {Link} from '@/i18n/routing' @@ -8,7 +9,7 @@ import {Button} from '@/ui/button' export default function NavbarMenu() { const bp = 'md' - + const locale = useLocale() const [menuOpened, setMenuOpened] = useState(false) function ToggleNavbar() { @@ -19,11 +20,13 @@ export default function NavbarMenu() { <>
- {data.headerMenus.map(item => ( - - {item.name} - - ))} + {data[locale === 'uk' ? 'headerMenus' : 'headerMenusRus'].map( + item => ( + + {item.name} + + ) + )}
{/*
diff --git a/data/products.ts b/data/products.ts index adf4ff7..b5ee94c 100644 --- a/data/products.ts +++ b/data/products.ts @@ -1,9 +1,42 @@ export default [ { - id: 0, - qnt: '14', - form: 'порошок', - vendor: 'Fine Foods & Pharmaceuticals N.T.M. SpA', + id: 6, + title: '30 капсул у блістері', + qnt: '30', + form: 'капсули', + vendor: 'ТОВ «АКТІЛАЙФ НУТРІШН»', + country: 'Україна' + }, + { + id: 7, + title: '20 питних ампул', + qnt: '20', + form: 'ампули', + vendor: 'Фармлабор-Продутос Фармасеутікос С.А.', + country: 'Португалія' + }, + { + id: 8, + title: '30 таблеток «ДЕНЬ» та 30 таблеток «НІЧ»', + qnt: '60', + form: 'таблетки', + vendor: 'Ерба Віта Груп С.п.А.', country: 'Італія' + }, + { + id: 10, + title: '60 таблеток у блicтерi', + qnt: '60', + form: 'таблетки', + vendor: 'ТОВ «АКТІЛАЙФ НУТРІШН»', + country: 'Україна' + }, + { + id: 11, + title: '10 саше у картонній коробці', + qnt: '10', + form: 'порошок', + vendor: 'ТОВ «Еубіон Корпорейшн»', + country: 'Польща' } ] diff --git a/lib/data.ts b/lib/data.ts index e66e366..306f2f9 100644 --- a/lib/data.ts +++ b/lib/data.ts @@ -1,98 +1,51 @@ -import {slug} from '@/lib/utils' - export const data = { headerMenus: [ { name: 'Про нас', - slug: slug('Про нас'), href: '/about-us' }, { name: "Цікаво про здоров'я", - slug: slug("Цікаво про здоров'я"), href: '/search?tag=' }, { name: 'Програма лояльності', - slug: slug('Програма лояльності'), href: '/search?tag=' }, { name: 'Доставка і повернення', - slug: slug('Доставка і повернення'), href: '/search?tag=' }, { name: 'Контакти', - slug: slug('Контакти'), + href: '/search?tag=' + } + ], + + headerMenusRus: [ + { + name: 'О нас', + href: '/about-us' + }, + { + name: 'Интересно о здоровье', + href: '/search?tag=' + }, + { + name: 'Программа лояльности', + href: '/search?tag=' + }, + { + name: 'Доставка и возврат', + href: '/search?tag=' + }, + { + name: 'Контакты', href: '/search?tag=' } ] } -export const categories = [ - { - name: "Жіноче здоров'я", - rus: 'Женское здоровье', - slug: slug("Жіноче здоров'я") - }, - { - name: "Чоловіче здоров'я", - rus: 'Мужское здоровье', - slug: slug("Чоловіче здоров'я") - }, - { - name: 'Краса (шкіра, волосся, нігті)', - rus: 'Красота (кожа, волосы, ногти)', - slug: slug('Краса (шкіра, волосся, нігті)') - }, - { - name: 'Здоровий сон', - rus: 'Здоровый сон', - slug: slug('Здоровий сон') - }, - { - name: 'Імунітет', - rus: 'Иммунитет', - slug: slug('Імунітет') - }, - { - name: 'Для кісток та суглобів', - rus: 'Для костей и суставов', - slug: slug('Для кісток та суглобів') - }, - { - name: 'Для зниження цукру в крові', - rus: 'Для снижения уровня сахара в крови', - slug: slug('Для зниження цукру в крові') - }, - { - name: 'Детоксикація', - rus: 'Детоксикация', - slug: slug('Детоксикація') - }, - { - name: "Здоров'я печінки", - rus: 'Здоровье печени', - slug: slug("Здоров'я печінки") - }, - { - name: 'Для щитовидної залози', - rus: 'Для щитовидной железы', - slug: slug('Для щитовидної залози') - }, - { - name: 'Життєвий тонус', - rus: 'Жизненный тонус', - slug: slug('Життєвий тонус') - }, - { - name: 'Антистрес', - rus: 'Антистресс', - slug: slug('Антистрес') - } -] - export const carousels = [ { title: 'The Children of the Serpent', @@ -116,37 +69,3 @@ export const carousels = [ isPublished: true } ] - -export const cards = [ - { - title: 'Пінеал Тенс', - image: '/uploads/637393-1500x1500-ea2f.jpg', - href: slug('Пінеал Тенс'), - price: 720 - }, - { - title: 'Вістакеа Остеостронг', - image: '/uploads/1256-vistacare_osteostrong_tablets_box_livo_1.png', - href: slug('Вістакеа Остеостронг'), - price: 640 - }, - { - title: 'Вістакеа Детокс', - image: - '/uploads/1ca3d021-a55d-4c0a-aa7b-06ecb5f905b0-w1000-h1000-wm-frame.jpg', - href: slug('Вістакеа Детокс'), - price: 850 - }, - { - title: 'Тіромодал', - image: '/uploads/189238-192172-orig-1500-1500-d76a.jpg', - href: slug('Тіромодал'), - price: 535 - }, - { - title: 'Артросульфур С', - image: '/uploads/79282077-e324-4248-9f5d-184242ec4dd4.webp', - href: slug('Артросульфур С'), - price: 535 - } -] diff --git a/messages/ru.json b/messages/ru.json index ae4b534..e28b371 100644 --- a/messages/ru.json +++ b/messages/ru.json @@ -5,7 +5,8 @@ }, "Common": { "home": "Главная", - "price": "Цена" + "price": "Цена", + "buy": "Купить" }, "Error": { "title": "Произошла ошибка", @@ -33,7 +34,11 @@ "favorites": "Избранное", "empty": "Корзина пуста", "continue": "Продолжить покупки", - "checkout": "Оформить заказ" + "checkout": "Оформить заказ", + "title": "Название", + "quantity": "Количество", + "amount": "Стоимость", + "total": "Всего" }, "cabinet": { "personal-information": { diff --git a/package-lock.json b/package-lock.json index 426107c..04e56f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@radix-ui/react-dialog": "^1.1.5", "@radix-ui/react-dropdown-menu": "^2.1.4", "@radix-ui/react-label": "^2.1.1", - "@radix-ui/react-select": "^2.1.4", + "@radix-ui/react-select": "^2.1.6", "@radix-ui/react-separator": "^1.1.1", "@radix-ui/react-slot": "^1.1.1", "@radix-ui/react-switch": "^1.1.2", @@ -2239,32 +2239,253 @@ } }, "node_modules/@radix-ui/react-select": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@radix-ui/react-select/-/react-select-2.1.5.tgz", - "integrity": "sha512-eVV7N8jBXAXnyrc+PsOF89O9AfVgGnbLxUtBb0clJ8y8ENMWLARGMI/1/SBRLz7u4HqxLgN71BJ17eono3wcjA==", + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@radix-ui/react-select/-/react-select-2.1.6.tgz", + "integrity": "sha512-T6ajELxRvTuAMWH0YmRJ1qez+x4/7Nq7QIx7zJ0VK3qaEWdnWpNbEDnmWldG1zBDwqrLy5aLMUWcoGirVj5kMg==", "license": "MIT", "dependencies": { "@radix-ui/number": "1.1.0", "@radix-ui/primitive": "1.1.1", - "@radix-ui/react-collection": "1.1.1", + "@radix-ui/react-collection": "1.1.2", "@radix-ui/react-compose-refs": "1.1.1", "@radix-ui/react-context": "1.1.1", "@radix-ui/react-direction": "1.1.0", - "@radix-ui/react-dismissable-layer": "1.1.4", + "@radix-ui/react-dismissable-layer": "1.1.5", "@radix-ui/react-focus-guards": "1.1.1", - "@radix-ui/react-focus-scope": "1.1.1", + "@radix-ui/react-focus-scope": "1.1.2", "@radix-ui/react-id": "1.1.0", - "@radix-ui/react-popper": "1.2.1", - "@radix-ui/react-portal": "1.1.3", - "@radix-ui/react-primitive": "2.0.1", - "@radix-ui/react-slot": "1.1.1", + "@radix-ui/react-popper": "1.2.2", + "@radix-ui/react-portal": "1.1.4", + "@radix-ui/react-primitive": "2.0.2", + "@radix-ui/react-slot": "1.1.2", "@radix-ui/react-use-callback-ref": "1.1.0", "@radix-ui/react-use-controllable-state": "1.1.0", "@radix-ui/react-use-layout-effect": "1.1.0", "@radix-ui/react-use-previous": "1.1.0", - "@radix-ui/react-visually-hidden": "1.1.1", + "@radix-ui/react-visually-hidden": "1.1.2", "aria-hidden": "^1.2.4", - "react-remove-scroll": "^2.6.2" + "react-remove-scroll": "^2.6.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-arrow": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.2.tgz", + "integrity": "sha512-G+KcpzXHq24iH0uGG/pF8LyzpFJYGD4RfLjCIBfGdSLXvjLHST31RUiRVrupIBMvIppMgSzQ6l66iAxl03tdlg==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.0.2" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-collection": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.1.2.tgz", + "integrity": "sha512-9z54IEKRxIa9VityapoEYMuByaG42iSy1ZXlY2KcuLSEtq8x4987/N6m15ppoMffgZX72gER2uHe1D9Y6Unlcw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.1", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-primitive": "2.0.2", + "@radix-ui/react-slot": "1.1.2" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-dismissable-layer": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.1.5.tgz", + "integrity": "sha512-E4TywXY6UsXNRhFrECa5HAvE5/4BFcGyfTyK36gP+pAW1ed7UTK4vKwdr53gAJYwqbfCWC6ATvJa3J3R/9+Qrg==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.1", + "@radix-ui/react-compose-refs": "1.1.1", + "@radix-ui/react-primitive": "2.0.2", + "@radix-ui/react-use-callback-ref": "1.1.0", + "@radix-ui/react-use-escape-keydown": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-focus-scope": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.1.2.tgz", + "integrity": "sha512-zxwE80FCU7lcXUGWkdt6XpTTCKPitG1XKOwViTxHVKIJhZl9MvIl2dVHeZENCWD9+EdWv05wlaEkRXUykU27RA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.1", + "@radix-ui/react-primitive": "2.0.2", + "@radix-ui/react-use-callback-ref": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-popper": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.2.tgz", + "integrity": "sha512-Rvqc3nOpwseCyj/rgjlJDYAgyfw7OC1tTkKn2ivhaMGcYt8FSBlahHOZak2i3QwkRXUXgGgzeEe2RuqeEHuHgA==", + "license": "MIT", + "dependencies": { + "@floating-ui/react-dom": "^2.0.0", + "@radix-ui/react-arrow": "1.1.2", + "@radix-ui/react-compose-refs": "1.1.1", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-primitive": "2.0.2", + "@radix-ui/react-use-callback-ref": "1.1.0", + "@radix-ui/react-use-layout-effect": "1.1.0", + "@radix-ui/react-use-rect": "1.1.0", + "@radix-ui/react-use-size": "1.1.0", + "@radix-ui/rect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-portal": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.1.4.tgz", + "integrity": "sha512-sn2O9k1rPFYVyKd5LAJfo96JlSGVFpa1fS6UuBJfrZadudiw5tAmru+n1x7aMRQ84qDM71Zh1+SzK5QwU0tJfA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.0.2", + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-primitive": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.2.tgz", + "integrity": "sha512-Ec/0d38EIuvDF+GZjcMU/Ze6MxntVJYO/fRlCPhCaVUyPY9WTalHJw54tp9sXeJo3tlShWpy41vQRgLRGOuz+w==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.1.2" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-slot": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.1.2.tgz", + "integrity": "sha512-YAKxaiGsSQJ38VzKH86/BPRC4rh+b1Jpa+JneA5LRE7skmLPNAyeG8kPJj/oo4STLvlrs8vkf/iYyc3A5stYCQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-visually-hidden": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-visually-hidden/-/react-visually-hidden-1.1.2.tgz", + "integrity": "sha512-1SzA4ns2M1aRlvxErqhLHsBHoS5eI5UUcI2awAMgGUp4LoaoWOKYmvqDY2s/tltuPkh3Yk77YF/r3IRj+Amx4Q==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.0.2" }, "peerDependencies": { "@types/react": "*", diff --git a/package.json b/package.json index 00fb116..bdb0e39 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@radix-ui/react-dialog": "^1.1.5", "@radix-ui/react-dropdown-menu": "^2.1.4", "@radix-ui/react-label": "^2.1.1", - "@radix-ui/react-select": "^2.1.4", + "@radix-ui/react-select": "^2.1.6", "@radix-ui/react-separator": "^1.1.1", "@radix-ui/react-slot": "^1.1.1", "@radix-ui/react-switch": "^1.1.2", diff --git a/store/cart-store.ts b/store/cart-store.ts index 214a74e..99d9201 100644 --- a/store/cart-store.ts +++ b/store/cart-store.ts @@ -54,6 +54,7 @@ const useCartStore = create( set({cartItems: [...get().cartItems]}) } }, + decreaseQuantity: productId => { const itemExists = get().cartItems.find( cartItem => cartItem.id === productId