Skip to content

feat: add Proctoring Info Panel plugin slot #1759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/course-home/outline-tab/OutlineTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import usePrivateCourseAlert from './alerts/private-course-alert';
import useScheduledContentAlert from './alerts/scheduled-content-alert';
import { useModel } from '../../generic/model-store';
import WelcomeMessage from './widgets/WelcomeMessage';
import ProctoringInfoPanel from './widgets/ProctoringInfoPanel';
import { ProctoringInfoPanelSlot } from '../../plugin-slots/ProctoringInfoPanelSlot';
import AccountActivationAlert from '../../alerts/logistration-alert/AccountActivationAlert';
import CourseHomeSectionOutlineSlot from '../../plugin-slots/CourseHomeSectionOutlineSlot';

Expand Down Expand Up @@ -171,7 +171,7 @@ const OutlineTab = () => {
</div>
{rootCourseId && (
<div className="col col-12 col-md-4">
<ProctoringInfoPanel />
<ProctoringInfoPanelSlot proctoringReviewRequirementsButtonLink="https://support.edx.org/hc/en-us/sections/115004169247-Taking-Timed-and-Proctored-Exams" />
{ /** Defer showing the goal widget until the ProctoringInfoPanel has resolved or has been determined as
disabled to avoid components bouncing around too much as screen is rendered */ }
{(!enableProctoredExams || proctoringPanelStatus === 'loaded') && weeklyLearningGoalEnabled && (
Expand Down
9 changes: 7 additions & 2 deletions src/course-home/outline-tab/widgets/ProctoringInfoPanel.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState, useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import camelCase from 'lodash.camelcase';
import PropTypes from 'prop-types';

import { useIntl } from '@edx/frontend-platform/i18n';
import { Button } from '@openedx/paragon';
Expand All @@ -10,7 +11,7 @@ import { getProctoringInfoData } from '../../data/api';
import { fetchProctoringInfoResolved } from '../../data/slice';
import { useModel } from '../../../generic/model-store';

const ProctoringInfoPanel = () => {
const ProctoringInfoPanel = ({ proctoringReviewRequirementsButtonLink }) => {
const intl = useIntl();
const {
courseId,
Expand Down Expand Up @@ -207,7 +208,7 @@ const ProctoringInfoPanel = () => {
{isSubmissionRequired(readableStatus) && (
onboardingExamButton
)}
<Button variant="outline-primary" block href="https://support.edx.org/hc/en-us/sections/115004169247-Taking-Timed-and-Proctored-Exams">
<Button variant="outline-primary" block href={proctoringReviewRequirementsButtonLink}>
{intl.formatMessage(messages.proctoringReviewRequirementsButton)}
</Button>
</div>
Expand All @@ -217,4 +218,8 @@ const ProctoringInfoPanel = () => {
);
};

ProctoringInfoPanel.propTypes = {
proctoringReviewRequirementsButtonLink: PropTypes.string.isRequired,
};

export default ProctoringInfoPanel;
47 changes: 47 additions & 0 deletions src/plugin-slots/ProctoringInfoPanelSlot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Procotoring Info Panel Slot

### Slot ID: `org.openedx.frontend.learning.proctoring_info_panel.v1`

### Slot ID Aliases
* `proctoring_info_panel_slot`

### Props:
* `proctoringReviewRequirementsButtonLink`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great start, thanks! But it would be ideal if you could add:

  1. An example of how to use this slot, including sample env.config.jsx code.
  2. A screenshot of the slot using the above example.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @arbrandes!

The reason I initially left out the screenshots and env.config.jsx example was because I noticed that some of the recently added plugin slots, like ContentIFrameLoaderSlot were missing them in their README as well.

That said, I’ve now added the example screenshots and config code in 36e6ceb


## Description

This slot is used to replace/modify/hide the proctoring info panel.

## Example

### Default content
![Proctoring info panel slot with default content](./screenshot_default.png)

### Replaced with custom component
![Proctoring info panel slot with default content](./screenshot_custom.png)

The following `env.config.jsx` will replace the notifications discussions sidebar.

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

const config = {
pluginSlots: {
'org.openedx.frontend.learning.proctoring_info_panel.v1': {
keepDefault: false,
plugins: [
{
op: PLUGIN_OPERATIONS.Insert,
widget: {
id: 'proctoring_info_panel',
type: DIRECT_PLUGIN,
RenderWidget: () => <h3>Proctoring Info Panel</h3>,
},
},
],
}
},
}

export default config;
```
24 changes: 24 additions & 0 deletions src/plugin-slots/ProctoringInfoPanelSlot/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';

import { PluginSlot } from '@openedx/frontend-plugin-framework';
import ProctoringInfoPanel from '../../course-home/outline-tab/widgets/ProctoringInfoPanel';

export const ProctoringInfoPanelSlot = (
{ proctoringReviewRequirementsButtonLink }:ProctoringInfoPanelSlotProps,
) => (
<PluginSlot
id="org.openedx.frontend.learning.proctoring_info_panel.v1"
idAliases={['proctoring_info_panel_slot']}
slotOptions={{
mergeProps: true,
}}
>
<ProctoringInfoPanel
proctoringReviewRequirementsButtonLink={proctoringReviewRequirementsButtonLink ?? ''}
/>
</PluginSlot>
);

interface ProctoringInfoPanelSlotProps {
proctoringReviewRequirementsButtonLink?: string;
}
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.