diff --git a/src/features/Main/UnauthorizedPage/__test__/index.test.jsx b/src/features/Main/UnauthorizedPage/__test__/index.test.jsx new file mode 100644 index 0000000..20a6c17 --- /dev/null +++ b/src/features/Main/UnauthorizedPage/__test__/index.test.jsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { render } from '@testing-library/react'; +import '@testing-library/jest-dom/extend-expect'; +import UnauthorizedPage from 'features/Main/UnauthorizedPage'; + +import { unauthorizedText } from 'features/constants'; + +describe('Unauthorized Component', () => { + test('should render message', async () => { + const { container } = render(); + + expect(container).toHaveTextContent(unauthorizedText); + }); +}); diff --git a/src/features/Main/UnauthorizedPage/index.jsx b/src/features/Main/UnauthorizedPage/index.jsx new file mode 100644 index 0000000..8e65448 --- /dev/null +++ b/src/features/Main/UnauthorizedPage/index.jsx @@ -0,0 +1,16 @@ +import React from 'react'; + +import { Container } from '@edx/paragon'; + +import { unauthorizedText } from 'features/constants'; + +const UnauthorizedPage = () => ( + + +

{unauthorizedText}

+
+ +
+); + +export default UnauthorizedPage; diff --git a/src/features/Main/index.jsx b/src/features/Main/index.jsx index a1721c1..dff82d4 100644 --- a/src/features/Main/index.jsx +++ b/src/features/Main/index.jsx @@ -29,6 +29,7 @@ import InstructorsDetailPage from 'features/Instructors/InstructorsDetailPage'; import ActiveTabUpdater from 'features/Main//ActiveTabUpdater'; import ManageInstructors from 'features/Instructors/ManageInstructors'; import InstitutionSelector from 'features/Main/InstitutionSelector'; +import UnauthorizedPage from 'features/Main/UnauthorizedPage'; import { fetchInstitutionData } from 'features/Main/data/thunks'; import { updateSelectedInstitution } from 'features/Main/data/slice'; @@ -81,29 +82,34 @@ const Main = () => {
- - - - {institutions.length > 1 && ()} - - - - - - {routes.map(({ path, exact, component: Component }) => ( - ( - - - - )} - /> - ))} - - + {institutions.length < 1 && } + {institutions.length > 0 && ( + <> + + + + {institutions.length > 1 && ()} + + + + + + {routes.map(({ path, exact, component: Component }) => ( + ( + + + + )} + /> + ))} + + + + )}
diff --git a/src/features/constants.js b/src/features/constants.js index 7d8c59a..9fe51a2 100644 --- a/src/features/constants.js +++ b/src/features/constants.js @@ -76,3 +76,9 @@ export const INSTITUTION_QUERY_ID = 'institutionId'; * @constant {string} */ export const cookieText = 'This website uses cookies to ensure you get the best experience on our website. If you continue browsing this site, we understand that you accept the use of cookies.'; + +/** + * Text for unauthorized user. + * @constant {string} + */ +export const unauthorizedText = 'You do not have access to CertPREP Manager. If you believe you should have access then please contact your sales rep.';