Skip to content

Commit

Permalink
feat: SEB component integration POC
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajgrimaldi committed Mar 13, 2024
1 parent b547ada commit b89693d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/generic/SEBCourseAccessErrorPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React, { useEffect } from 'react';

Check failure on line 1 in src/generic/SEBCourseAccessErrorPage.jsx

View workflow job for this annotation

GitHub Actions / tests

'useEffect' is defined but never used
import { LearningHeader as Header } from '@edx/frontend-component-header';
import Footer from '@edx/frontend-component-footer';
import { useParams } from 'react-router-dom';

Check failure on line 4 in src/generic/SEBCourseAccessErrorPage.jsx

View workflow job for this annotation

GitHub Actions / tests

'useParams' is defined but never used
import { useDispatch } from 'react-redux';

Check failure on line 5 in src/generic/SEBCourseAccessErrorPage.jsx

View workflow job for this annotation

GitHub Actions / tests

'useDispatch' is defined but never used
import { injectIntl } from '@edx/frontend-platform/i18n';

Check failure on line 6 in src/generic/SEBCourseAccessErrorPage.jsx

View workflow job for this annotation

GitHub Actions / tests

'/home/runner/work/frontend-app-learning/frontend-app-learning/node_modules/@edx/frontend-platform/i18n/index.js' imported multiple times
import { Alert } from '@openedx/paragon';
import { WarningFilled } from '@openedx/paragon/icons';
import { FormattedMessage } from '@edx/frontend-platform/i18n';

Check failure on line 9 in src/generic/SEBCourseAccessErrorPage.jsx

View workflow job for this annotation

GitHub Actions / tests

'/home/runner/work/frontend-app-learning/frontend-app-learning/node_modules/@edx/frontend-platform/i18n/index.js' imported multiple times

const SEBCourseAccessErrorPage = ({ intl }) => {

Check failure on line 11 in src/generic/SEBCourseAccessErrorPage.jsx

View workflow job for this annotation

GitHub Actions / tests

'intl' is missing in props validation

Check failure on line 11 in src/generic/SEBCourseAccessErrorPage.jsx

View workflow job for this annotation

GitHub Actions / tests

'intl' is defined but never used

Check failure on line 11 in src/generic/SEBCourseAccessErrorPage.jsx

View workflow job for this annotation

GitHub Actions / tests

Block must not be padded by blank lines

Check failure on line 11 in src/generic/SEBCourseAccessErrorPage.jsx

View workflow job for this annotation

GitHub Actions / tests

Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`

return (
<>
<Header />
<main id="main-content" className="container my-5 text-center" data-testid="access-denied-main">
<Alert variant="warning" icon={WarningFilled}>

Check failure on line 17 in src/generic/SEBCourseAccessErrorPage.jsx

View workflow job for this annotation

GitHub Actions / tests

Expected indentation of 8 space characters but found 6
<FormattedMessage
id="learning.accessDenied.alert"
description="Alert message shown to learner when access to the course is denied"
defaultMessage="Please use Safe Exam Browser to access this course."
/>
</Alert>
</main>
<Footer />
</>
);
}

export default injectIntl(SEBCourseAccessErrorPage);
2 changes: 2 additions & 0 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import LiveTab from './course-home/live-tab/LiveTab';
import CourseAccessErrorPage from './generic/CourseAccessErrorPage';
import DecodePageRoute from './decode-page-route';
import { DECODE_ROUTES, ROUTES } from './constants';
import SEBCourseAccessErrorPage from './generic/SEBCourseAccessErrorPage';

subscribe(APP_READY, () => {
ReactDOM.render(
Expand All @@ -50,6 +51,7 @@ subscribe(APP_READY, () => {
<Routes>
<Route path={ROUTES.UNSUBSCRIBE} element={<PageWrap><GoalUnsubscribe /></PageWrap>} />
<Route path={ROUTES.REDIRECT} element={<PageWrap><CoursewareRedirectLandingPage /></PageWrap>} />
<Route path={'/seb-openedx/courseware/access-denied/:courseId'} element={<SEBCourseAccessErrorPage />} />
<Route
path={DECODE_ROUTES.ACCESS_DENIED}
element={<DecodePageRoute><CourseAccessErrorPage /></DecodePageRoute>}
Expand Down
3 changes: 3 additions & 0 deletions src/shared/access.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { getLocale } from '@edx/frontend-platform/i18n';
export function getAccessDeniedRedirectUrl(courseId, activeTabSlug, courseAccess, start) {
let url = null;
switch (courseAccess.errorCode) {
case 'seb_access_denied':
url = `/seb-openedx/courseware/access-denied/${courseId}`;
break;
case 'audit_expired':
url = `/redirect/dashboard?access_response_error=${courseAccess.additionalContextUserMessage}`;
break;
Expand Down

0 comments on commit b89693d

Please sign in to comment.