diff --git a/app/globals.css b/app/globals.css
index e1102b8..fc948d5 100644
--- a/app/globals.css
+++ b/app/globals.css
@@ -214,3 +214,25 @@ body {
}
}
}
+
+.bw-product__text * {
+ font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !important;
+ font-weight: 400 !important;
+ font-size: 1rem !important;
+ line-height: 1.45 !important;
+ color: rgb(40, 26, 76) !important;
+
+}
+.bw-product__text {
+ h2 * {
+ font-weight: 700 !important;
+ font-size: 1.375rem !important;
+ }
+}
+
+.bw-cart-item-counter {
+ input {
+ @apply text-xl leading-none border-0 text-brand-violet font-bold;
+ }
+
+}
diff --git a/app/layout.tsx b/app/layout.tsx
index 9409145..0493b93 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -1,9 +1,10 @@
import type {Metadata} from 'next'
import {headers} from 'next/headers'
import {ReactNode} from 'react'
+import {Toaster} from 'react-hot-toast'
import './globals.css'
-import {Toaster} from '@/components/ui/toaster'
+//import {Toaster} from '@/components/ui/toaster'
import {routing} from '@/i18n/routing'
import {APP_DESCRIPTION, APP_NAME, APP_SLOGAN} from '@/lib/constants'
@@ -25,7 +26,8 @@ export default async function RootLayout({
{children}
-
+ {/*
*/}
+
)
diff --git a/components/(protected)/admin/product/create-edit-form.tsx b/components/(protected)/admin/product/create-edit-form.tsx
index a1ddfdb..c9b58ba 100644
--- a/components/(protected)/admin/product/create-edit-form.tsx
+++ b/components/(protected)/admin/product/create-edit-form.tsx
@@ -12,6 +12,7 @@ import {i18nDefaultLocale, i18nLocales} from '@/i18n-config'
import {BaseEditorConfig} from '@/lib/config/editor'
import {createProductFormSchema} from '@/lib/schemas/admin/product'
import {toEmptyParams} from '@/lib/utils'
+import useCountStore from '@/store/cart-store'
import {Button} from '@/ui/button'
import {
Form,
diff --git a/components/pages/cart/cart.module.scss b/components/pages/cart/cart.module.scss
new file mode 100644
index 0000000..ba24743
--- /dev/null
+++ b/components/pages/cart/cart.module.scss
@@ -0,0 +1,4 @@
+input.bw-cart-item-counter{
+ font-size: 36px;
+ background: chocolate;
+}
diff --git a/components/pages/cart/items.tsx b/components/pages/cart/items.tsx
new file mode 100644
index 0000000..615a0d3
--- /dev/null
+++ b/components/pages/cart/items.tsx
@@ -0,0 +1,74 @@
+// import styles from '@/components/pages/cart/cart.module.scss'
+import Link from 'next/link'
+
+import useCartStore from '@/store/cart-store'
+import {Button} from '@/ui/button'
+import {Input} from '@/ui/input'
+
+export default function CartItems() {
+ const {cartItems} = useCartStore()
+
+ const {increaseQuantity, decreaseQuantity, removeItemFromCart} =
+ useCartStore()
+ const onIncreaseQuantity = (productId: number) => {
+ increaseQuantity(productId)
+ }
+
+ const onDecreaseQuantity = (productId: number) => {
+ decreaseQuantity(productId)
+ }
+
+ const onRemoveItem = (productId: number) => {
+ removeItemFromCart(productId)
+ }
+
+ if (cartItems && cartItems.length < 1) {
+ return (
+
+
Cart is Empty
+
+ Shop
+
+
+ )
+ }
+
+ return (
+ <>
+ {cartItems?.map((item, i) => (
+
+
{item.title}
+
+
+
+ {item.quantity}
+
+
+
+
+
+ {(item.price * item.quantity).toFixed(2)} грн
+
+
+ ))}
+ >
+ )
+}
diff --git a/components/pages/product/add-cart-button.tsx b/components/pages/product/add-cart-button.tsx
new file mode 100644
index 0000000..198ccbe
--- /dev/null
+++ b/components/pages/product/add-cart-button.tsx
@@ -0,0 +1,28 @@
+'use client'
+
+import {ShoppingCartIcon} from 'lucide-react'
+import {useTranslations} from 'next-intl'
+
+import {dump} from '@/lib/utils'
+import useCartStore, {CartItem} from '@/store/cart-store'
+
+export default function AddCartButton({product}: {product: CartItem}) {
+ const t = useTranslations('cart')
+ const addItemToCart = useCartStore(state => state.addItemToCart)
+ const {cartItems} = useCartStore(state => state)
+
+ return (
+ <>
+
+
+
{dump(cartItems)}
+ >
+ )
+}
diff --git a/components/pages/product/index.tsx b/components/pages/product/index.tsx
new file mode 100644
index 0000000..4e8b1f7
--- /dev/null
+++ b/components/pages/product/index.tsx
@@ -0,0 +1,57 @@
+import {getLocale} from 'next-intl/server'
+import {notFound} from 'next/navigation'
+import {strict} from 'node:assert'
+
+import AddCartButton from '@/components/pages/product/add-cart-button'
+import {ProductProps, getProductById} from '@/lib/data/models/product'
+import {dump} from '@/lib/utils'
+import useCartStore from '@/store/cart-store'
+import {Tabs, TabsContent, TabsList, TabsTrigger} from '@/ui/tabs'
+
+export default async function ProductPageIndex({id}: {id: string}) {
+ const product = await getProductById(parseInt(id))
+ if (!product) notFound()
+ const {locales, toStore} = product as ProductProps
+ const lang = await getLocale()
+ const locale = locales[lang === 'uk' ? 0 : 1]
+ const store = JSON.parse(JSON.stringify(toStore[0]))
+
+ return (
+
+
+
+
+
+
+ Опис
+ Інструкція
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
diff --git a/components/shared/header/cabinet-button.tsx b/components/shared/header/cabinet-button.tsx
index c91db67..6e2eceb 100644
--- a/components/shared/header/cabinet-button.tsx
+++ b/components/shared/header/cabinet-button.tsx
@@ -23,7 +23,6 @@ export default async function CabinetButton() {
) : (
<>
- GA4_Ecommerce_View_Item_List_Trigger
>
)}
{/*
Кабінет*/}
diff --git a/components/shared/header/controls.tsx b/components/shared/header/controls.tsx
index a34fcfd..18e5995 100644
--- a/components/shared/header/controls.tsx
+++ b/components/shared/header/controls.tsx
@@ -1,7 +1,8 @@
-import {Heart, ShoppingCartIcon, UserIcon} from 'lucide-react'
+import {Heart} from 'lucide-react'
import {useTranslations} from 'next-intl'
import CabinetButton from '@/components/shared/header/cabinet-button'
+import HeaderShoppingCartIcon from '@/components/shared/header/shopping-cart-icon'
import {Link} from '@/i18n/routing'
export default function HeaderControls() {
@@ -18,17 +19,7 @@ export default function HeaderControls() {
-
-
-
+
)
}
diff --git a/components/shared/header/shopping-cart-icon.tsx b/components/shared/header/shopping-cart-icon.tsx
new file mode 100644
index 0000000..c698152
--- /dev/null
+++ b/components/shared/header/shopping-cart-icon.tsx
@@ -0,0 +1,25 @@
+'use client'
+
+import {ShoppingCartIcon} from 'lucide-react'
+import {useTranslations} from 'next-intl'
+
+import {Link} from '@/i18n/routing'
+import useCartStore from '@/store/cart-store'
+
+export default function HeaderShoppingCartIcon() {
+ const t = useTranslations('cart')
+ const {cartItems} = useCartStore()
+ const cartCount = cartItems.length
+
+ return (
+