-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FC-0056][Plugin] Course outline sidebar (plugin wrapper) #1349
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { useEffect, useState } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Helmet } from 'react-helmet'; | ||
import { useDispatch } from 'react-redux'; | ||
import { getConfig } from '@edx/frontend-platform'; | ||
import { breakpoints, useWindowSize } from '@openedx/paragon'; | ||
|
||
import { AlertList } from '../../generic/user-messages'; | ||
|
||
import Sequence from './sequence'; | ||
|
||
import { CelebrationModal, shouldCelebrateOnSectionLoad, WeeklyGoalCelebrationModal } from './celebration'; | ||
import { PluginSlot } from '@openedx/frontend-plugin-framework'; | ||
|
||
import { AlertList } from '@src/generic/user-messages'; | ||
import { useModel } from '@src/generic/model-store'; | ||
import { | ||
OUTLINE_SIDEBAR_DESKTOP_PLUGIN_SLOT_ID, | ||
Trigger as CourseOutlineTrigger, | ||
checkIsOutlineSidebarAvailable, | ||
} from './sidebar/sidebars/course-outline'; | ||
import Chat from './chat/Chat'; | ||
import ContentTools from './content-tools'; | ||
import CourseBreadcrumbs from './CourseBreadcrumbs'; | ||
import SidebarProvider from './sidebar/SidebarContextProvider'; | ||
import SidebarTriggers from './sidebar/SidebarTriggers'; | ||
import NewSidebarProvider from './new-sidebar/SidebarContextProvider'; | ||
import NewSidebarTriggers from './new-sidebar/SidebarTriggers'; | ||
|
||
import { useModel } from '../../generic/model-store'; | ||
import { CelebrationModal, shouldCelebrateOnSectionLoad, WeeklyGoalCelebrationModal } from './celebration'; | ||
import CourseBreadcrumbs from './CourseBreadcrumbs'; | ||
import ContentTools from './content-tools'; | ||
import Sequence from './sequence'; | ||
|
||
const Course = ({ | ||
courseId, | ||
|
@@ -37,7 +40,7 @@ const Course = ({ | |
const sequence = useModel('sequences', sequenceId); | ||
const section = useModel('sections', sequence ? sequence.sectionId : null); | ||
const enableNewSidebar = getConfig().ENABLE_NEW_SIDEBAR; | ||
const navigationDisabled = sequence?.navigationDisabled ?? false; | ||
const navigationDisabled = checkIsOutlineSidebarAvailable() || (sequence?.navigationDisabled ?? false); | ||
|
||
const pageTitleBreadCrumbs = [ | ||
sequence, | ||
|
@@ -54,7 +57,6 @@ const Course = ({ | |
const [weeklyGoalCelebrationOpen, setWeeklyGoalCelebrationOpen] = useState( | ||
celebrations && !celebrations.streakLengthToCelebrate && celebrations.weeklyGoal, | ||
); | ||
const shouldDisplayTriggers = windowWidth >= breakpoints.small.minWidth; | ||
const shouldDisplayChat = windowWidth >= breakpoints.medium.minWidth; | ||
const daysPerWeek = course?.courseGoals?.selectedGoal?.daysPerWeek; | ||
|
||
|
@@ -76,7 +78,7 @@ const Course = ({ | |
<Helmet> | ||
<title>{`${pageTitleBreadCrumbs.join(' | ')} | ${getConfig().SITE_NAME}`}</title> | ||
</Helmet> | ||
<div className="position-relative d-flex align-items-center mb-4 mt-1"> | ||
<div className="position-relative d-flex align-items-xl-center mb-4 mt-1 flex-column flex-xl-row"> | ||
{navigationDisabled || ( | ||
<> | ||
<CourseBreadcrumbs | ||
|
@@ -100,11 +102,12 @@ const Course = ({ | |
/> | ||
</> | ||
)} | ||
{shouldDisplayTriggers && ( | ||
<> | ||
{enableNewSidebar === 'true' ? <NewSidebarTriggers /> : <SidebarTriggers /> } | ||
</> | ||
)} | ||
<div className="w-100 d-flex align-items-center"> | ||
<PluginSlot id={OUTLINE_SIDEBAR_DESKTOP_PLUGIN_SLOT_ID}> | ||
<CourseOutlineTrigger isMobileView /> | ||
</PluginSlot> | ||
{enableNewSidebar === 'true' ? <NewSidebarTriggers /> : <SidebarTriggers /> } | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, it would be best if we just went with it and removed the old triggers. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This all involves refactoring the new and old sidebars, which I wouldn't include in this PR. |
||
</div> | ||
|
||
<AlertList topic="sequence" /> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get rid of this env var and just enable it by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we should include refactoring the existing sidebars and removing the old one.
If we want to keep only the new sidebar, then we need to delete all links and files regarding the old sidebar, which can take a lot of time.