chore: make sidebar less intrusive for mobile (#1377)

* chore: fix incorrect fetch result

* chore: make sidebar less intrusive for mobile

* chore: linting
This commit is contained in:
Leangseu Kim
2024-05-14 11:22:55 -04:00
committed by GitHub
parent 1857b86c7e
commit 257c9dcd7f
2 changed files with 6 additions and 4 deletions

View File

@@ -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;
if (!shouldDisplayFullScreen && isInitiallySidebarOpen && alwaysOpenAuxiliarySidebar) {
initialSidebar = isUnitHasDiscussionTopics
? SIDEBARS[discussionsSidebar.ID].ID
: verifiedMode && SIDEBARS[notificationsSidebar.ID].ID;
@@ -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(() => ({

View File

@@ -113,7 +113,7 @@ export function fetchCourse(courseId) {
logError(courseHomeMetadataResult.reason);
}
if (!fetchedCoursewareOutlineSidebarTogglesResult) {
logError(fetchedCoursewareOutlineSidebarTogglesResult.reason);
logError(coursewareOutlineSidebarTogglesResult.reason);
}
if (fetchedMetadata && fetchedCourseHomeMetadata) {
if (courseHomeMetadataResult.value.courseAccess.hasAccess && fetchedOutline) {