Skip to content

Commit

Permalink
docs: Updated documentation on the IDV Page Plugin Slot
Browse files Browse the repository at this point in the history
  • Loading branch information
rijuma committed Aug 16, 2024
1 parent d7a5b22 commit dcdd024
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ import { Route, Routes, Outlet } from 'react-router-dom';

import Header from '@edx/frontend-component-header';
import FooterSlot from '@openedx/frontend-slot-footer';
import { PluginSlot } from '@openedx/frontend-plugin-framework';

import configureStore from './data/configureStore';
import AccountSettingsPage, { NotFoundPage } from './account-settings';
import IdVerificationPage from './id-verification';
import IdVerificationPageSlot from './plugin-slots/IdVerificationPageSlot';
import messages from './i18n';

import './index.scss';
Expand All @@ -43,11 +42,7 @@ subscribe(APP_READY, () => {
<Route path="/notifications" element={<NotificationCourses />} />
<Route
path="/id-verification/*"
element={(
<PluginSlot id="id_verification_page_plugin">
<IdVerificationPage />
</PluginSlot>
)}
element={<IdVerificationPageSlot />}
/>
<Route path="/" element={<AccountSettingsPage />} />
<Route path="/notfound" element={<NotFoundPage />} />
Expand Down
45 changes: 45 additions & 0 deletions src/plugin-slots/IdVerificationPageSlot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Footer Slot

### Slot ID: `id_verification_page_plugin`

## Description

This slot is used to replace/modify the IDV Page.

The implementation of the `IdVerificationPageSlot` component lives in `src/plugin-slots/IdVerificationPageSlot/index.jsx`.

## Example

The following `env.config.jsx` will replace the default IDV Page.

![Screenshot of Default IDV Page](./images/default_id-verification-page.png)

```jsx
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';

const config = {
pluginSlots: {
id_verification_page_plugin: {
plugins: [
{
// Insert a custom IDV Page
op: PLUGIN_OPERATIONS.Insert,
widget: {
id: 'id_verification_page_plugin',
type: DIRECT_PLUGIN,
RenderWidget: () => (
<div>
<p>This is the new IDV page</p>
<a href="/">Go Home</a>
</div>
),
},
},
],
},
},
};

export default config;

```
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/plugin-slots/IdVerificationPageSlot/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { PluginSlot } from '@openedx/frontend-plugin-framework';
import IdVerificationPage from '../../id-verification';

const IdVerificationPageSlot = () => (
<PluginSlot id="id_verification_page_plugin">

Check warning on line 5 in src/plugin-slots/IdVerificationPageSlot/index.jsx

View check run for this annotation

Codecov / codecov/patch

src/plugin-slots/IdVerificationPageSlot/index.jsx#L4-L5

Added lines #L4 - L5 were not covered by tests
<IdVerificationPage />
</PluginSlot>
);

export default IdVerificationPageSlot;
1 change: 1 addition & 0 deletions src/plugin-slots/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# `frontend-app-account` Plugin Slots

* [`footer_slot`](./FooterSlot/)
* [`id_verification_page_plugin`](./IdVerificationPageSlot/)

0 comments on commit dcdd024

Please sign in to comment.