= ({
}, [courseId]);
useEffect(() => {
+ window.sessionStorage.setItem('hideCourseOutlineSidebar', 'true');
+ window.sessionStorage.setItem(`notificationTrayStatus.${courseId}`, 'open');
setHideDiscussionbar(!isDiscussionbarAvailable);
setHideNotificationbar(!isNotificationbarAvailable);
if (initialSidebar && currentSidebar !== initialSidebar) {
diff --git a/src/courseware/course/new-sidebar/sidebars/discussions-notifications/discussions/DiscussionsWidget.test.tsx b/src/courseware/course/new-sidebar/sidebars/discussions-notifications/discussions/DiscussionsWidget.test.tsx
index 3b35d8c2..38eaf00f 100644
--- a/src/courseware/course/new-sidebar/sidebars/discussions-notifications/discussions/DiscussionsWidget.test.tsx
+++ b/src/courseware/course/new-sidebar/sidebars/discussions-notifications/discussions/DiscussionsWidget.test.tsx
@@ -1,11 +1,13 @@
import React from 'react';
+import { fireEvent } from '@testing-library/react';
import MockAdapter from 'axios-mock-adapter';
import { getConfig } from '@edx/frontend-platform';
-import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
import { sendTrackEvent } from '@edx/frontend-platform/analytics';
+import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
+import { getSessionStorage, setSessionStorage } from '../../../../../../data/sessionStorage';
import {
initializeMockApp, initializeTestStore, render, screen,
} from '../../../../../../setupTest';
@@ -14,11 +16,19 @@ import { buildTopicsFromUnits } from '../../../../../data/__factories__/discussi
import { getCourseDiscussionTopics } from '../../../../../data/thunks';
import SidebarContext from '../../../SidebarContext';
import DiscussionsNotificationsSidebar from '../DiscussionsNotificationsSidebar';
+import DiscussionsNotificationsTrigger from '../DiscussionsNotificationsTrigger';
import DiscussionsWidget from './DiscussionsWidget';
initializeMockApp();
jest.mock('@edx/frontend-platform/analytics');
+jest.mock('../../../../../../data/sessionStorage', () => ({
+ getSessionStorage: jest.fn(),
+ setSessionStorage: jest.fn(),
+}));
+
+const onClickMock = jest.fn();
+
describe('DiscussionsWidget', () => {
let axiosMock;
let mockData;
@@ -81,4 +91,34 @@ describe('DiscussionsWidget', () => {
expect(screen.queryByText('Back to course')).toBeInTheDocument();
expect(sendTrackEvent).toHaveBeenCalledTimes(1);
});
+
+ it('should open notification tray if closed', () => {
+ (getSessionStorage as jest.Mock).mockReturnValue('closed');
+
+ renderWithProvider(() => );
+
+ const button = screen.getByRole('button');
+ fireEvent.click(button);
+
+ expect(setSessionStorage).toHaveBeenCalledWith(
+ `notificationTrayStatus.${courseId}`,
+ 'open',
+ );
+ expect(onClickMock).toHaveBeenCalled();
+ });
+
+ it('should close notification tray if open', () => {
+ (getSessionStorage as jest.Mock).mockReturnValue('open');
+
+ renderWithProvider(() => );
+
+ const button = screen.getByRole('button');
+ fireEvent.click(button);
+
+ expect(setSessionStorage).toHaveBeenCalledWith(
+ `notificationTrayStatus.${courseId}`,
+ 'open',
+ );
+ expect(onClickMock).toHaveBeenCalled();
+ });
});
diff --git a/src/courseware/course/sequence/Sequence.jsx b/src/courseware/course/sequence/Sequence.jsx
index e0b3c0a8..30d51cf8 100644
--- a/src/courseware/course/sequence/Sequence.jsx
+++ b/src/courseware/course/sequence/Sequence.jsx
@@ -218,18 +218,20 @@ const Sequence = ({
if (sequenceStatus === 'loaded') {
return (
-
-
- {defaultContent}
-
+ <>
+
+
+ {defaultContent}
+
+
-
+ >
);
}
diff --git a/src/courseware/course/sidebar/sidebars/course-outline/CourseOutlineTray.scss b/src/courseware/course/sidebar/sidebars/course-outline/CourseOutlineTray.scss
index 8376f4aa..0c61035a 100644
--- a/src/courseware/course/sidebar/sidebars/course-outline/CourseOutlineTray.scss
+++ b/src/courseware/course/sidebar/sidebars/course-outline/CourseOutlineTray.scss
@@ -1,14 +1,12 @@
.outline-sidebar-wrapper {
width: 32.125rem;
max-width: 100%;
- overflow: auto;
position: relative;
flex-shrink: 0;
}
.outline-sidebar {
@media (min-width: map-get($grid-breakpoints, "xl")) {
- position: absolute;
left: 0;
top: 0;
}
diff --git a/src/courseware/course/sidebar/sidebars/course-outline/hooks.js b/src/courseware/course/sidebar/sidebars/course-outline/hooks.js
index 6d4ea8ca..71ed4bff 100644
--- a/src/courseware/course/sidebar/sidebars/course-outline/hooks.js
+++ b/src/courseware/course/sidebar/sidebars/course-outline/hooks.js
@@ -68,6 +68,7 @@ export const useCourseOutlineSidebar = () => {
} else {
toggleSidebar(ID);
window.sessionStorage.removeItem('hideCourseOutlineSidebar');
+ window.sessionStorage.setItem(`notificationTrayStatus.${courseId}`, 'closed');
}
};
diff --git a/src/generic/notices/NoticesProvider.jsx b/src/generic/notices/NoticesProvider.jsx
index ec163e2d..acbad187 100644
--- a/src/generic/notices/NoticesProvider.jsx
+++ b/src/generic/notices/NoticesProvider.jsx
@@ -1,4 +1,4 @@
-import React, { useEffect, useState } from 'react';
+import { useEffect, useState } from 'react';
import { getConfig } from '@edx/frontend-platform';
import PropTypes from 'prop-types';
import { getNotices } from './api';
@@ -25,11 +25,7 @@ const NoticesProvider = ({ children }) => {
getData();
}, []);
- return (
-
- {isRedirected === true ? null : children}
-
- );
+ return isRedirected === true ? null : children;
};
NoticesProvider.propTypes = {
diff --git a/src/index.jsx b/src/index.jsx
index 72c4992a..b3748ca6 100755
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -49,100 +49,102 @@ subscribe(APP_READY, () => {
-
- } />
- } />
- } />
-
- }
- />
- }
- />
-
-
-
-
-
- )}
- />
-
-
-
-
-
- )}
- />
-
-
-
-
-
- )}
- />
-
-
-
-
-
- )}
- />
- {DECODE_ROUTES.PROGRESS.map((route) => (
+
+
+ } />
+ } />
+ } />
+ }
+ />
+ }
+ />
+
-
-
+
+
- )}
+ )}
/>
- ))}
-
-
-
-
-
- )}
- />
- {DECODE_ROUTES.COURSEWARE.map((route) => (
-
+
+
+
- )}
+ )}
/>
- ))}
-
+
+
+
+
+
+ )}
+ />
+
+
+
+
+
+ )}
+ />
+ {DECODE_ROUTES.PROGRESS.map((route) => (
+
+
+
+
+
+ )}
+ />
+ ))}
+
+
+
+
+
+ )}
+ />
+ {DECODE_ROUTES.COURSEWARE.map((route) => (
+
+
+
+ )}
+ />
+ ))}
+
+
diff --git a/src/index.scss b/src/index.scss
index 29304d60..4edd1ff1 100755
--- a/src/index.scss
+++ b/src/index.scss
@@ -8,13 +8,20 @@
#root {
- display: flex;
- flex-direction: column;
- min-height: 100vh;
-
+ .app-container {
+ display: flex;
+ flex-direction: column;
+ min-height: 100svh;
+ }
+
main {
flex-grow: 1;
}
+ #main-content {
+ flex-grow: 1;
+ display: flex;
+ flex-direction: column;
+ }
header {
flex: 0 0 auto;