Skip to content

Commit 01365d0

Browse files
authored
feat: replace StudioFooter with StudioFooterSlot (#1729)
1 parent e00a4c4 commit 01365d0

File tree

14 files changed

+86
-16
lines changed

14 files changed

+86
-16
lines changed

package-lock.json

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"@openedx-plugins/course-app-wiki": "file:plugins/course-apps/wiki",
6161
"@openedx-plugins/course-app-xpert_unit_summary": "file:plugins/course-apps/xpert_unit_summary",
6262
"@openedx/frontend-build": "^14.3.3",
63+
"@openedx/frontend-slot-footer": "^1.2.0",
6364
"@openedx/frontend-plugin-framework": "^1.6.0",
6465
"@openedx/paragon": "^22.16.0",
6566
"@redux-devtools/extension": "^3.3.0",

src/CourseAuthoringPage.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useDispatch, useSelector } from 'react-redux';
55
import {
66
useLocation,
77
} from 'react-router-dom';
8-
import { StudioFooter } from '@edx/frontend-component-footer';
8+
import { StudioFooterSlot } from '@openedx/frontend-slot-footer';
99
import Header from './header';
1010
import { fetchCourseDetail, fetchWaffleFlags } from './data/thunks';
1111
import { useModel } from './generic/model-store';
@@ -66,7 +66,7 @@ const CourseAuthoringPage = ({ courseId, children }) => {
6666
)
6767
)}
6868
{children}
69-
{!inProgress && !isEditor && <StudioFooter />}
69+
{!inProgress && !isEditor && <StudioFooterSlot />}
7070
</div>
7171
);
7272
};

src/accessibility-page/AccessibilityPage.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
33
import { Helmet } from 'react-helmet';
44
import { Container } from '@openedx/paragon';
5-
import { StudioFooter } from '@edx/frontend-component-footer';
5+
import { StudioFooterSlot } from '@openedx/frontend-slot-footer';
66

77
import Header from '../header';
88
import messages from './messages';
@@ -29,7 +29,7 @@ const AccessibilityPage = ({
2929
<AccessibilityBody {...{ email, communityAccessibilityLink }} />
3030
<AccessibilityForm accessibilityEmail={email} />
3131
</Container>
32-
<StudioFooter />
32+
<StudioFooterSlot />
3333
</>
3434
);
3535
};

src/course-rerun/index.jsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import {
77
ActionRow,
88
Button,
99
} from '@openedx/paragon';
10-
import { StudioFooter } from '@edx/frontend-component-footer';
10+
import { StudioFooterSlot } from '@openedx/frontend-slot-footer';
11+
1112
import { useNavigate, useParams } from 'react-router-dom';
1213

1314
import Header from '../header';
@@ -88,7 +89,7 @@ const CourseRerun = () => {
8889
isQueryPending={savingStatus === RequestStatus.PENDING}
8990
/>
9091
</div>
91-
<StudioFooter />
92+
<StudioFooterSlot />
9293
</>
9394
);
9495
};

src/library-authoring/LibraryAuthoringPage.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useCallback, useEffect, useState } from 'react';
22
import { Helmet } from 'react-helmet';
33
import classNames from 'classnames';
4-
import { StudioFooter } from '@edx/frontend-component-footer';
4+
import { StudioFooterSlot } from '@openedx/frontend-slot-footer';
55
import { useIntl } from '@edx/frontend-platform/i18n';
66
import {
77
ActionRow,
@@ -286,7 +286,7 @@ const LibraryAuthoringPage = ({ returnToLibrarySelection }: LibraryAuthoringPage
286286
<LibraryContent contentType={activeKey} />
287287
</SearchContextProvider>
288288
</Container>
289-
{!componentPickerMode && <StudioFooter containerProps={{ size: undefined }} />}
289+
{!componentPickerMode && <StudioFooterSlot containerProps={{ size: undefined }} />}
290290
</div>
291291
{!!sidebarComponentInfo?.type && (
292292
<div className="library-authoring-sidebar box-shadow-left-1 bg-white" data-testid="library-sidebar">

src/library-authoring/collections/LibraryCollectionPage.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useEffect } from 'react';
2-
import { StudioFooter } from '@edx/frontend-component-footer';
2+
import { StudioFooterSlot } from '@openedx/frontend-slot-footer';
33
import { useIntl } from '@edx/frontend-platform/i18n';
44
import {
55
ActionRow,
@@ -220,7 +220,7 @@ const LibraryCollectionPage = () => {
220220
<LibraryCollectionComponents />
221221
</SearchContextProvider>
222222
</Container>
223-
{!componentPickerMode && <StudioFooter containerProps={{ size: undefined }} />}
223+
{!componentPickerMode && <StudioFooterSlot containerProps={{ size: undefined }} />}
224224
</div>
225225
{!!sidebarComponentInfo?.type && (
226226
<div className="library-authoring-sidebar box-shadow-left-1 bg-white" data-testid="library-sidebar">

src/library-authoring/create-library/CreateLibrary.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { StudioFooter } from '@edx/frontend-component-footer';
1+
import { StudioFooterSlot } from '@openedx/frontend-slot-footer';
22
import { useIntl } from '@edx/frontend-platform/i18n';
33
import {
44
Container,
@@ -162,7 +162,7 @@ const CreateLibrary = () => {
162162
</Formik>
163163
{isError && (<AlertError error={error} />)}
164164
</Container>
165-
<StudioFooter />
165+
<StudioFooterSlot />
166166
</>
167167
);
168168
};

src/plugin-slots/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@
99
## Course Unit page
1010

1111
* [`course_unit_header_actions_slot`](./CourseUnitHeaderActionsSlot/)
12+
13+
## Footer Slot
14+
* [`studio_footer_slot`](./StudioFooterSlot/)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Studio Footer Slot
2+
3+
### Slot ID: `studio_footer_slot`
4+
5+
## Description
6+
7+
This slot is used to replace/modify/hide the footer.
8+
9+
The implementation of the `StudioFooterSlot` component lives in [the `frontend-slot-footer` repository](https://github.com/openedx/frontend-slot-footer/).
10+
11+
## Example
12+
13+
The following `env.config.jsx` will replace the default footer.
14+
15+
![Screenshot of Default Studio Footer](./images/default_studio_footer.png)
16+
17+
with a simple custom footer
18+
19+
![Screenshot of Custom Footer](./images/custom_footer.png)
20+
21+
```jsx
22+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
23+
24+
const config = {
25+
pluginSlots: {
26+
studio_footer_slot: {
27+
plugins: [
28+
{
29+
// Hide the default footer
30+
op: PLUGIN_OPERATIONS.Hide,
31+
widgetId: 'default_contents',
32+
},
33+
{
34+
// Insert a custom footer
35+
op: PLUGIN_OPERATIONS.Insert,
36+
widget: {
37+
id: 'custom_footer',
38+
type: DIRECT_PLUGIN,
39+
RenderWidget: () => (
40+
<h1 style={{textAlign: 'center'}}>🦶</h1>
41+
),
42+
},
43+
},
44+
]
45+
}
46+
},
47+
}
48+
49+
export default config;
50+
```
Loading
Loading

src/studio-home/StudioHome.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from '@openedx/paragon';
1010
import { Add as AddIcon, Error } from '@openedx/paragon/icons';
1111
import { useIntl } from '@edx/frontend-platform/i18n';
12-
import { StudioFooter } from '@edx/frontend-component-footer';
12+
import { StudioFooterSlot } from '@openedx/frontend-slot-footer';
1313
import { getConfig } from '@edx/frontend-platform';
1414
import { useLocation, useNavigate } from 'react-router-dom';
1515

@@ -188,7 +188,7 @@ const StudioHome = () => {
188188
isQueryPending={anyQueryIsPending}
189189
/>
190190
</div>
191-
<StudioFooter />
191+
<StudioFooterSlot />
192192
</>
193193
);
194194
};

src/taxonomy/TaxonomyLayout.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useMemo, useState } from 'react';
2-
import { StudioFooter } from '@edx/frontend-component-footer';
2+
import { StudioFooterSlot } from '@openedx/frontend-slot-footer';
33
import { Outlet, ScrollRestoration } from 'react-router-dom';
44
import { Toast } from '@openedx/paragon';
55

@@ -28,7 +28,7 @@ export const TaxonomyLayout = () => {
2828
/>
2929
)}
3030
<Outlet />
31-
<StudioFooter />
31+
<StudioFooterSlot />
3232
{toastMessage && (
3333
<Toast
3434
show

0 commit comments

Comments
 (0)