Skip to content

Commit

Permalink
chore: make sidebar less intrusive for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
leangseu-edx committed May 14, 2024
1 parent bfb55f2 commit 04b8e62
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/courseware/course/sidebar/SidebarContextProvider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const SidebarProvider = ({
const { alwaysOpenAuxiliarySidebar } = useSelector(getCoursewareOutlineSidebarSettings);
const isInitiallySidebarOpen = shouldDisplaySidebarOpen || query.get('sidebar') === 'true';

let initialSidebar = null;
if (isInitiallySidebarOpen && alwaysOpenAuxiliarySidebar) {
let initialSidebar = shouldDisplayFullScreen ? getLocalStorage(`sidebar.${courseId}`): null;

Check failure on line 31 in src/courseware/course/sidebar/SidebarContextProvider.jsx

View workflow job for this annotation

GitHub Actions / tests

Operator ':' must be spaced
if (!shouldDisplayFullScreen && isInitiallySidebarOpen && alwaysOpenAuxiliarySidebar) {
initialSidebar = isUnitHasDiscussionTopics
? SIDEBARS[discussionsSidebar.ID].ID
: verifiedMode && SIDEBARS[notificationsSidebar.ID].ID;
Expand Down Expand Up @@ -57,7 +57,9 @@ const SidebarProvider = ({

const toggleSidebar = useCallback((sidebarId) => {
// Switch to new sidebar or hide the current sidebar
setCurrentSidebar(sidebarId === currentSidebar ? null : sidebarId);
const newSidebar = sidebarId === currentSidebar ? null : sidebarId;
setCurrentSidebar(newSidebar);
setLocalStorage(`sidebar.${courseId}`, newSidebar);
}, [currentSidebar]);

const contextValue = useMemo(() => ({
Expand Down

0 comments on commit 04b8e62

Please sign in to comment.