Skip to content

Commit

Permalink
fixup!: combine the grades slots into a single one
Browse files Browse the repository at this point in the history
  • Loading branch information
xitij2000 committed Oct 23, 2024
1 parent 44f86aa commit ace68ba
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 94 deletions.
14 changes: 3 additions & 11 deletions src/course-home/progress-tab/ProgressTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import ProgressHeader from './ProgressHeader';

import ProgressTabCertificateStatusSlot from '../../plugin-slots/ProgressTabCertificateStatusSlot';
import ProgressTabCourseGradeSlot from '../../plugin-slots/ProgressTabCourseGradeSlot';
import ProgressTabDetailedGradesSlot from '../../plugin-slots/ProgressTabDetailedGradesSlot';
import ProgressTabGradeSummarySlot from '../../plugin-slots/ProgressTabGradeSummarySlot';
import ProgressTabGradeBreakdownSlot from '../../plugin-slots/ProgressTabGradeBreakdownSlot';
import ProgressTabRelatedLinksSlot from '../../plugin-slots/ProgressTabRelatedLinksSlot';
import { useModel } from '../../generic/model-store';

Expand All @@ -17,11 +16,7 @@ const ProgressTab = () => {
courseId,
} = useSelector(state => state.courseHome);

const {
gradesFeatureIsFullyLocked, disableProgressGraph,
} = useModel('progress', courseId);

const applyLockedOverlay = gradesFeatureIsFullyLocked ? 'locked-overlay' : '';
const { disableProgressGraph } = useModel('progress', courseId);

const windowWidth = useWindowSize().width;
if (windowWidth === undefined) {
Expand All @@ -41,10 +36,7 @@ const ProgressTab = () => {
{!disableProgressGraph && <CourseCompletion />}
{!wideScreen && <ProgressTabCertificateStatusSlot courseId={courseId} />}
<ProgressTabCourseGradeSlot courseId={courseId} />
<div className={`grades my-4 p-4 rounded raised-card ${applyLockedOverlay}`} aria-hidden={gradesFeatureIsFullyLocked}>
<ProgressTabGradeSummarySlot courseId={courseId} />
<ProgressTabDetailedGradesSlot courseId={courseId} />
</div>
<ProgressTabGradeBreakdownSlot courseId={courseId} />
</div>

{/* Side panel */}
Expand Down
43 changes: 0 additions & 43 deletions src/plugin-slots/ProgressTabDetailedGradesSlot/README.md

This file was deleted.

20 changes: 0 additions & 20 deletions src/plugin-slots/ProgressTabDetailedGradesSlot/index.jsx

This file was deleted.

33 changes: 33 additions & 0 deletions src/plugin-slots/ProgressTabGradeBreakdownSlot/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { useModel } from '@src/generic/model-store';
import PropTypes from 'prop-types';
import { PluginSlot } from '@openedx/frontend-plugin-framework';
import React from 'react';
import DetailedGrades from '../../course-home/progress-tab/grades/detailed-grades/DetailedGrades';
import GradeSummary from '../../course-home/progress-tab/grades/grade-summary/GradeSummary';

const ProgressTabGradeBreakdownSlot = ({ courseId }) => {
const { gradesFeatureIsFullyLocked } = useModel('progress', courseId);
const applyLockedOverlay = gradesFeatureIsFullyLocked ? 'locked-overlay' : '';
return (
<PluginSlot
id="progress_tab_grade_breakdown_slot"
pluginProps={{
courseId,
}}
>
<div
className={`grades my-4 p-4 rounded raised-card ${applyLockedOverlay}`}
aria-hidden={gradesFeatureIsFullyLocked}
>
<GradeSummary />
<DetailedGrades />
</div>
</PluginSlot>
);
};

ProgressTabGradeBreakdownSlot.propTypes = {
courseId: PropTypes.string.isRequired,
};

export default ProgressTabGradeBreakdownSlot;
20 changes: 0 additions & 20 deletions src/plugin-slots/ProgressTabGradeSummarySlot/index.jsx

This file was deleted.

0 comments on commit ace68ba

Please sign in to comment.