Skip to content

Commit 3eb0e9e

Browse files
jiachen247remo5000
authored andcommitted
Add question number to ControlBar (#366)
* added assessment status ("Question 1 of 1") to control bar in workspace. jiachen * added assessment status ("Question 1 of 1") to control bar in workspace. jiachen * updated snapshots
1 parent a9c88e5 commit 3eb0e9e

File tree

6 files changed

+77
-55
lines changed

6 files changed

+77
-55
lines changed

src/components/Playground.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ class Playground extends React.Component<IPlaygroundProps, PlaygroundState> {
8080
public render() {
8181
const workspaceProps: WorkspaceProps = {
8282
controlBarProps: {
83+
hasAssessment: false,
84+
currentQuestion: 0,
85+
assessmentLength: 0,
8386
externalLibraryName: this.props.externalLibraryName,
8487
handleChapterSelect: ({ chapter }: { chapter: number }, e: any) =>
8588
this.props.handleChapterSelect(chapter),
@@ -91,9 +94,6 @@ class Playground extends React.Component<IPlaygroundProps, PlaygroundState> {
9194
handleReplEval: this.props.handleReplEval,
9295
handleReplOutputClear: this.props.handleReplOutputClear,
9396
hasChapterSelect: true,
94-
hasNextButton: false,
95-
hasPreviousButton: false,
96-
hasReturnButton: false,
9797
hasSaveButton: false,
9898
hasShareButton: true,
9999
isRunning: this.props.isRunning,

src/components/academy/grading/GradingWorkspace.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,15 @@ class GradingWorkspace extends React.Component<GradingWorkspaceProps> {
213213
const listingPath = `/academy/grading`
214214
const gradingWorkspacePath = listingPath + `/${this.props.submissionId}`
215215
return {
216+
hasAssessment: true,
217+
currentQuestion: questionId + 1,
218+
assessmentLength: this.props.grading!.length,
216219
handleChapterSelect: this.props.handleChapterSelect,
217220
handleEditorEval: this.props.handleEditorEval,
218221
handleInterruptEval: this.props.handleInterruptEval,
219222
handleReplEval: this.props.handleReplEval,
220223
handleReplOutputClear: this.props.handleReplOutputClear,
221224
hasChapterSelect: false,
222-
hasNextButton: questionId < this.props.grading!.length - 1,
223-
hasPreviousButton: questionId > 0,
224-
hasReturnButton: questionId === this.props.grading!.length - 1,
225225
hasSaveButton: false,
226226
hasShareButton: false,
227227
isRunning: this.props.isRunning,

src/components/assessment/AssessmentWorkspace.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,16 @@ class AssessmentWorkspace extends React.Component<
253253
const listingPath = `/academy/${assessmentCategoryLink(this.props.assessment!.category)}`
254254
const assessmentWorkspacePath = listingPath + `/${this.props.assessment!.id.toString()}`
255255
return {
256+
hasAssessment: true,
257+
currentQuestion: questionId + 1,
258+
assessmentLength: this.props.assessment!.questions.length,
256259
handleChapterSelect: this.props.handleChapterSelect,
257260
handleEditorEval: this.props.handleEditorEval,
258261
handleInterruptEval: this.props.handleInterruptEval,
259262
handleReplEval: this.props.handleReplEval,
260263
handleReplOutputClear: this.props.handleReplOutputClear,
261264
handleReplValueChange: this.props.handleReplValueChange,
262265
hasChapterSelect: false,
263-
hasNextButton: questionId < this.props.assessment!.questions.length - 1,
264-
hasPreviousButton: questionId > 0,
265-
hasReturnButton: questionId === this.props.assessment!.questions.length - 1,
266266
hasSaveButton:
267267
!beforeNow(this.props.closeDate) &&
268268
this.props.assessment!.questions[questionId].type !== QuestionTypes.mcq,

0 commit comments

Comments
 (0)