Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom view #57

Merged
merged 7 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ yarn-error.log*
/playwright/.cache/

tsconfig.tsbuildinfo

.test-data
48,924 changes: 15,091 additions & 33,833 deletions package-lock.json

Large diffs are not rendered by default.

97 changes: 57 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,73 +15,92 @@
},
"dependencies": {
"@emotion/babel-plugin": "^11.9.2",
"@emotion/css": "^11.10.5",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@fontsource/josefin-sans": "^4.5.11",
"@fontsource/lato": "^4.5.10",
"@fontsource/raleway": "^4.5.11",
"@fontsource/roboto-mono": "^4.5.8",
"@fontsource/space-mono": "^4.5.10",
"@emotion/css": "^11.11.2",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.0",
"@fontsource/josefin-sans": "^5.0.19",
"@fontsource/lato": "^5.0.19",
"@fontsource/raleway": "^5.0.17",
"@fontsource/roboto-mono": "^5.0.17",
"@fontsource/space-mono": "^5.0.19",
"@fortawesome/fontawesome-svg-core": "^6.2.0",
"@fortawesome/free-solid-svg-icons": "^6.2.0",
"@fortawesome/react-fontawesome": "^0.2.0",
"@monaco-editor/react": "^4.4.6",
"@monaco-editor/react": "^4.6.0",
"@mui/icons-material": "^5.10.9",
"@mui/lab": "^5.0.0-alpha.91",
"@mui/material": "^5.10.12",
"@popperjs/core": "^2.11.6",
"@tanstack/react-query": "^4.14.1",
"@popperjs/core": "^2.11.8",
"@react-pdf/renderer": "^3.1.14",
"@tanstack/react-query": "^5.25.0",
"@vectopus/atlas-icons-react": "github:rage/Atlas-icons-react#d310057c60f4f011306c35ae9caf025c5a09e41b",
"axios": "^1.6.7",
"citation-js": "^0.7.9",
"@wordpress/components": "^23.4.0",
"commonmark": "^0.30.0",
"cors": "^2.8.5",
"dataframe-js": "^1.4.4",
"date-fns": "^2.29.3",
"express": "^4.18.2",
"date-fns": "^3.3.1",
"diff": "^5.2.0",
"dompurify": "^3.0.9",
"express": "^4.18.3",
"highlight.js": "^11.9.0",
"http-proxy-middleware": "^2.0.6",
"i18next": "^22.0.4",
"i18next": "23.3.0",
"immer": "^10.0.3",
"katex": "^0.16.9",
"lodash": "^4.17.21",
"matrix-multiplication": "^0.5.2",
"monaco-editor": "^0.34.1",
"next": "^13.0.5",
"monaco-editor": "^0.46.0",
"next": "14.0.3",
"papaparse": "^5.3.2",
"patch-package": "^6.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.39.1",
"react-hot-toast": "^2.4.0",
"react-i18next": "^12.0.0",
"react-hook-form": "^7.51.0",
"react-hot-toast": "^2.4.1",
"react-i18next": "13.2.2",
"react-icons": "^4.4.0",
"react-is": "^18.2.0",
"react-outside-click-handler": "^1.3.0",
"react-medium-image-zoom": "^5.1.10",
"react-popper": "^2.3.0",
"react-select": "^5.4.0",
"react-spring": "^9.5.5",
"svgo": "^3.0.0",
"use-debounce": "^8.0.4",
"react-spring": "^9.7.3",
"react-tsparticles": "^2.12.2",
"svgo": "^3.2.0",
"tsparticles": "^3.3.0",
"use-debounce": "^10.0.0",
"use-memo-one": "^1.1.3",
"usehooks-ts": "^2.9.1",
"uuid": "^9.0.0"
"usehooks-ts": "^2.16.0",
"uuid": "^9.0.1"
},
"devDependencies": {
"@stylelint/postcss-css-in-js": "^0.38.0",
"@svgr/webpack": "^6.5.1",
"@svgr/webpack": "^8.1.0",
"@types/commonmark": "^0.27.5",
"@types/cors": "^2.8.12",
"@types/dataframe-js": "^1.4.0",
"@types/jest": "^29.1.2",
"@types/lodash": "^4.14.187",
"@types/node": "^18.11.9",
"@types/diff": "^5.0.9",
"@types/dompurify": "^3.0.5",
"@types/highlightjs": "^9.12.6",
"@types/jest": "^29.5.12",
"@types/lodash": "^4.14.202",
"@types/node": "^20.11.24",
"@types/papaparse": "^5.3.3",
"@types/react": "^18.0.24",
"@types/react-dom": "^18.0.8",
"@types/react": "^18.2.63",
"@types/react-dom": "^18.2.20",
"@types/react-outside-click-handler": "^1.3.1",
"@types/supertest": "^2.0.12",
"@types/uuid": "^8.3.4",
"@types/sanitize-html": "^2.11.0",
"@types/uuid": "^9.0.8",
"jest": "^29.7.0",
"@types/wordpress__components": "^23.0.1",
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0",
"axios": "^1.1.3",
"axios": "^1.6.7",
"jest-environment-jsdom": "^29.7.0",
"postcss-styled-syntax": "^0.6.4",
"babel-plugin-inline-react-svg": "^2.0.1",
"eslint": "^8.20.0",
"eslint-config-prettier": "^8.5.0",
Expand All @@ -94,20 +113,18 @@
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.1",
"i18next-parser": "^6.5.0",
"jest": "^29.1.2",
"jest-environment-jsdom": "^29.1.2",
"lint-staged": "^13.0.3",
"postcss": "^8.4.14",
"postcss-syntax": "^0.36.2",
"prettier": "^2.7.1",
"stylelint": "^14.14.1",
"stylelint-config-recommended": "^9.0.0",
"stylelint": "^16.2.1",
"stylelint-config-recommended": "^14.0.0",
"supertest": "^6.3.0",
"ts-jest": "^29.0.3",
"typescript": "^4.8.4"
"ts-jest": "^29.1.2",
"typescript": "^5.3.3"
},
"overrides": {
"react": "$react",
"react-dom": "$react-dom"
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const FactorEditor: React.FC<React.PropsWithChildren<Props>> = ({ factor, onChan
label="Name"
type="text"
placeholder="Factor name"
onChange={(value) => {
onChangeByValue={(value) => {
onChangeFactor({ ...factor, name: value })
}}
value={factor.name}
Expand All @@ -34,7 +34,7 @@ const FactorEditor: React.FC<React.PropsWithChildren<Props>> = ({ factor, onChan
type="number"
placeholder="ranging from"
value={factor.range?.min ? (factor.range?.min as unknown as string) : "0"}
onChange={(value) => {
onChangeByValue={(value) => {
onChangeFactor({
...factor,
range: { max: factor.range?.max ?? 0, min: parseFloat(value) },
Expand All @@ -50,7 +50,7 @@ const FactorEditor: React.FC<React.PropsWithChildren<Props>> = ({ factor, onChan
type="number"
placeholder="ranging to"
value={factor.range?.max ? (factor.range?.max as unknown as string) : "0"}
onChange={(value) => {
onChangeByValue={(value) => {
onChangeFactor({
...factor,
range: { min: factor.range?.min ?? 0, max: parseFloat(value) },
Expand All @@ -66,7 +66,7 @@ const FactorEditor: React.FC<React.PropsWithChildren<Props>> = ({ factor, onChan
type="number"
placeholder="mean"
value={factor.mainComparingVar ? (factor.mainComparingVar as unknown as string) : "0"}
onChange={(value) => {
onChangeByValue={(value) => {
onChangeFactor({
...factor,
mainComparingVar: parseFloat(value) ?? 0,
Expand All @@ -81,7 +81,7 @@ const FactorEditor: React.FC<React.PropsWithChildren<Props>> = ({ factor, onChan
label="Description"
placeholder="Factor description"
autoResize
onChange={(value) => {
onChangeByValue={(value) => {
onChangeFactor({ ...factor, description: value })
}}
value={factor.description}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const OptionEditor: React.FC<React.PropsWithChildren<Props>> = ({
label="value"
type="number"
value={(item.value as unknown as string) ?? ""}
onChange={(e) => {
const parsedNumber = parseInt(e)
onChangeByValue={(value) => {
const parsedNumber = parseInt(value)
onChange({ ...item, value: isNaN(parsedNumber) ? null : parsedNumber })
}}
className={css`
Expand All @@ -43,8 +43,8 @@ const OptionEditor: React.FC<React.PropsWithChildren<Props>> = ({
id={`option-text-${idx}${questionLabel ? "-" + questionLabel : ""}`}
label={`Option text`}
value={item.name}
onChange={(e) => {
onChange({ ...item, name: e })
onChangeByValue={(value) => {
onChange({ ...item, name: value })
}}
className={css`
flex: 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const QuestionEditor: React.FC<React.PropsWithChildren<Props>> = ({ item, onChan
label={`Markdown Editor (special purpose labels: "info")`}
placeholder="question_label; question text"
autoResize
onChange={(value) => {
onChangeByValue={(value) => {
const parsedValue = parseLabelQuestion(value)
if (!parsedValue) {
return
Expand Down Expand Up @@ -79,7 +79,7 @@ const QuestionEditor: React.FC<React.PropsWithChildren<Props>> = ({ item, onChan
{item.questionLabel !== "info" && (
<CheckBox
label="Mandatory"
onChange={(checked) => {
onChangeByValue={(checked) => {
const mandatory = checked
onChangeQuestion({ ...item, mandatory: mandatory ?? false })
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const FactorialSurveyEditor: React.FC<React.PropsWithChildren<Props>> = ({ state
label="Title text for submission view"
type="text"
value={state.reportVariables?.titleText ? state.reportVariables.titleText : ""}
onChange={(value) => {
onChangeByValue={(value) => {
setState({
view_type: "exercise-editor",
private_spec: {
Expand All @@ -162,7 +162,7 @@ const FactorialSurveyEditor: React.FC<React.PropsWithChildren<Props>> = ({ state
? state.reportVariables.reportSuccessMessage
: ""
}
onChange={(value) => {
onChangeByValue={(value) => {
setState({
view_type: "exercise-editor",
private_spec: {
Expand All @@ -180,7 +180,7 @@ const FactorialSurveyEditor: React.FC<React.PropsWithChildren<Props>> = ({ state
? state.reportVariables.reportFailureMessage
: ""
}
onChange={(value) => {
onChangeByValue={(value) => {
setState({
view_type: "exercise-editor",
private_spec: {
Expand All @@ -196,7 +196,7 @@ const FactorialSurveyEditor: React.FC<React.PropsWithChildren<Props>> = ({ state
label="Provide factor report to student"
aria-label="calculate-feedback-checkbox"
checked={state.calculateFeedback ? true : false}
onChange={(checked) => {
onChangeByValue={(checked) => {
const newState: FactorialSurvey = {
...(state as FactorialSurvey),
calculateFeedback: checked,
Expand Down Expand Up @@ -296,7 +296,7 @@ const FactorialSurveyEditor: React.FC<React.PropsWithChildren<Props>> = ({ state
? state.reportVariables?.userVariable?.label
: ""
}
onChange={(value) => {
onChangeByValue={(value) => {
setState({
view_type: "exercise-editor",
private_spec: {
Expand All @@ -323,7 +323,7 @@ const FactorialSurveyEditor: React.FC<React.PropsWithChildren<Props>> = ({ state
? state.reportVariables.userVariable.globalKey
: ""
}
onChange={(value) => {
onChangeByValue={(value) => {
setState({
view_type: "exercise-editor",
private_spec: {
Expand Down Expand Up @@ -375,7 +375,7 @@ const FactorialSurveyEditor: React.FC<React.PropsWithChildren<Props>> = ({ state
? state.reportVariables.zeroVariable?.label
: ""
}
onChange={(value) => {
onChangeByValue={(value) => {
setState({
view_type: "exercise-editor",
private_spec: {
Expand Down Expand Up @@ -427,7 +427,7 @@ const FactorialSurveyEditor: React.FC<React.PropsWithChildren<Props>> = ({ state
? state.reportVariables.comparingVariable?.globalKey
: ""
}
onChange={(value) => {
onChangeByValue={(value) => {
setState({
view_type: "exercise-editor",
private_spec: {
Expand Down Expand Up @@ -502,7 +502,7 @@ const FactorialSurveyEditor: React.FC<React.PropsWithChildren<Props>> = ({ state
label="maximum amount of questions permitted to be rated with NaN (natural number)"
type="number"
value={state.allowedNans ? (state.allowedNans as unknown as string) : "0"}
onChange={(value) => {
onChangeByValue={(value) => {
setState({
view_type: "exercise-editor",
private_spec: { ...state, allowedNans: parseInt(value) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const barColors = [
"#8FB4B2",
"#6A9B98",
"#44827E",
"rgba(31, 105, 100, 0.9)",
"#1f6964",
"#065853",
"#05514C",
"#02413D",
Expand Down
Loading
Loading