diff --git a/src/app/products/page.tsx b/src/app/products/[id]/page.tsx similarity index 95% rename from src/app/products/page.tsx rename to src/app/products/[id]/page.tsx index 0d0d14e..3caade2 100644 --- a/src/app/products/page.tsx +++ b/src/app/products/[id]/page.tsx @@ -8,8 +8,8 @@ import { BreadcrumbPage, BreadcrumbSeparator, } from '@/components/ui/breadcrumb' -import Filters from './components/Filters' -import Sorts from './components/Sorts' +import Filters from '../components/Filters' +import Sorts from '../components/Sorts' import GridWrapper from '@/components/GridWrapper' import ProductCard from '@/components/ProductCard' diff --git a/src/app/profile/page.tsx b/src/app/profile/page.tsx new file mode 100644 index 0000000..887d075 --- /dev/null +++ b/src/app/profile/page.tsx @@ -0,0 +1,178 @@ +'use client' +import React, { useState } from 'react' +import { Button } from '@/components/ui/button' +import Input from '@/components/Input' +import { Edit2 } from 'lucide-react' +import withLayout from '@/hoc/withLayout' +import { Heart, ShoppingCart } from 'iconsax-react' + +const ProfilePage = () => { + const [userInfo, setUserInfo] = useState({ + name: 'حسین دهقانی', + email: 'sondos@gmail.com', + phone: '09010901789', + nationalCode: '052093452', + birthDate: '1365/5/8', + postalCode: '1235478951', + province: 'مرکزی', + city: 'اراک', + address: 'خیابان دانشگاه رودوی بیمارستان خوانساری ساختمان مهر طبقه سوم واحد2', + district: '58' + }) + + const [isEditing, setIsEditing] = useState(false) + + const handleInputChange = (field: string, value: string) => { + setUserInfo(prev => ({ + ...prev, + [field]: value + })) + } + + const handleSubmit = () => { + // Handle form submission + setIsEditing(false) + console.log('Form submitted:', userInfo) + } + + return ( +
+
+
+ {/* Left Content - Form */} +
+
+
+

اطلاعات کاربری

+ +
+ +
+ handleInputChange('name', e.target.value)} + readOnly={!isEditing} + /> + + handleInputChange('nationalCode', e.target.value)} + readOnly={!isEditing} + /> + + handleInputChange('email', e.target.value)} + readOnly={!isEditing} + type="email" + /> + + handleInputChange('phone', e.target.value)} + readOnly={!isEditing} + /> + + handleInputChange('birthDate', e.target.value)} + readOnly={!isEditing} + /> + + handleInputChange('province', e.target.value)} + readOnly={!isEditing} + /> + + handleInputChange('city', e.target.value)} + readOnly={!isEditing} + /> + + handleInputChange('postalCode', e.target.value)} + readOnly={!isEditing} + /> + + handleInputChange('district', e.target.value)} + readOnly={!isEditing} + /> +
+ +
+ handleInputChange('address', e.target.value)} + readOnly={!isEditing} + /> +
+ + {isEditing && ( +
+ + +
+ )} +
+
+ +
+
+
+ +
+
+ سفارشات +
+
+
+
+ +
+
+ علاقه مندی ها +
+
+
+ +
+
+
+
+
+ ) +} + +export default withLayout(ProfilePage) \ No newline at end of file diff --git a/src/config/const.ts b/src/config/const.ts index 97d0d5c..b8dc482 100644 --- a/src/config/const.ts +++ b/src/config/const.ts @@ -1,6 +1,6 @@ export const TOKEN_NAME = "sh_token"; export const REFRESH_TOKEN_NAME = "sh_refresh_token"; -// export const BASE_URL = "https://api.shinan.ir"; -export const BASE_URL = "https://api-sondos.run.danakcorp.com"; +export const BASE_URL = "https://api.shinan.ir"; +// export const BASE_URL = "https://api-sondos.run.danakcorp.com"; export const PRIMARY_COLOR = "#015699"; diff --git a/src/share/components/Menu.tsx b/src/share/components/Menu.tsx index b201fbd..b86f379 100644 --- a/src/share/components/Menu.tsx +++ b/src/share/components/Menu.tsx @@ -2,6 +2,7 @@ import { HambergerMenu, ArrowLeft2 } from 'iconsax-react' import { FC, useState, useRef, useEffect } from 'react' import Image from 'next/image' +import { useRouter } from 'next/navigation' import { useGetCategories } from '../hooks/useShareData' import { Category } from '../types/SharedTypes' @@ -10,6 +11,7 @@ const Menu: FC = () => { const [hoveredPath, setHoveredPath] = useState([]) const { data, isLoading } = useGetCategories() const menuRef = useRef(null) + const router = useRouter() useEffect(() => { const handleClickOutside = (event: MouseEvent) => { @@ -30,6 +32,12 @@ const Menu: FC = () => { setHoveredPath(newPath) } + const handleCategoryClick = (category: Category) => { + router.push(`/products/${category.title_en}`) + setIsOpen(false) + setHoveredPath([]) + } + const renderCategoryLevel = (categories: Category[], level: number) => { return (
@@ -40,6 +48,7 @@ const Menu: FC = () => { className={`p-3 rounded-lg cursor-pointer transition-colors hover:bg-gray-50 ${hoveredPath[level]?._id === category._id ? 'bg-gray-50' : '' }`} onMouseEnter={() => handleCategoryHover(category, level)} + onClick={() => handleCategoryClick(category)} >
{category.icon && (