feat: pass unitId as a prop through to Xpert component (#1256)

This commit modifies the Course component to pass the unitId prop, which presents the unit usage key in which the Xpert is being rendered, to the Chat component. The Chat component passes this unit ID as a prop to the Xpert component.
This commit is contained in:
Michael Roytman
2024-01-05 09:08:55 -05:00
committed by GitHub
parent 600f5b4dff
commit 4dc4725ba1
4 changed files with 9 additions and 6 deletions

8
package-lock.json generated
View File

@@ -19,7 +19,7 @@
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
"@edx/frontend-component-footer": "12.2.1",
"@edx/frontend-component-header": "4.6.0",
"@edx/frontend-lib-learning-assistant": "^1.18.0",
"@edx/frontend-lib-learning-assistant": "^1.19.0",
"@edx/frontend-lib-special-exams": "2.26.0",
"@edx/frontend-platform": "5.5.2",
"@edx/paragon": "20.46.0",
@@ -3460,9 +3460,9 @@
}
},
"node_modules/@edx/frontend-lib-learning-assistant": {
"version": "1.18.0",
"resolved": "https://registry.npmjs.org/@edx/frontend-lib-learning-assistant/-/frontend-lib-learning-assistant-1.18.0.tgz",
"integrity": "sha512-XLcj70YEij+JnvTJjuJd8eyxVI9gOY0q76tRBE+leldsnjKAWi6NknEjLJTI8ncwIwGLDVF7yTUk45Yec6rOlA==",
"version": "1.19.0",
"resolved": "https://registry.npmjs.org/@edx/frontend-lib-learning-assistant/-/frontend-lib-learning-assistant-1.19.0.tgz",
"integrity": "sha512-wBdeQladtvXmS3RA/LOXVNpmEwtG5zAYtu7E7Dh9N8sN2p12ptWCEEdPa92ViK6d5bmqo2NA9ZhnZeEmqs+oRg==",
"dependencies": {
"@edx/brand": "npm:@edx/brand-openedx@1.2.0",
"@fortawesome/fontawesome-svg-core": "1.2.36",

View File

@@ -32,8 +32,8 @@
"@edx/brand": "npm:@openedx/brand-openedx@^1.2.2",
"@edx/frontend-component-footer": "12.2.1",
"@edx/frontend-component-header": "4.6.0",
"@edx/frontend-lib-learning-assistant": "^1.18.0",
"@edx/frontend-lib-special-exams": "2.26.0",
"@edx/frontend-lib-learning-assistant": "^1.19.0",
"@edx/frontend-platform": "5.5.2",
"@edx/paragon": "20.46.0",
"@edx/react-unit-test-utils": "npm:@edx/react-unit-test-utils@1.7.0",

View File

@@ -85,6 +85,7 @@ const Course = ({
isStaff={isStaff}
courseId={courseId}
contentToolsEnabled={course.showCalculator || course.notes.enabled}
unitId={unitId}
/>
<SidebarTriggers />
</>

View File

@@ -10,6 +10,7 @@ const Chat = ({
isStaff,
courseId,
contentToolsEnabled,
unitId,
}) => {
const VERIFIED_MODES = [
'professional',
@@ -44,7 +45,7 @@ const Chat = ({
<>
{/* Use a portal to ensure that component overlay does not compete with learning MFE styles. */}
{shouldDisplayChat && (createPortal(
<Xpert courseId={courseId} contentToolsEnabled={contentToolsEnabled} />,
<Xpert courseId={courseId} contentToolsEnabled={contentToolsEnabled} unitId={unitId} />,
document.body,
))}
</>
@@ -57,6 +58,7 @@ Chat.propTypes = {
enrollmentMode: PropTypes.string,
courseId: PropTypes.string.isRequired,
contentToolsEnabled: PropTypes.bool.isRequired,
unitId: PropTypes.string.isRequired,
};
Chat.defaultProps = {