diff --git a/frontend/src/AppBuilder/LeftSidebar/PageMenu/PagePermission.jsx b/frontend/src/AppBuilder/LeftSidebar/PageMenu/PagePermission.jsx index 83c017f883..6a4a1c516a 100644 --- a/frontend/src/AppBuilder/LeftSidebar/PageMenu/PagePermission.jsx +++ b/frontend/src/AppBuilder/LeftSidebar/PageMenu/PagePermission.jsx @@ -190,11 +190,15 @@ export default function PagePermission({ darkMode }) { appPermissionService .createPagePermission(appId, editingPage?.id, body) .then((data) => { - toast.success('Permission successfully created!'); + toast.success('Permission successfully created!', { + className: 'text-nowrap w-auto mw-100', + }); updatePageWithPermissions(editingPage?.id, data); }) .catch(() => { - toast.error('Permission could not be created. Please try again!'); + toast.error('Permission could not be created. Please try again!', { + className: 'text-nowrap w-auto mw-100', + }); }) .finally(() => { setIsLoading(false); @@ -214,11 +218,15 @@ export default function PagePermission({ darkMode }) { appPermissionService .updatePagePermission(appId, editingPage?.id, body) .then((data) => { - toast.success('Permission successfully updated!'); + toast.success('Permission successfully updated!', { + className: 'text-nowrap w-auto mw-100', + }); updatePageWithPermissions(editingPage?.id, data); }) .catch(() => { - toast.error('Permission could not be updated. Please try again!'); + toast.error('Permission could not be updated. Please try again!', { + className: 'text-nowrap w-auto mw-100', + }); }) .finally(() => { setIsLoading(false); @@ -231,12 +239,16 @@ export default function PagePermission({ darkMode }) { appPermissionService .deletePagePermission(appId, pageToDelete) .then((data) => { - toast.success('Permission successfully deleted!'); + toast.success('Permission successfully deleted!', { + className: 'text-nowrap w-auto mw-100', + }); updatePageWithPermissions(pageToDelete, []); setPageToDelete(null); }) .catch(() => { - toast.error('Permission could not be deleted. Please try again!'); + toast.error('Permission could not be deleted. Please try again!', { + className: 'text-nowrap w-auto mw-100', + }); setShowConfirmDelete(false); togglePagePermissionModal(true); }) diff --git a/frontend/src/AppBuilder/Viewer/ViewerSidebarNavigation.jsx b/frontend/src/AppBuilder/Viewer/ViewerSidebarNavigation.jsx index a7111a48a0..5312d60a8a 100644 --- a/frontend/src/AppBuilder/Viewer/ViewerSidebarNavigation.jsx +++ b/frontend/src/AppBuilder/Viewer/ViewerSidebarNavigation.jsx @@ -149,7 +149,7 @@ export const ViewerSidebarNavigation = ({ const iconName = isHomePage && !page.icon ? 'IconHome2' : page.icon; // eslint-disable-next-line import/namespace const IconElement = Icons?.[iconName] ?? Icons?.['IconFileDescription']; - return page.hidden || page.disabled ? null : ( + return page.hidden || page.disabled || page?.restricted ? null : ( switchPageWrapper(page?.id)} diff --git a/frontend/src/AppBuilder/_hooks/useAppData.js b/frontend/src/AppBuilder/_hooks/useAppData.js index d10e4343b9..f131b4eb59 100644 --- a/frontend/src/AppBuilder/_hooks/useAppData.js +++ b/frontend/src/AppBuilder/_hooks/useAppData.js @@ -323,8 +323,8 @@ const useAppData = (appId, moduleId, darkMode, mode = 'edit', { environmentId, v let startingPage = appData.pages.find((page) => page.id === homePageId); //no access to homepage, set to the next available page - if (!homePageId) { - startingPage = appData.pages[0]; + if (startingPage?.restricted) { + startingPage = appData.pages.find((page) => !page?.restricted); } if (initialLoadRef.current) { @@ -341,7 +341,9 @@ const useAppData = (appId, moduleId, darkMode, mode = 'edit', { environmentId, v window.history.replaceState(null, null, newUrl); if (page?.restricted) { - toast.error('Access to this page is restricted. Contact admin to know more.'); + toast.error('Access to this page is restricted. Contact admin to know more.', { + className: 'text-nowrap w-auto mw-100', + }); } } else { startingPage = page;