-
-
-
-
-
+
);
}
diff --git a/app/javascript/Components/Result/result_context.js b/app/javascript/Components/Result/result_context.js
new file mode 100644
index 0000000000..aeef8ae890
--- /dev/null
+++ b/app/javascript/Components/Result/result_context.js
@@ -0,0 +1,12 @@
+import React from "react";
+
+// This needs to be in its own file to avoid circular dependency.
+export const ResultContext = React.createContext({
+ assignment_id: null,
+ submission_id: null,
+ result_id: null,
+ grouping_id: null,
+ course_id: null,
+ role: null,
+ is_reviewer: null,
+});
diff --git a/app/javascript/Components/Result/right_pane.jsx b/app/javascript/Components/Result/right_pane.jsx
index 0be3c78200..beaaecbcb3 100644
--- a/app/javascript/Components/Result/right_pane.jsx
+++ b/app/javascript/Components/Result/right_pane.jsx
@@ -4,10 +4,13 @@ import {Tab, Tabs, TabList, TabPanel} from "react-tabs";
import {MarksPanel} from "./marks_panel";
import {SummaryPanel} from "./summary_panel";
import {SubmissionInfoPanel} from "./submission_info_panel";
+import {ResultContext} from "./result_context";
export class RightPane extends React.Component {
+ static contextType = ResultContext;
+
canShowSubmissionInfoPanel = () => {
- return this.props.role !== "Student" && !this.props.is_reviewer;
+ return this.context.role !== "Student" && !this.context.is_reviewer;
};
render() {
@@ -29,7 +32,6 @@ export class RightPane extends React.Component {
destroyMark={this.props.destroyMark}
revertToAutomaticDeductions={this.props.revertToAutomaticDeductions}
findDeductiveAnnotation={this.props.findDeductiveAnnotation}
- course_id={this.props.course_id}
/>
@@ -38,7 +40,6 @@ export class RightPane extends React.Component {
marks={this.props.marks}
released_to_students={this.props.released_to_students}
remark_submitted={this.props.remark_submitted}
- is_reviewer={this.props.is_reviewer}
assignment_max_mark={this.props.assignment_max_mark}
old_total={this.props.old_total}
total={this.props.total}
@@ -50,7 +51,6 @@ export class RightPane extends React.Component {
deleteGraceTokenDeduction={this.props.deleteGraceTokenDeduction}
createExtraMark={this.props.createExtraMark}
destroyExtraMark={this.props.destroyExtraMark}
- course_id={this.props.course_id}
/>
{this.canShowSubmissionInfoPanel() && (
@@ -66,11 +66,7 @@ export class RightPane extends React.Component {
addTag={this.props.addTag}
removeTag={this.props.removeTag}
newNote={this.props.newNote}
- role={this.props.role}
- assignment_id={this.props.assignment_id}
- grouping_id={this.props.grouping_id}
members={this.props.members}
- course_id={this.props.course_id}
/>
)}
diff --git a/app/javascript/Components/Result/submission_file_panel.jsx b/app/javascript/Components/Result/submission_file_panel.jsx
index f53a63e940..4b12b4333d 100644
--- a/app/javascript/Components/Result/submission_file_panel.jsx
+++ b/app/javascript/Components/Result/submission_file_panel.jsx
@@ -206,7 +206,6 @@ export class SubmissionFilePanel extends React.Component {
fileData={this.props.fileData}
onSelectFile={this.selectFile}
selectedFile={this.state.selectedFile}
- course_id={this.props.course_id}
/>
{this.props.canDownload && (
@@ -216,7 +215,6 @@ export class SubmissionFilePanel extends React.Component {
categories={this.props.annotation_categories}
newAnnotation={this.props.newAnnotation}
addExistingAnnotation={this.props.addExistingAnnotation}
- course_id={this.props.course_id}
/>
)}
diff --git a/app/javascript/Components/Result/submission_info_panel.jsx b/app/javascript/Components/Result/submission_info_panel.jsx
index 79debd08c0..d5a179de15 100644
--- a/app/javascript/Components/Result/submission_info_panel.jsx
+++ b/app/javascript/Components/Result/submission_info_panel.jsx
@@ -1,6 +1,9 @@
import React from "react";
+import {ResultContext} from "./result_context";
export class SubmissionInfoPanel extends React.Component {
+ static contextType = ResultContext;
+
static defaultProps = {
availableTags: [],
currentTags: [],
@@ -51,7 +54,7 @@ export class SubmissionInfoPanel extends React.Component {