Skip to content

Commit edb003b

Browse files
committed
feat: remove ENABLE_UNIT_PAGE_NEW_DESIGN
1 parent 29987b6 commit edb003b

15 files changed

Lines changed: 30 additions & 480 deletions

File tree

src/course-unit/CourseUnit.test.tsx

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2344,11 +2344,7 @@ describe('<CourseUnit />', () => {
23442344
expect(screen.queryByText(addComponentMessages.title.defaultMessage)).not.toBeInTheDocument();
23452345
});
23462346

2347-
it('renders new unit info/settings sidebar', async () => {
2348-
setConfig({
2349-
...getConfig(),
2350-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2351-
});
2347+
it('renders unit info/settings sidebar', async () => {
23522348
const user = userEvent.setup();
23532349
render(<RootWrapper />);
23542350

@@ -2373,10 +2369,6 @@ describe('<CourseUnit />', () => {
23732369
});
23742370

23752371
it('displays the live state in the status bar', async () => {
2376-
setConfig({
2377-
...getConfig(),
2378-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2379-
});
23802372
axiosMock
23812373
.onGet(getCourseSectionVerticalApiUrl(blockId))
23822374
.reply(200, {
@@ -2473,11 +2465,6 @@ describe('<CourseUnit />', () => {
24732465
});
24742466

24752467
it('displays the staff only state in the status bar', async () => {
2476-
setConfig({
2477-
...getConfig(),
2478-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2479-
});
2480-
24812468
axiosMock
24822469
.onGet(getCourseSectionVerticalApiUrl(blockId))
24832470
.reply(200, {
@@ -2497,10 +2484,6 @@ describe('<CourseUnit />', () => {
24972484

24982485
it('should disable discussions in the settings sidebar', async () => {
24992486
const user = userEvent.setup();
2500-
setConfig({
2501-
...getConfig(),
2502-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2503-
});
25042487
render(<RootWrapper />);
25052488

25062489
axiosMock
@@ -2553,11 +2536,6 @@ describe('<CourseUnit />', () => {
25532536

25542537
it('should update the group access in the unit sidebar', async () => {
25552538
const user = userEvent.setup();
2556-
2557-
setConfig({
2558-
...getConfig(),
2559-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2560-
});
25612539
render(<RootWrapper />);
25622540

25632541
axiosMock
@@ -2633,10 +2611,6 @@ describe('<CourseUnit />', () => {
26332611
});
26342612

26352613
it('should one group in the visibility field in the unit sidebar', async () => {
2636-
setConfig({
2637-
...getConfig(),
2638-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2639-
});
26402614
render(<RootWrapper />);
26412615

26422616
axiosMock
@@ -2688,10 +2662,6 @@ describe('<CourseUnit />', () => {
26882662
});
26892663

26902664
it('should multiple groups in the visibility field in the unit sidebar', async () => {
2691-
setConfig({
2692-
...getConfig(),
2693-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2694-
});
26952665
render(<RootWrapper />);
26962666

26972667
axiosMock
@@ -2746,10 +2716,6 @@ describe('<CourseUnit />', () => {
27462716
});
27472717

27482718
it('should render never published state in the unit sidebar', async () => {
2749-
setConfig({
2750-
...getConfig(),
2751-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2752-
});
27532719
render(<RootWrapper />);
27542720

27552721
axiosMock
@@ -2776,10 +2742,6 @@ describe('<CourseUnit />', () => {
27762742
});
27772743

27782744
it('displays the scheduled state in the status bar', async () => {
2779-
setConfig({
2780-
...getConfig(),
2781-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2782-
});
27832745
axiosMock
27842746
.onGet(getCourseSectionVerticalApiUrl(blockId))
27852747
.reply(200, {
@@ -2796,10 +2758,6 @@ describe('<CourseUnit />', () => {
27962758
});
27972759

27982760
it('displays the draft changes state in the status bar', async () => {
2799-
setConfig({
2800-
...getConfig(),
2801-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2802-
});
28032761
axiosMock
28042762
.onGet(getCourseSectionVerticalApiUrl(blockId))
28052763
.reply(200, {
@@ -2816,10 +2774,6 @@ describe('<CourseUnit />', () => {
28162774
});
28172775

28182776
it('displays discussions enabled label in the status bar', async () => {
2819-
setConfig({
2820-
...getConfig(),
2821-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2822-
});
28232777
axiosMock
28242778
.onGet(getCourseSectionVerticalApiUrl(blockId))
28252779
.reply(200, {
@@ -2835,10 +2789,6 @@ describe('<CourseUnit />', () => {
28352789
});
28362790

28372791
it('displays group access with one group in the status bar', async () => {
2838-
setConfig({
2839-
...getConfig(),
2840-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2841-
});
28422792
axiosMock
28432793
.onGet(getCourseSectionVerticalApiUrl(blockId))
28442794
.reply(200, {
@@ -2882,10 +2832,6 @@ describe('<CourseUnit />', () => {
28822832
});
28832833

28842834
it('displays group access with multiple groups in the status bar', async () => {
2885-
setConfig({
2886-
...getConfig(),
2887-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2888-
});
28892835
axiosMock
28902836
.onGet(getCourseSectionVerticalApiUrl(blockId))
28912837
.reply(200, {
@@ -2932,7 +2878,6 @@ describe('<CourseUnit />', () => {
29322878
setConfig({
29332879
...getConfig(),
29342880
ENABLE_TAGGING_TAXONOMY_PAGES: 'true',
2935-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
29362881
});
29372882

29382883
render(<RootWrapper />);
@@ -2963,11 +2908,6 @@ describe('<CourseUnit />', () => {
29632908
};
29642909

29652910
beforeEach(async () => {
2966-
setConfig({
2967-
...getConfig(),
2968-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
2969-
});
2970-
29712911
// The Meilisearch client-side API uses fetch, not Axios.
29722912
fetchMock.mockReset();
29732913
fetchMock.post(searchEndpoint, (_url, req) => {
@@ -3211,10 +3151,6 @@ describe('<CourseUnit />', () => {
32113151
});
32123152

32133153
it('not render add sidebar in units from libraries (read-only)', async () => {
3214-
setConfig({
3215-
...getConfig(),
3216-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
3217-
});
32183154
render(<RootWrapper />);
32193155

32203156
axiosMock
@@ -3247,11 +3183,6 @@ describe('<CourseUnit />', () => {
32473183
});
32483184

32493185
it('opens the component info sidebar on postMessage event', async () => {
3250-
setConfig({
3251-
...getConfig(),
3252-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
3253-
});
3254-
32553186
render(<RootWrapper />);
32563187

32573188
await screen.findByTitle(xblockContainerIframeMessages.xblockIframeTitle.defaultMessage);

src/course-unit/CourseUnit.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ import CourseUnitHeaderActionsSlot from '../plugin-slots/CourseUnitHeaderActions
4747
import { UnitSidebarProvider } from './unit-sidebar/UnitSidebarContext';
4848
import { UnitSidebarPagesProvider } from './unit-sidebar/UnitSidebarPagesContext';
4949
import { UNIT_VISIBILITY_STATES } from './constants';
50-
import { isUnitPageNewDesignEnabled } from './utils';
5150

5251
const StatusBar = ({ courseUnit }: { courseUnit: any }) => {
5352
const { selectedPartitionIndex, selectedGroupsLabel } = courseUnit.userPartitionInfo ?? {};
@@ -297,7 +296,6 @@ const CourseUnit = () => {
297296
isTitleEditFormOpen={isTitleEditFormOpen}
298297
handleTitleEdit={handleTitleEdit}
299298
handleTitleEditSubmit={handleTitleEditSubmit}
300-
handleConfigureSubmit={handleConfigureSubmit}
301299
/>
302300
)}
303301
breadcrumbs={(
@@ -316,7 +314,7 @@ const CourseUnit = () => {
316314
)}
317315
/>
318316
<div className="unit-header-status-bar h5 mt-2 mb-4 font-weight-normal">
319-
{isUnitPageNewDesignEnabled() && isUnitVerticalType && (
317+
{isUnitVerticalType && (
320318
<StatusBar courseUnit={courseUnit} />
321319
)}
322320
</div>

src/course-unit/header-navigations/HeaderNavigations.test.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ describe('<HeaderNavigations />', () => {
7979
});
8080

8181
it('click Info button should open info sidebar', async () => {
82-
setConfig({
83-
...getConfig(),
84-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
85-
});
86-
8782
const user = userEvent.setup();
8883
renderComponent({ unitCategory: COURSE_BLOCK_NAMES.vertical.id });
8984

@@ -95,11 +90,6 @@ describe('<HeaderNavigations />', () => {
9590
});
9691

9792
it('click Add button should open add sidebar', async () => {
98-
setConfig({
99-
...getConfig(),
100-
ENABLE_UNIT_PAGE_NEW_DESIGN: 'true',
101-
});
102-
10393
const user = userEvent.setup();
10494
renderComponent({ unitCategory: COURSE_BLOCK_NAMES.vertical.id });
10595

src/course-unit/header-navigations/HeaderNavigations.tsx

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
import { COURSE_BLOCK_NAMES } from '@src/constants';
99

1010
import messages from './messages';
11-
import { isUnitPageNewDesignEnabled } from '../utils';
1211
import { useUnitSidebarContext } from '../unit-sidebar/UnitSidebarContext';
1312

1413
type HeaderNavigationActions = {
@@ -38,35 +37,31 @@ const HeaderNavigations = ({ headerNavigationsActions, category }: HeaderNavigat
3837

3938
const { setCurrentPageKey, readOnly } = useUnitSidebarContext();
4039

41-
const showNewDesignButtons = isUnitPageNewDesignEnabled();
42-
4340
return (
4441
<nav className="header-navigations ml-auto flex-shrink-0">
4542
{/**
4643
* Action buttons used in the unit page
4744
*/}
4845
{category === COURSE_BLOCK_NAMES.vertical.id && (
4946
<Stack direction="horizontal" gap={3}>
50-
{showNewDesignButtons && (
51-
<>
47+
<>
48+
<Button
49+
variant="outline-primary"
50+
iconBefore={InfoOutline}
51+
onClick={() => setCurrentPageKey('info', null)}
52+
>
53+
{intl.formatMessage(messages.infoButton)}
54+
</Button>
55+
{!readOnly && (
5256
<Button
5357
variant="outline-primary"
54-
iconBefore={InfoOutline}
55-
onClick={() => setCurrentPageKey('info', null)}
58+
iconBefore={Add}
59+
onClick={() => setCurrentPageKey('add', null)}
5660
>
57-
{intl.formatMessage(messages.infoButton)}
61+
{intl.formatMessage(messages.addButton)}
5862
</Button>
59-
{!readOnly && (
60-
<Button
61-
variant="outline-primary"
62-
iconBefore={Add}
63-
onClick={() => setCurrentPageKey('add', null)}
64-
>
65-
{intl.formatMessage(messages.addButton)}
66-
</Button>
67-
)}
68-
</>
69-
)}
63+
)}
64+
</>
7065
<ButtonGroup>
7166
<Button
7267
variant="outline-primary"

src/course-unit/header-title/HeaderTitle.tsx

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,37 @@
11
import { useEffect, useState } from 'react';
2-
import { useDispatch, useSelector } from 'react-redux';
2+
import { useDispatch } from 'react-redux';
33
import {
4-
Form, IconButton, useToggle,
4+
Form, IconButton,
55
} from '@openedx/paragon';
66
import {
77
EditOutline as EditIcon,
8-
Settings as SettingsIcon,
98
} from '@openedx/paragon/icons';
109

11-
import ConfigureModal from '@src/generic/configure-modal/ConfigureModal';
12-
import { COURSE_BLOCK_NAMES } from '@src/constants';
1310
import { useIntl } from '@edx/frontend-platform/i18n';
14-
import { ConfigureUnitData } from '@src/course-outline/data/types';
15-
import { getCourseUnitData } from '../data/selectors';
1611
import { updateQueryPendingStatus } from '../data/slice';
1712
import messages from './messages';
18-
import { isUnitPageNewDesignEnabled } from '../utils';
1913

2014
type HeaderTitleProps = {
2115
unitTitle: string;
2216
isTitleEditFormOpen: boolean;
2317
handleTitleEdit: () => void;
2418
handleTitleEditSubmit: (title: string) => void;
25-
handleConfigureSubmit: (variables: ConfigureUnitData & { closeModalFn?: () => void }) => void;
2619
};
2720

2821
/**
29-
* Component that renders the title and extra action buttons:
22+
* Component that renders the title with a button to edit it.
3023
* - Edit button: Hidden, It appears when you hover over it.
3124
* The title becomes a text form.
32-
* - Settings button: Shown only in the legacy unit page.
33-
* Opens a settings modal.
3425
*/
3526
const HeaderTitle = ({
3627
unitTitle,
3728
isTitleEditFormOpen,
3829
handleTitleEdit,
3930
handleTitleEditSubmit,
40-
handleConfigureSubmit,
4131
}: HeaderTitleProps) => {
4232
const intl = useIntl();
4333
const dispatch = useDispatch();
4434
const [titleValue, setTitleValue] = useState(unitTitle);
45-
const currentItemData = useSelector(getCourseUnitData);
46-
const [isConfigureModalOpen, openConfigureModal, closeConfigureModal] = useToggle(false);
47-
48-
const isXBlockComponent = [
49-
COURSE_BLOCK_NAMES.libraryContent.id,
50-
COURSE_BLOCK_NAMES.splitTest.id,
51-
COURSE_BLOCK_NAMES.component.id,
52-
].includes(currentItemData.category);
53-
54-
const onConfigureSubmit = (variables: Omit<ConfigureUnitData, 'unitId'>) => {
55-
handleConfigureSubmit({
56-
...variables,
57-
unitId: currentItemData.id,
58-
closeModalFn: closeConfigureModal,
59-
});
60-
};
6135

6236
useEffect(() => {
6337
setTitleValue(unitTitle);
@@ -89,24 +63,6 @@ const HeaderTitle = ({
8963
iconAs={EditIcon}
9064
onClick={handleTitleEdit}
9165
/>
92-
{!isUnitPageNewDesignEnabled() && (
93-
<>
94-
<IconButton
95-
alt={intl.formatMessage(messages.altButtonSettings)}
96-
className="flex-shrink-0"
97-
iconAs={SettingsIcon}
98-
onClick={openConfigureModal}
99-
/>
100-
<ConfigureModal
101-
isOpen={isConfigureModalOpen}
102-
onClose={closeConfigureModal}
103-
onConfigureSubmit={onConfigureSubmit}
104-
currentItemData={currentItemData}
105-
isSelfPaced={false}
106-
isXBlockComponent={isXBlockComponent}
107-
/>
108-
</>
109-
)}
11066
</div>
11167
);
11268
};

0 commit comments

Comments
 (0)