feat: [FC-0070] Remove backend redirects (use SPA functionality) (#1372)
Introduces the ability to utilize SPA functionality when the relevant waffle flags are enabled for current MFE pages. When any new MFE page is loaded, a request is made to retrieve the waffle flags. This includes both global waffle flags related to MFE Authoring pages, as well as waffle flags specific to the current course.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import classNames from 'classnames';
|
||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||
import { getConfig } from '@edx/frontend-platform';
|
||||
|
||||
import { getWaffleFlags } from '../../data/selectors';
|
||||
import { otherLinkURLParams } from './constants';
|
||||
import messages from './messages';
|
||||
import HelpSidebarLink from './HelpSidebarLink';
|
||||
@@ -25,6 +26,7 @@ const HelpSidebar = ({
|
||||
scheduleAndDetails,
|
||||
groupConfigurations,
|
||||
} = otherLinkURLParams;
|
||||
const waffleFlags = useSelector(getWaffleFlags);
|
||||
|
||||
const showOtherLink = (params) => !pathname.includes(params);
|
||||
const generateLegacyURL = (urlParameter) => {
|
||||
@@ -55,36 +57,46 @@ const HelpSidebar = ({
|
||||
<ul className="p-0 mb-0">
|
||||
{showOtherLink(scheduleAndDetails) && (
|
||||
<HelpSidebarLink
|
||||
pathToPage={scheduleAndDetailsDestination}
|
||||
pathToPage={waffleFlags.useNewScheduleDetailsPage
|
||||
? `/course/${courseId}/${scheduleAndDetails}` : scheduleAndDetailsDestination}
|
||||
title={intl.formatMessage(
|
||||
messages.sidebarLinkToScheduleAndDetails,
|
||||
)}
|
||||
isNewPage={waffleFlags.useNewScheduleDetailsPage}
|
||||
/>
|
||||
)}
|
||||
{showOtherLink(grading) && (
|
||||
<HelpSidebarLink
|
||||
pathToPage={gradingDestination}
|
||||
pathToPage={waffleFlags.useNewGradingPage
|
||||
? `/course/${courseId}/${grading}` : gradingDestination}
|
||||
title={intl.formatMessage(messages.sidebarLinkToGrading)}
|
||||
isNewPage={waffleFlags.useNewGradingPage}
|
||||
/>
|
||||
)}
|
||||
{showOtherLink(courseTeam) && (
|
||||
<HelpSidebarLink
|
||||
pathToPage={courseTeamDestination}
|
||||
pathToPage={waffleFlags.useNewCourseTeamPage
|
||||
? `/course/${courseId}/${courseTeam}` : courseTeamDestination}
|
||||
title={intl.formatMessage(messages.sidebarLinkToCourseTeam)}
|
||||
isNewPage={waffleFlags.useNewCourseTeamPage}
|
||||
/>
|
||||
)}
|
||||
{showOtherLink(groupConfigurations) && (
|
||||
<HelpSidebarLink
|
||||
pathToPage={groupConfigurationsDestination}
|
||||
pathToPage={waffleFlags.useNewGroupConfigurationsPage
|
||||
? `/course/${courseId}/${groupConfigurations}` : groupConfigurationsDestination}
|
||||
title={intl.formatMessage(
|
||||
messages.sidebarLinkToGroupConfigurations,
|
||||
)}
|
||||
isNewPage={waffleFlags.useNewGroupConfigurationsPage}
|
||||
/>
|
||||
)}
|
||||
{showOtherLink(advancedSettings) && (
|
||||
<HelpSidebarLink
|
||||
pathToPage={advancedSettingsDestination}
|
||||
pathToPage={waffleFlags.useNewAdvancedSettingsPage
|
||||
? `/course/${courseId}/${advancedSettings}` : advancedSettingsDestination}
|
||||
title={intl.formatMessage(messages.sidebarLinkToAdvancedSettings)}
|
||||
isNewPage={waffleFlags.useNewAdvancedSettingsPage}
|
||||
/>
|
||||
)}
|
||||
{proctoredExamSettingsUrl && (
|
||||
|
||||
Reference in New Issue
Block a user