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:
@@ -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(() => ({
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user