diff --git a/src/app/[name]/(Main)/about/types/Types.ts b/src/app/[name]/(Main)/about/types/Types.ts index 5d85c3e..84abe96 100644 --- a/src/app/[name]/(Main)/about/types/Types.ts +++ b/src/app/[name]/(Main)/about/types/Types.ts @@ -44,6 +44,7 @@ export interface Restaurant { vat: number; domain: string; score: Score; + plan: 'base' | 'premium'; } export interface ReviewFood { diff --git a/src/components/menu/SideMenu.tsx b/src/components/menu/SideMenu.tsx index 7a1c79b..fa41eab 100644 --- a/src/components/menu/SideMenu.tsx +++ b/src/components/menu/SideMenu.tsx @@ -25,15 +25,16 @@ type MenuItemType = { icon: Icon; auth?: boolean; guestOnly?: boolean; + premiumOnly?: boolean; }; const menuItems: Array> = [ [ { 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: 'transactions/discount/club', title: 'CustomerClub', icon: Cup, premiumOnly: true }, + { href: 'transactions/discount', title: 'Discounts', icon: TicketDiscount, premiumOnly: true }, + { href: 'order/history', title: 'Orders', icon: CalendarSearch, premiumOnly: true }, + { href: 'transactions', title: 'Transactions', icon: Receipt1, premiumOnly: true }, { href: 'game', title: 'Games', icon: Game }, { href: '?share', title: 'ShareWithFriends', icon: Like1 }, { href: 'report', title: 'ReportProblem', icon: NoteBoardIcon }, @@ -82,6 +83,8 @@ function SideMenu({ menuState, toggleMenuState, nightModeState, togglenightModeS const [isPWAInstalled, setIsPWAInstalled] = useState(false); const { data: aboutData } = useGetAbout(); const { isSuccess } = useGetProfile(); + const isPremium = aboutData?.data?.plan === 'premium'; + const params = useParams(); const { name } = params; @@ -163,6 +166,7 @@ function SideMenu({ menuState, toggleMenuState, nightModeState, togglenightModeS if (item.auth && !isSuccess) return false; if (item.guestOnly && isSuccess) return false; if (item.href === '?installpwa' && isPWAInstalled) return false; + if (item.premiumOnly && !isPremium) return false; return true; }) .map(({ icon: Icon, ...item }, index) => {