Skip to content

Commit 1653d29

Browse files
farhanclaude
andcommitted
refactor: Remove Legacy UI Waffle Flag Consumers — Phase 1a (#1)
* refactor: remove useNewCourseOutlinePage flag from textbooks breadcrumb Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent fc51f17 commit 1653d29

5 files changed

Lines changed: 7 additions & 24 deletions

File tree

src/course-checklist/ChecklistSection/ChecklistItemComment.jsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,14 @@ import { FormattedMessage, FormattedNumber } from '@edx/frontend-platform/i18n';
33
import { Icon } from '@openedx/paragon';
44
import { Link } from 'react-router-dom';
55
import { ModeComment } from '@openedx/paragon/icons';
6-
import { getConfig } from '@edx/frontend-platform';
7-
import { useWaffleFlags } from '../../data/apiHooks';
86
import messages from './messages';
97

108
const ChecklistItemComment = ({
119
courseId,
1210
checkId,
1311
data,
1412
}) => {
15-
const waffleFlags = useWaffleFlags(courseId);
16-
17-
const getPathToCourseOutlinePage = (assignmentId) => (waffleFlags.useNewCourseOutlinePage
18-
? `/course/${courseId}#${assignmentId}` :
19-
`${getConfig().STUDIO_BASE_URL}/course/${courseId}#${assignmentId}`);
13+
const getPathToCourseOutlinePage = (assignmentId) => `/course/${courseId}#${assignmentId}`;
2014

2115
const commentWrapper = (comment) => (
2216
<div className="row m-0 mt-3 pt-3 border-top align-items-center" data-identifier="comment">

src/custom-pages/CustomPages.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import DraggableList, { SortableItem } from '@src/generic/DraggableList';
2828
import ErrorAlert from '@src/editors/sharedComponents/ErrorAlerts/ErrorAlert';
2929
import { RequestStatus } from '@src/data/constants';
3030
import { useModels } from '@src/generic/model-store';
31-
import { useWaffleFlags } from '@src/data/apiHooks';
3231
import getPageHeadTitle from '@src/generic/utils';
3332
import { getPagePath } from '@src/utils';
3433
import { DeprecatedReduxState } from '@src/store';
@@ -70,8 +69,6 @@ const CustomPages = () => {
7069
const deletePageStatus = useSelector((state: DeprecatedReduxState) => state.customPages.deletingStatus);
7170
const savingStatus = useSelector(getSavingStatus);
7271
const loadingStatus = useSelector(getLoadingStatus);
73-
const waffleFlags = useWaffleFlags(courseId);
74-
7572
const pages = useModels('customPages', customPagesIds);
7673

7774
const handleAddPage = () => {
@@ -128,9 +125,7 @@ const CustomPages = () => {
128125
links={[
129126
{
130127
label: 'Content',
131-
to: waffleFlags.useNewCourseOutlinePage
132-
? `/course/${courseId}`
133-
: `${config.STUDIO_BASE_URL}/course/${courseId}`,
128+
to: `/course/${courseId}`,
134129
},
135130
{ label: 'Pages and Resources', to: getPagePath(courseId, 'true', 'tabs') },
136131
]}

src/studio-home/card-item/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { FormattedMessage, useIntl } from '@edx/frontend-platform/i18n';
1818
import { getConfig } from '@edx/frontend-platform';
1919
import { Link } from 'react-router-dom';
2020

21-
import { useWaffleFlags } from '@src/data/apiHooks';
2221
import { COURSE_CREATOR_STATES } from '@src/constants';
2322
import classNames from 'classnames';
2423
import { getStudioHomeData } from '../data/selectors';
@@ -248,11 +247,10 @@ export const CardItem: React.FC<Props> = ({
248247
courseCreatorStatus,
249248
rerunCreatorStatus,
250249
} = useSelector(getStudioHomeData);
251-
const waffleFlags = useWaffleFlags();
252250
const cardRef = useRef<HTMLDivElement>(null);
253251

254252
const destinationUrl: string = path ?? (
255-
waffleFlags.useNewCourseOutlinePage && !isLibraries
253+
!isLibraries
256254
? url
257255
: new URL(url, getConfig().STUDIO_BASE_URL).toString()
258256
);

src/textbooks/Textbooks.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { Link } from 'react-router-dom';
1212
import { useCourseAuthoringContext } from '@src/CourseAuthoringContext';
1313
import { RequestStatus } from '@src/data/constants';
1414

15-
import { useWaffleFlags } from '../data/apiHooks';
1615
import { SavingErrorAlert } from '../generic/saving-error-alert';
1716
import { LoadingSpinner } from '../generic/Loading';
1817
import SubHeader from '../generic/sub-header/SubHeader';
@@ -28,7 +27,6 @@ import messages from './messages';
2827
const Textbooks = () => {
2928
const intl = useIntl();
3029
const { courseId, courseDetails } = useCourseAuthoringContext();
31-
const waffleFlags = useWaffleFlags(courseId);
3230

3331
const {
3432
textbooks,
@@ -44,7 +42,7 @@ const Textbooks = () => {
4442
handleSavingStatusDispatch,
4543
handleTextbookEditFormSubmit,
4644
handleTextbookDeleteSubmit,
47-
} = useTextbooks(courseId, waffleFlags);
45+
} = useTextbooks(courseId);
4846

4947
if (isLoadingFailed) {
5048
return (

src/textbooks/hooks.jsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { useDispatch, useSelector } from 'react-redux';
2-
import { useContext, useEffect } from 'react';
3-
import { AppContext } from '@edx/frontend-platform/react';
2+
import { useEffect } from 'react';
43
import { useIntl } from '@edx/frontend-platform/i18n';
54
import { useToggle } from '@openedx/paragon';
65

@@ -20,10 +19,9 @@ import {
2019
} from './data/thunk';
2120
import messages from './messages';
2221

23-
const useTextbooks = (courseId, waffleFlags) => {
22+
const useTextbooks = (courseId) => {
2423
const intl = useIntl();
2524
const dispatch = useDispatch();
26-
const { config } = useContext(AppContext);
2725

2826
const textbooks = useSelector(getTextbooksData);
2927
const loadingStatus = useSelector(getLoadingStatus);
@@ -35,7 +33,7 @@ const useTextbooks = (courseId, waffleFlags) => {
3533
const breadcrumbs = [
3634
{
3735
label: intl.formatMessage(messages.breadcrumbContent),
38-
to: waffleFlags.useNewCourseOutlinePage ? `/course/${courseId}` : `${config.STUDIO_BASE_URL}/course/${courseId}`,
36+
to: `/course/${courseId}`,
3937
},
4038
{
4139
label: intl.formatMessage(messages.breadcrumbPagesAndResources),

0 commit comments

Comments
 (0)