permission in sidemenu base and permium

This commit is contained in:
hamid zarghami
2025-12-27 10:55:03 +03:30
parent da88e4314a
commit b8905e4b06
2 changed files with 9 additions and 4 deletions
@@ -44,6 +44,7 @@ export interface Restaurant {
vat: number; vat: number;
domain: string; domain: string;
score: Score; score: Score;
plan: 'base' | 'premium';
} }
export interface ReviewFood { export interface ReviewFood {
+8 -4
View File
@@ -25,15 +25,16 @@ type MenuItemType = {
icon: Icon; icon: Icon;
auth?: boolean; auth?: boolean;
guestOnly?: boolean; guestOnly?: boolean;
premiumOnly?: boolean;
}; };
const menuItems: Array<Array<MenuItemType>> = [ const menuItems: Array<Array<MenuItemType>> = [
[ [
{ href: 'notifications', title: 'Notifications', icon: Notification }, { href: 'notifications', title: 'Notifications', icon: Notification },
{ href: 'transactions/discount/club', title: 'CustomerClub', icon: Cup }, { href: 'transactions/discount/club', title: 'CustomerClub', icon: Cup, premiumOnly: true },
{ href: 'transactions/discount', title: 'Discounts', icon: TicketDiscount }, { href: 'transactions/discount', title: 'Discounts', icon: TicketDiscount, premiumOnly: true },
{ href: 'order/history', title: 'Orders', icon: CalendarSearch }, { href: 'order/history', title: 'Orders', icon: CalendarSearch, premiumOnly: true },
{ href: 'transactions', title: 'Transactions', icon: Receipt1 }, { href: 'transactions', title: 'Transactions', icon: Receipt1, premiumOnly: true },
{ href: 'game', title: 'Games', icon: Game }, { href: 'game', title: 'Games', icon: Game },
{ href: '?share', title: 'ShareWithFriends', icon: Like1 }, { href: '?share', title: 'ShareWithFriends', icon: Like1 },
{ href: 'report', title: 'ReportProblem', icon: NoteBoardIcon }, { href: 'report', title: 'ReportProblem', icon: NoteBoardIcon },
@@ -82,6 +83,8 @@ function SideMenu({ menuState, toggleMenuState, nightModeState, togglenightModeS
const [isPWAInstalled, setIsPWAInstalled] = useState(false); const [isPWAInstalled, setIsPWAInstalled] = useState(false);
const { data: aboutData } = useGetAbout(); const { data: aboutData } = useGetAbout();
const { isSuccess } = useGetProfile(); const { isSuccess } = useGetProfile();
const isPremium = aboutData?.data?.plan === 'premium';
const params = useParams(); const params = useParams();
const { name } = params; const { name } = params;
@@ -163,6 +166,7 @@ function SideMenu({ menuState, toggleMenuState, nightModeState, togglenightModeS
if (item.auth && !isSuccess) return false; if (item.auth && !isSuccess) return false;
if (item.guestOnly && isSuccess) return false; if (item.guestOnly && isSuccess) return false;
if (item.href === '?installpwa' && isPWAInstalled) return false; if (item.href === '?installpwa' && isPWAInstalled) return false;
if (item.premiumOnly && !isPremium) return false;
return true; return true;
}) })
.map(({ icon: Icon, ...item }, index) => { .map(({ icon: Icon, ...item }, index) => {