-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: multiple pages score view (#186)
* feat: add last page and restart button * feat: add ScoreBar and ScorePage * use overallFeedback * refactor: adjust ScorePage * fix: make Statusbar visible on ScorePage * refactor: ScoreBar * chore: add typing for `H5P.JoubelUI` * refactor: group all h5p extensions in one declaration file * refactor: use `reference` to import JoubelUI types * refactor: include h5p-extensions.d.ts in tsconfig * fix: add translations * refactor: use JoubelProgressbar * fix: re-add margin-top * chore: update `h5p-types-joubel-ui` * chore: update `h5p-types-joubel-ui` * fix: translation in nn.json * fix: make sure to trim list of words * fix: ensure color contrast on next button * bump patch version --------- Co-authored-by: Sindre Bøyum <[email protected]>
- Loading branch information
1 parent
5799490
commit 129cfbf
Showing
21 changed files
with
409 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
.github | ||
build_info | ||
node_modules | ||
src | ||
.github | ||
.eslintignore | ||
.eslintrc.json | ||
.gitignore | ||
.h5pignore | ||
h5p-extensions.d.ts | ||
jest.config.js | ||
semantics.json.d.ts | ||
library.json.d.ts | ||
build_info | ||
package.json | ||
package-lock.json | ||
package.json | ||
README.md | ||
webpack.config.js | ||
semantics.json.d.ts | ||
tsconfig.json | ||
webpack.config.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
https://github.com/h5p/h5p-blanks.git | ||
https://github.com/h5p/h5p-drag-text.git | ||
https://github.com/h5p/h5p-editor-radio-group.git | ||
https://github.com/h5p/h5p-joubel-ui.git | ||
https://github.com/h5p/h5p-question.git | ||
https://github.com/NDLANO/h5p-editor-csv-to-text.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import 'h5p-types-joubel-ui'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { H5P } from 'h5p-utils'; | ||
import React, { FC, useEffect, useRef } from 'react'; | ||
import { useTranslation } from '../../hooks/useTranslation/useTranslation'; | ||
|
||
type ScoreBarProps = { | ||
maxScore: number, | ||
score: number, | ||
}; | ||
|
||
export const ScoreBar: FC<ScoreBarProps> = ({ | ||
maxScore, | ||
score, | ||
}) => { | ||
const { t } = useTranslation(); | ||
const scoreBarLabel = t('scoreBarLabel').replaceAll('@score', score.toString()).replaceAll('@maxScore', maxScore.toString()); | ||
|
||
const ref = useRef<HTMLDivElement>(null); | ||
|
||
const scoreBar = useRef(H5P.JoubelUI.createScoreBar(maxScore, scoreBarLabel)); | ||
scoreBar.current.setScore(score); | ||
|
||
useEffect(() => { | ||
if (ref.current && !ref.current.firstChild) { | ||
scoreBar.current.appendTo(ref.current); | ||
} | ||
}, [ref.current]); | ||
|
||
return ( | ||
<div ref={ref} /> | ||
); | ||
}; |
Oops, something went wrong.