fix: side menu links

This commit is contained in:
Mahyar Khanbolooki
2025-08-12 03:22:53 +03:30
parent 81bb8e9c14
commit e6ffa7b76f
8 changed files with 263 additions and 142 deletions
+31 -7
View File
@@ -10,7 +10,7 @@ import Button from '../button/PrimaryButton';
import { useParams, usePathname } from 'next/navigation';
import clsx from 'clsx';
import { useTranslation } from 'react-i18next';
import { CalendarSearch, Cup, DirectboxReceive, DocumentCopy, Game, Icon, Instagram, Like1, LogoutCurve, Notification, Receipt1, Setting2, Share, TicketDiscount, Whatsapp } from 'iconsax-react';
import { CalendarSearch, Cup, DirectboxReceive, DirectInbox, DocumentCopy, Game, Icon, Instagram, Like1, LogoutCurve, Notification, Receipt1, Setting2, Share, TicketDiscount, Whatsapp } from 'iconsax-react';
import TelegramIcon from '../icons/TelegramIcon';
import Modal from '../utils/Modal';
import LogoutPrompt from '@/features/general/LogoutPrompt';
@@ -25,19 +25,19 @@ type MenuItemType = {
const menuItems: Array<Array<MenuItemType>> = [
[
{ href: '/', title: 'Notifications', icon: Notification },
{ href: 'my-services', title: 'CustomerClub', icon: Cup },
{ href: 'services', title: 'Discounts', icon: TicketDiscount },
{ href: 'notifications', title: 'Notifications', icon: Notification },
{ href: 'transactions/discount/club', title: 'CustomerClub', icon: Cup },
{ href: 'transactions/discount', title: 'Discounts', icon: TicketDiscount },
{ href: 'order/history', title: 'Orders', icon: CalendarSearch },
{ href: 'transactions', title: 'Transactions', icon: Receipt1 },
{ href: 'game', title: 'Games', icon: Game },
{ href: '?share', title: 'ShareWithFriends', icon: Like1 },
{ href: 'report', title: 'ReportProblem', icon: NoteBoardIcon },
{ href: 'invoices', title: 'InstallApp', icon: DirectboxReceive }
{ href: '?installpwa', title: 'InstallApp', icon: DirectboxReceive }
],
[],
[
{ auth: true, href: undefined, title: 'Preferences', icon: Setting2 },
{ auth: true, href: 'profile/settings', title: 'Preferences', icon: Setting2 },
{ auth: true, href: '?logout', title: 'Logout', icon: LogoutCurve }
]
];
@@ -55,6 +55,7 @@ function SideMenu({ menuState, toggleMenuState, nightModeState, togglenightModeS
const userIsAuthenticated = true; // useAuthStore((state) => state.isAuthenticated);
const { state: logoutModal, toggle: toggleLogoutModal } = useToggle();
const { state: shareModal, toggle: toggleShareModal } = useToggle();
const { state: installPwaModal, toggle: toggleInstallPwaModal } = useToggle();
const params = useParams();
const { name } = params;
@@ -65,6 +66,9 @@ function SideMenu({ menuState, toggleMenuState, nightModeState, togglenightModeS
const { t: tShareModal } = useTranslation('common', {
keyPrefix: 'ShareModal'
});
const { t: tInstallPwaModal } = useTranslation('common', {
keyPrefix: 'InstallPwaModal'
});
const variants: Variants = {
hidden: { x: '100%', transition: { duration: 0.1, ease: 'easeInOut' } },
@@ -79,7 +83,8 @@ function SideMenu({ menuState, toggleMenuState, nightModeState, togglenightModeS
const hrefOnClicks = [
{ href: '?logout', handler: toggleLogoutModal },
{ href: '?share', handler: toggleShareModal }
{ href: '?share', handler: toggleShareModal },
{ href: '?installpwa', handler: toggleInstallPwaModal }
];
const renderMenu = () => {
@@ -238,6 +243,25 @@ function SideMenu({ menuState, toggleMenuState, nightModeState, togglenightModeS
</div>
</div>
</Modal>
{/* Install PWA modal */}
<Modal
visible={installPwaModal}
onClick={toggleInstallPwaModal}
>
<h2 className="text-base font-medium">
<DirectInbox className="inline-block ml-2 mb-1.5 stroke-primary" size={24} />
{tInstallPwaModal('Heading')}
</h2>
<p className="text-xs font-medium mt-6">
{tInstallPwaModal('Description')}
</p>
<Button onClick={() => { }} className="text-sm mt-8">
<span className="font-light">{tInstallPwaModal('ButtonOk')}</span>
</Button>
</Modal>
</>
);
}