Skip to content

Commit 04ca87e

Browse files
authored
Revert "feat: standardize slot ids (openedx#1685)"
This reverts commit 045e108.
1 parent d3d89a2 commit 04ca87e

File tree

60 files changed

+124
-369
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+124
-369
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"@fortawesome/free-solid-svg-icons": "5.15.4",
4747
"@fortawesome/react-fontawesome": "^0.1.4",
4848
"@openedx/frontend-build": "^14.5.0",
49-
"@openedx/frontend-plugin-framework": "^1.7.0",
49+
"@openedx/frontend-plugin-framework": "^1.6.0",
5050
"@openedx/frontend-slot-footer": "^1.0.2",
5151
"@openedx/paragon": "^22.16.0",
5252
"@popperjs/core": "2.11.8",

src/course-home/outline-tab/OutlineTab.jsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { sendTrackEvent } from '@edx/frontend-platform/analytics';
55
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
66
import { useIntl } from '@edx/frontend-platform/i18n';
77
import { Button } from '@openedx/paragon';
8-
import { CourseOutlineTabNotificationsSlot } from '../../plugin-slots/CourseOutlineTabNotificationsSlot';
8+
import { PluginSlot } from '@openedx/frontend-plugin-framework';
99
import { AlertList } from '../../generic/user-messages';
1010

1111
import CourseDates from './widgets/CourseDates';
@@ -181,7 +181,13 @@ const OutlineTab = () => {
181181
/>
182182
)}
183183
<CourseTools />
184-
<CourseOutlineTabNotificationsSlot courseId={courseId} />
184+
<PluginSlot
185+
id="outline_tab_notifications_slot"
186+
pluginProps={{
187+
courseId,
188+
model: 'outline',
189+
}}
190+
/>
185191
<CourseDates />
186192
<CourseHandouts />
187193
</div>

src/course-home/outline-tab/OutlineTab.test.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ describe('Outline Tab', () => {
139139
});
140140
await fetchAndRender();
141141

142-
expect(screen.getByTestId('org.openedx.frontend.learning.course_outline_tab_notifications.v1')).toBeInTheDocument();
142+
expect(screen.getByTestId('outline_tab_notifications_slot')).toBeInTheDocument();
143143
});
144144

145145
it('handles expand/collapse all button click', async () => {

src/courseware/course/new-sidebar/sidebars/discussions-notifications/notifications/NotificationsWidget.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ describe('NotificationsWidget', () => {
9090
<NotificationsWidget />
9191
</SidebarContext.Provider>,
9292
);
93-
expect(screen.getByTestId('org.openedx.frontend.learning.notification_widget.v1')).toBeInTheDocument();
93+
expect(screen.getByTestId('notification_widget_slot')).toBeInTheDocument();
9494
});
9595

9696
it('renders no notifications bar if no verified mode', async () => {

src/courseware/course/new-sidebar/sidebars/discussions-notifications/notifications/NotificationsWidget.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React, { useContext, useEffect, useMemo } from 'react';
22

33
import { sendTrackEvent } from '@edx/frontend-platform/analytics';
4+
import { PluginSlot } from '@openedx/frontend-plugin-framework';
45
import { useModel } from '../../../../../../generic/model-store';
56
import { WIDGETS } from '../../../../../../constants';
67
import SidebarContext from '../../../SidebarContext';
7-
import { NotificationWidgetSlot } from '../../../../../../plugin-slots/NotificationWidgetSlot';
88

99
const NotificationsWidget = () => {
1010
const {
@@ -67,11 +67,15 @@ const NotificationsWidget = () => {
6767

6868
return (
6969
<div className="border border-light-400 rounded-sm" data-testid="notification-widget">
70-
<NotificationWidgetSlot
71-
courseId={courseId}
72-
notificationCurrentState={upgradeNotificationCurrentState}
73-
setNotificationCurrentState={setUpgradeNotificationCurrentState}
74-
toggleSidebar={onToggleSidebar}
70+
<PluginSlot
71+
id="notification_widget_slot"
72+
pluginProps={{
73+
courseId,
74+
model: 'coursewareMeta',
75+
notificationCurrentState: upgradeNotificationCurrentState,
76+
setNotificationCurrentState: setUpgradeNotificationCurrentState,
77+
toggleSidebar: onToggleSidebar,
78+
}}
7579
/>
7680
</div>
7781
);

src/courseware/course/sequence/Unit/ContentIFrame.jsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import React from 'react';
44
import { ErrorPage } from '@edx/frontend-platform/react';
55
import { StrictDict } from '@edx/react-unit-test-utils';
66
import { ModalDialog, Modal } from '@openedx/paragon';
7-
import { ContentIFrameLoaderSlot } from '../../../../plugin-slots/ContentIFrameLoaderSlot';
7+
import { PluginSlot } from '@openedx/frontend-plugin-framework';
88

9+
import PageLoading from '@src/generic/PageLoading';
910
import * as hooks from './hooks';
1011

1112
/**
@@ -83,7 +84,17 @@ const ContentIFrame = ({
8384
return (
8485
<>
8586
{(shouldShowContent && !hasLoaded) && (
86-
showError ? <ErrorPage /> : <ContentIFrameLoaderSlot courseId={courseId} loadingMessage={loadingMessage} />
87+
showError ? <ErrorPage /> : (
88+
<PluginSlot
89+
id="content_iframe_loader_slot"
90+
pluginProps={{
91+
defaultLoaderComponent: <PageLoading srMessage={loadingMessage} />,
92+
courseId,
93+
}}
94+
>
95+
<PageLoading srMessage={loadingMessage} />
96+
</PluginSlot>
97+
)
8798
)}
8899
{shouldShowContent && (
89100
<div className="unit-iframe-wrapper">

src/courseware/course/sequence/Unit/ContentIFrame.test.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { shallow } from '@edx/react-unit-test-utils';
66

77
import PageLoading from '@src/generic/PageLoading';
88

9-
import { ContentIFrameLoaderSlot } from '@src/plugin-slots/ContentIFrameLoaderSlot';
109
import * as hooks from './hooks';
1110
import ContentIFrame, { IFRAME_FEATURE_POLICY, testIDs } from './ContentIFrame';
1211

@@ -100,8 +99,8 @@ describe('ContentIFrame Component', () => {
10099
});
101100
it('displays PageLoading component if not showError', () => {
102101
el = shallow(<ContentIFrame {...props} />);
103-
[component] = el.instance.findByType(ContentIFrameLoaderSlot);
104-
expect(component.props.loadingMessage).toEqual(props.loadingMessage);
102+
[component] = el.instance.findByType(PageLoading);
103+
expect(component.props.srMessage).toEqual(props.loadingMessage);
105104
});
106105
});
107106
describe('hasLoaded', () => {

src/courseware/course/sequence/Unit/UnitSuspense.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ import React, { Suspense } from 'react';
22
import PropTypes from 'prop-types';
33

44
import { useIntl } from '@edx/frontend-platform/i18n';
5+
import { PluginSlot } from '@openedx/frontend-plugin-framework';
56

67
import { useModel } from '@src/generic/model-store';
78
import PageLoading from '@src/generic/PageLoading';
8-
import { GatedUnitContentMessageSlot } from '../../../../plugin-slots/GatedUnitContentMessageSlot';
99

1010
import messages from '../messages';
1111
import HonorCode from '../honor-code';
12+
import LockPaywall from '../lock-paywall';
1213
import * as hooks from './hooks';
1314
import { modelKeys } from './constants';
1415

@@ -28,7 +29,14 @@ const UnitSuspense = ({
2829
<>
2930
{shouldDisplayContentGating && (
3031
<Suspense fallback={<PageLoading srMessage={formatMessage(messages.loadingLockedContent)} />}>
31-
<GatedUnitContentMessageSlot courseId={courseId} />
32+
<PluginSlot
33+
id="gated_unit_content_message_slot"
34+
pluginProps={{
35+
courseId,
36+
}}
37+
>
38+
<LockPaywall courseId={courseId} />
39+
</PluginSlot>
3240
</Suspense>
3341
)}
3442
{shouldDisplayHonorCode && (

src/courseware/course/sequence/Unit/UnitSuspense.test.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { formatMessage, shallow } from '@edx/react-unit-test-utils';
55
import { useModel } from '@src/generic/model-store';
66
import PageLoading from '@src/generic/PageLoading';
77

8-
import { GatedUnitContentMessageSlot } from '@src/plugin-slots/GatedUnitContentMessageSlot';
98
import messages from '../messages';
109
import HonorCode from '../honor-code';
1110
import LockPaywall from '../lock-paywall';
@@ -79,9 +78,10 @@ describe('UnitSuspense component', () => {
7978
beforeEach(() => { mockModels(true, true); });
8079
it('displays LockPaywall in Suspense wrapper with PageLoading fallback', () => {
8180
el = shallow(<UnitSuspense {...props} />);
82-
const [component] = el.instance.findByType(GatedUnitContentMessageSlot);
83-
expect(component.parent.type).toEqual('Suspense');
84-
expect(component.parent.props.fallback)
81+
const [component] = el.instance.findByType(LockPaywall);
82+
expect(component.parent.type).toEqual('PluginSlot');
83+
expect(component.parent.parent.type).toEqual('Suspense');
84+
expect(component.parent.parent.props.fallback)
8585
.toEqual(<PageLoading srMessage={formatMessage(messages.loadingLockedContent)} />);
8686
expect(component.props.courseId).toEqual(props.courseId);
8787
});

0 commit comments

Comments
 (0)