Skip to content

Commit

Permalink
use overallFeedback
Browse files Browse the repository at this point in the history
  • Loading branch information
henriettemoe committed May 4, 2023
1 parent c2e5fb7 commit fb16a42
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/components/ScorePage/ScorePage.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
import { H5P } from 'h5p-utils';
import React, { FC } from 'react';
import { ScoreBar } from "../ScoreBar/ScoreBar";

type ScorePageProps = {
score: number;
maxScore: number;
overallFeedbacks: {}[] | undefined;
onRestart: () => void;
};

export const ScorePage: FC<ScorePageProps> = ({
score,
maxScore,
overallFeedbacks,
onRestart,
}) => {
// TODO: fix label, helpText, and scoreExplanation
// TODO: translate 'Restart'
const overallFeedback = (H5P as any).Question.determineOverallFeedback(overallFeedbacks, score / maxScore) ?? 'Your score is';
return (
<div className="h5p-vocabulary-drill-score-page">
<h2>Great job!</h2>
<h2>{overallFeedback}</h2>
<ScoreBar
maxScore={maxScore}
score={score}
label=''
helpText=''
scoreExplanation='' />
scoreExplanation=''
/>
<button
type="button"
className="h5p-joubelui-button h5p-vocabulary-drill-restart"
Expand Down
3 changes: 2 additions & 1 deletion src/components/VocabularyDrill/VocabularyDrill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const VocabularyDrill: FC<VocabularyDrillProps> = ({
onTrigger,
onPageChange,
}) => {
const { behaviour, sourceLanguage, targetLanguage } = params;
const { behaviour, sourceLanguage, targetLanguage, overallFeedback } = params;

const {
answerMode,
Expand Down Expand Up @@ -413,6 +413,7 @@ export const VocabularyDrill: FC<VocabularyDrillProps> = ({
<ScorePage
score={score}
maxScore={maxScore}
overallFeedbacks={overallFeedback}
onRestart={handleRestart}
/>
)}
Expand Down

0 comments on commit fb16a42

Please sign in to comment.