diff --git a/src/app/[name]/(Dialogs)/layout.tsx b/src/app/[name]/(Dialogs)/layout.tsx index 587c831..ef8c7b6 100644 --- a/src/app/[name]/(Dialogs)/layout.tsx +++ b/src/app/[name]/(Dialogs)/layout.tsx @@ -1,12 +1,22 @@ 'use client'; import ClientSideWrapper from '@/components/wrapper/ClientSideWrapper'; -import React from 'react' +import React from 'react'; +import { usePathname } from 'next/navigation'; +import clsx from 'clsx'; function DialogsLayout({ children }: { children: React.ReactNode }) { + const pathname = usePathname(); + const isCheckoutPage = pathname?.includes('/checkout/'); + return ( -
+
{children}
diff --git a/src/app/[name]/(Main)/[id]/page.tsx b/src/app/[name]/(Main)/[id]/page.tsx index 3d60e2e..27f3064 100644 --- a/src/app/[name]/(Main)/[id]/page.tsx +++ b/src/app/[name]/(Main)/[id]/page.tsx @@ -192,8 +192,8 @@ function FoodPage({ }: Props) {
-

محتویات:

-

{content || '-'}

+

محتویات:

+

{content || '-'}

diff --git a/src/components/menu/SideMenu.tsx b/src/components/menu/SideMenu.tsx index b6b256c..9d1a00c 100644 --- a/src/components/menu/SideMenu.tsx +++ b/src/components/menu/SideMenu.tsx @@ -7,7 +7,7 @@ import NoteBoardIcon from '../icons/NoteBoardIcon'; import BlurredOverlayContainer from '../overlays/BlurredOverlayContainer'; import NightModeSwitch from '../button/NightModeSwitch'; import Button from '../button/PrimaryButton'; -import { useParams, usePathname } from 'next/navigation'; +import { useParams, usePathname, useRouter } from 'next/navigation'; import clsx from 'clsx'; import { useTranslation } from 'react-i18next'; import { CalendarSearch, Cup, DirectboxReceive, DirectInbox, DocumentCopy, Game, Icon, Instagram, Like1, Login, LogoutCurve, Notification, Receipt1, Setting2, Share, TicketDiscount, Whatsapp } from 'iconsax-react'; @@ -83,8 +83,11 @@ function SideMenu({ menuState, toggleMenuState, nightModeState, togglenightModeS const [isIOSDevice, setIsIOSDevice] = useState(false); const [isPWAInstalled, setIsPWAInstalled] = useState(false); const { data: aboutData } = useGetAbout(); - const { isSuccess } = useGetProfile(); + const { data: profile, isSuccess } = useGetProfile(); + const profileData = profile?.data; + const isLoggedIn = isSuccess && profileData; const isPremium = aboutData?.data?.plan === 'premium'; + const router = useRouter(); const params = useParams(); @@ -183,19 +186,29 @@ function SideMenu({ menuState, toggleMenuState, nightModeState, togglenightModeS } }; + const handleNotificationClick = (e: React.MouseEvent) => { + e.preventDefault(); + if (!isLoggedIn) { + toast('ابتدا لاگین کنید', 'info'); + } else { + router.push(`/${name}/notifications`); + } + }; + const hrefOnClicks = [ { href: '?logout', handler: toggleLogoutModal }, { href: '?share', handler: toggleShareModal }, - { href: '?installpwa', handler: toggleInstallPwaModal } + { href: '?installpwa', handler: toggleInstallPwaModal }, + { href: 'notifications', handler: handleNotificationClick } ]; const renderMenu = () => { return ( -
+
{ aboutData?.data?.logo && (
- logo + logo
) }