From 6ed1f3f4631a224adbc247c09d3db2029797bd34 Mon Sep 17 00:00:00 2001 From: Mahyar Khanbolooki Date: Sat, 19 Jul 2025 14:06:47 +0330 Subject: [PATCH] add: transactions page and sidemenu active link style --- src/app/[name]/transactions/page.tsx | 89 ++++++++++++++++++++++++++++ src/components/menu/SideMenu.tsx | 54 +++++++++++------ 2 files changed, 126 insertions(+), 17 deletions(-) create mode 100644 src/app/[name]/transactions/page.tsx diff --git a/src/app/[name]/transactions/page.tsx b/src/app/[name]/transactions/page.tsx new file mode 100644 index 0000000..dd19f1e --- /dev/null +++ b/src/app/[name]/transactions/page.tsx @@ -0,0 +1,89 @@ +import { Button } from '@/components/ui/button' +import React from 'react' + +function TransactionsIndex() { + return ( +
+
کدهای تخفیف
+ +
+ +
+
کدهای تخفیف شما
+

کد تخفیف مورد نظر را کپی کنید و در بخش پرداخت ها استفاده کنید

+
+ +
+

+ Your +
+ Coupon +

+ + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+
مبلغ تخفیف: 50,000 تومان
+

قابل استفاده برای همه ی منو ها و محصولات

+ +
+
+

+ F12BB587 +

+
+
+
+
+
مبلغ تخفیف: 50,000 تومان
+

قابل استفاده برای همه ی منو ها و محصولات

+ +
+
+

+ F12BB587 +

+
+
+
+
+
مبلغ تخفیف: 50,000 تومان
+

قابل استفاده برای همه ی منو ها و محصولات

+ +
+
+

+ F12BB587 +

+
+
+
+ ) +} + +export default TransactionsIndex \ No newline at end of file diff --git a/src/components/menu/SideMenu.tsx b/src/components/menu/SideMenu.tsx index 6634f25..292ea1c 100644 --- a/src/components/menu/SideMenu.tsx +++ b/src/components/menu/SideMenu.tsx @@ -19,7 +19,8 @@ import ExitIcon from '../icons/ExitIcon'; import NightModeSwitch from '../button/NightModeSwitch'; import Button from '../button/PrimaryButton'; import { useAuthStore } from '@/zustand/authStore'; -import { useRouter } from 'next/navigation'; +import { useParams, usePathname, useRouter } from 'next/navigation'; +import clsx from 'clsx'; type MenuItemType = { href: string | undefined; @@ -31,40 +32,40 @@ type MenuItemType = { const menuItems: Array> = [ [ { - href: '/', title: 'صفحه اصلی', icon: + href: '/', title: 'اعلان ها', icon: }, { - href: 'my-services', title: 'سرویس های من', icon: + href: 'my-services', title: 'باشگاه مشتریان', icon: }, { - href: 'services', title: 'سایر سرویس ها', icon: + href: 'services', title: 'کد های تخفیف', icon: }, { - href: 'invoices', title: 'لیست', icon: + href: 'orders', title: 'لیست سفارشات', icon: }, { - href: 'transactions', title: 'تراکنش ها', icon: + href: 'transactions', title: 'لیست تراکنش ها', icon: }, { - href: '/', title: 'صفحه اصلی', icon: + href: '/', title: 'بازی و سرگرمی ها', icon: }, { - href: 'my-services', title: 'سرویس های من', icon: + href: 'my-services', title: 'معرفی به دوستان', icon: }, { - href: 'services', title: 'سایر سرویس ها', icon: + href: 'services', title: 'گزارش اشکال', icon: }, { - href: 'invoices', title: 'نصب اپلیکیشن', icon: + href: 'invoices', title: 'نصب اپلیکیشن', icon: }, ], [], [ { - auth: true, href: undefined, title: 'تنظیمات', icon: + auth: true, href: undefined, title: 'تنظیمات', icon: }, { - auth: true, href: '?logout', title: 'خروج', icon: + auth: true, href: '?logout', title: 'خروج', icon: }, ] ] @@ -83,6 +84,9 @@ function SideMenu({ menuState, toggleMenuState, nightModeState, togglenightModeS const userIsAuthenticated = true; //useAuthStore((state) => state.isAuthenticated); const authLogout = useAuthStore((state) => state.logout); const router = useRouter(); + const params = useParams(); + const { name } = params; + const pathname = usePathname(); const variants: Variants = { hidden: { @@ -149,9 +153,25 @@ function SideMenu({ menuState, toggleMenuState, nightModeState, togglenightModeS
  • -
    منو
    +
    منو
    {menuItems[0].filter((x) => x.auth ? userIsAuthenticated && x : x).map((v, i) => { - return + const isActive = pathname === `/${name}/${v.href}` + return + {v.icon} +
    + } + /> })}
    @@ -163,7 +183,7 @@ function SideMenu({ menuState, toggleMenuState, nightModeState, togglenightModeS href={v.href || ''} onClick={v.href && hrefOnClicks.find((i) => i.href === v.href)?.handler || undefined} title={v.title} - icon={v.icon} + icon={
    {v.icon}
    } /> })} }> @@ -174,8 +194,8 @@ function SideMenu({ menuState, toggleMenuState, nightModeState, togglenightModeS -
    +