diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..36f094798 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,50 @@ +{ + "env": { + "browser": true, + "es2021": true, + "node": true + }, + "settings": { + "react": { + "version": "detect" + } + }, + "extends": [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "prettier" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaFeatures": { + "jsx": true + }, + "ecmaVersion": 12, + "sourceType": "module" + }, + "plugins": ["react", "@typescript-eslint", "prettier"], + "rules": { + "prettier/prettier": [ + "error", + { + "endOfLine": "auto" + } + ], + "no-extra-parens": [ + "warn", + "all", + { + "nestedBinaryExpressions": false, + "returnAssign": false, + "enforceForArrowConditionals": false, + "ignoreJSX": "all" + } + ], + "brace-style": ["error", "1tbs"], + "indent": ["error", 4], + "quotes": ["error", "double"], + "semi": ["error", "always"] + } +} diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..06dbd2558 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,51 @@ + # .gitattributes snippet to force users to use same line endings for project. + # + # Handle line endings automatically for files detected as text + # and leave all files detected as binary untouched. + * text=auto + + # + # The above will handle all files NOT found below + # https://help.github.com/articles/dealing-with-line-endings/ + # https://github.com/Danimoth/gitattributes/blob/master/Web.gitattributes + + + + # These files are text and should be normalized (Convert crlf => lf) + *.php text + *.css text + *.js text + *.json text + *.htm text + *.html text + *.xml text + *.txt text + *.ini text + *.inc text + *.pl text + *.rb text + *.py text + *.scm text + *.sql text + .htaccess text + *.sh text + *.svg text + + # These files are binary and should be left untouched + # (binary is a macro for -text -diff) + *.png binary + *.jpg binary + *.jpeg binary + *.gif binary + *.ico binary + *.mov binary + *.mp4 binary + *.mp3 binary + *.flv binary + *.fla binary + *.swf binary + *.gz binary + *.zip binary + *.7z binary + *.ttf binary + *.pyc binary diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 000000000..2e3b9ba65 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,52 @@ +# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Node.js CI + +on: + push: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + - id: get-repo-values + run: | + url=https://$(echo "${{github.repository}}" | sed "s/\//.github.io\//") + echo "::set-output name=url::$url" + - name: Update package.json homepage + uses: jossef/action-set-json-field@v1 + with: + file: package.json + field: homepage + value: ${{ steps.get-repo-values.outputs.url }} + - run: npm ci + #- run: npm run lint + - run: npm run test -- --coverage |& tee ./public/test_report.txt + - run: echo "
Redirecting to repository" > ./public/github.html + - run: npm run build --if-present + + - name: Deploy + run: | + git config --global user.name ${user_name} + git config --global user.email ${user_email} + git remote set-url origin https://${github_token}@github.com/${repository} + npm run deploy + env: + user_name: "github-actions[bot]" + user_email: "github-actions[bot]@users.noreply.github.com" + github_token: ${{ secrets.GH_TOKEN }} + repository: ${{ github.repository }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..4d29575de --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..622ac0bf0 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "trailingComma": "none", + "tabWidth": 4, + "semi": true, + "singleQuote": false +} diff --git a/git b/git new file mode 100644 index 000000000..e69de29bb diff --git a/package-lock.json b/package-lock.json index 77de58fd4..213e99f65 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "@types/react": "^17.0.38", "@types/react-dom": "^17.0.11", "react": "^17.0.2", - "react-bootstrap": "^2.1.1", + "react-bootstrap": "^2.5.0", "react-dom": "^17.0.2", "react-scripts": "5.0.0", "typescript": "^4.5.5", @@ -1867,9 +1867,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz", - "integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==", + "version": "7.19.4", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.4.tgz", + "integrity": "sha512-EXpLCrk55f+cYqmHsSR+yD/0gAIMxxA9QK9lnQWzhMCvt+YmoBN7Zx94s++Kv0+unHk39vxNO8t+CMA2WSS3wA==", "dependencies": { "regenerator-runtime": "^0.13.4" }, @@ -2432,29 +2432,29 @@ } }, "node_modules/@popperjs/core": { - "version": "2.11.2", - "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.2.tgz", - "integrity": "sha512-92FRmppjjqz29VMJ2dn+xdyXZBrMlE42AV6Kq6BwjWV7CNUW1hs2FtxSNLQE+gJhaZ6AAmYuO9y8dshhcBl7vA==", + "version": "2.11.6", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.6.tgz", + "integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==", "funding": { "type": "opencollective", "url": "https://opencollective.com/popperjs" } }, "node_modules/@react-aria/ssr": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@react-aria/ssr/-/ssr-3.1.0.tgz", - "integrity": "sha512-RxqQKmE8sO7TGdrcSlHTcVzMP450hqowtBSd2bBS9oPlcokVkaGq28c3Rwa8ty5ctw4EBCjXqjP7xdcKMGDzug==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@react-aria/ssr/-/ssr-3.3.0.tgz", + "integrity": "sha512-yNqUDuOVZIUGP81R87BJVi/ZUZp/nYOBXbPsRe7oltJOfErQZD+UezMpw4vM2KRz18cURffvmC8tJ6JTeyDtaQ==", "dependencies": { "@babel/runtime": "^7.6.2" }, "peerDependencies": { - "react": "^16.8.0 || ^17.0.0-rc.1" + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0" } }, "node_modules/@restart/hooks": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/@restart/hooks/-/hooks-0.4.5.tgz", - "integrity": "sha512-tLGtY0aHeIfT7aPwUkvQuhIy3+q3w4iqmUzFLPlOAf/vNUacLaBt1j/S//jv/dQhenRh8jvswyMojCwmLvJw8A==", + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/@restart/hooks/-/hooks-0.4.7.tgz", + "integrity": "sha512-ZbjlEHcG+FQtpDPHd7i4FzNNvJf2enAwZfJbpM8CW7BhmOAbsHpZe3tsHwfQUrBuyrxWqPYp2x5UMnilWcY22A==", "dependencies": { "dequal": "^2.0.2" }, @@ -2463,18 +2463,17 @@ } }, "node_modules/@restart/ui": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/@restart/ui/-/ui-0.2.6.tgz", - "integrity": "sha512-lcutEWPvsxz0uEyRxuysCbHBfXDFnMKNMNTsnuPmLFjZXgW9fVmhksS6rpFklXHMwxOM9g6hRTBq0gS3QRKgzQ==", - "dependencies": { - "@babel/runtime": "^7.13.16", - "@popperjs/core": "^2.10.1", - "@react-aria/ssr": "^3.0.1", - "@restart/hooks": "^0.4.0", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@restart/ui/-/ui-1.4.0.tgz", + "integrity": "sha512-5dDj5uDzUgK1iijWPRg6AnxjkHM04XhTQDJirM1h/8tIc7KyLtF9YyjcCpNEn259hPMXswpkfXKNgiag0skPFg==", + "dependencies": { + "@babel/runtime": "^7.18.3", + "@popperjs/core": "^2.11.5", + "@react-aria/ssr": "^3.2.0", + "@restart/hooks": "^0.4.7", "@types/warning": "^3.0.0", "dequal": "^2.0.2", "dom-helpers": "^5.2.0", - "prop-types": "^15.7.2", "uncontrollable": "^7.2.1", "warning": "^4.0.3" }, @@ -3057,11 +3056,6 @@ "@types/node": "*" } }, - "node_modules/@types/invariant": { - "version": "2.2.35", - "resolved": "https://registry.npmjs.org/@types/invariant/-/invariant-2.2.35.tgz", - "integrity": "sha512-DxX1V9P8zdJPYQat1gHyY0xj3efl8gnMVjiM9iCY6y27lj+PoQWkgjt8jDqmovPqULkKVpKRg8J36iQiA+EtEg==" - }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", @@ -3232,7 +3226,7 @@ "node_modules/@types/warning": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/warning/-/warning-3.0.0.tgz", - "integrity": "sha1-DSUBJorY+ZYrdA04fEZU9fjiPlI=" + "integrity": "sha512-t/Tvs5qR47OLOr+4E9ckN8AmP2Tf16gWq+/qA4iUGS/OOyHVO8wv2vjJuX8SNOUTJyWb+2t7wJm6cXILFnOROA==" }, "node_modules/@types/ws": { "version": "8.2.2", @@ -5579,9 +5573,9 @@ } }, "node_modules/dequal": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.2.tgz", - "integrity": "sha512-q9K8BlJVxK7hQYqa6XISGmBZbtQQWVXSrRrWreHC94rMt1QL/Impruc+7p2CYSYuVIUr+YCt6hjrs1kkdJRTug==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", "engines": { "node": ">=6" } @@ -12132,30 +12126,32 @@ } }, "node_modules/react-bootstrap": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/react-bootstrap/-/react-bootstrap-2.1.1.tgz", - "integrity": "sha512-Igagk6LziNW/HgBlMVx+QiwPVt/oqrZ7tiBKgv31VYc/56kJEU0Y+BCJS6hrQP6QmmIpdVtX8TRaanv9xsmW5A==", - "dependencies": { - "@babel/runtime": "^7.14.0", - "@restart/hooks": "^0.4.5", - "@restart/ui": "^0.2.5", - "@types/invariant": "^2.2.33", - "@types/prop-types": "^15.7.3", - "@types/react": ">=16.14.8", - "@types/react-transition-group": "^4.4.1", - "@types/warning": "^3.0.0", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/react-bootstrap/-/react-bootstrap-2.5.0.tgz", + "integrity": "sha512-j/aLR+okzbYk61TM3eDOU1NqOqnUdwyVrF+ojoCRUxPdzc2R0xXvqyRsjSoyRoCo7n82Fs/LWjPCin/QJNdwvA==", + "dependencies": { + "@babel/runtime": "^7.17.2", + "@restart/hooks": "^0.4.6", + "@restart/ui": "^1.3.1", + "@types/react-transition-group": "^4.4.4", "classnames": "^2.3.1", "dom-helpers": "^5.2.1", "invariant": "^2.2.4", - "prop-types": "^15.7.2", + "prop-types": "^15.8.1", "prop-types-extra": "^1.1.0", - "react-transition-group": "^4.4.1", + "react-transition-group": "^4.4.2", "uncontrollable": "^7.2.1", "warning": "^4.0.3" }, "peerDependencies": { + "@types/react": ">=16.14.8", "react": ">=16.14.0", "react-dom": ">=16.14.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } } }, "node_modules/react-dev-utils": { @@ -16542,9 +16538,9 @@ } }, "@babel/runtime": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz", - "integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==", + "version": "7.19.4", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.4.tgz", + "integrity": "sha512-EXpLCrk55f+cYqmHsSR+yD/0gAIMxxA9QK9lnQWzhMCvt+YmoBN7Zx94s++Kv0+unHk39vxNO8t+CMA2WSS3wA==", "requires": { "regenerator-runtime": "^0.13.4" } @@ -16955,39 +16951,38 @@ } }, "@popperjs/core": { - "version": "2.11.2", - "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.2.tgz", - "integrity": "sha512-92FRmppjjqz29VMJ2dn+xdyXZBrMlE42AV6Kq6BwjWV7CNUW1hs2FtxSNLQE+gJhaZ6AAmYuO9y8dshhcBl7vA==" + "version": "2.11.6", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.6.tgz", + "integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==" }, "@react-aria/ssr": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@react-aria/ssr/-/ssr-3.1.0.tgz", - "integrity": "sha512-RxqQKmE8sO7TGdrcSlHTcVzMP450hqowtBSd2bBS9oPlcokVkaGq28c3Rwa8ty5ctw4EBCjXqjP7xdcKMGDzug==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@react-aria/ssr/-/ssr-3.3.0.tgz", + "integrity": "sha512-yNqUDuOVZIUGP81R87BJVi/ZUZp/nYOBXbPsRe7oltJOfErQZD+UezMpw4vM2KRz18cURffvmC8tJ6JTeyDtaQ==", "requires": { "@babel/runtime": "^7.6.2" } }, "@restart/hooks": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/@restart/hooks/-/hooks-0.4.5.tgz", - "integrity": "sha512-tLGtY0aHeIfT7aPwUkvQuhIy3+q3w4iqmUzFLPlOAf/vNUacLaBt1j/S//jv/dQhenRh8jvswyMojCwmLvJw8A==", + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/@restart/hooks/-/hooks-0.4.7.tgz", + "integrity": "sha512-ZbjlEHcG+FQtpDPHd7i4FzNNvJf2enAwZfJbpM8CW7BhmOAbsHpZe3tsHwfQUrBuyrxWqPYp2x5UMnilWcY22A==", "requires": { "dequal": "^2.0.2" } }, "@restart/ui": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/@restart/ui/-/ui-0.2.6.tgz", - "integrity": "sha512-lcutEWPvsxz0uEyRxuysCbHBfXDFnMKNMNTsnuPmLFjZXgW9fVmhksS6rpFklXHMwxOM9g6hRTBq0gS3QRKgzQ==", - "requires": { - "@babel/runtime": "^7.13.16", - "@popperjs/core": "^2.10.1", - "@react-aria/ssr": "^3.0.1", - "@restart/hooks": "^0.4.0", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@restart/ui/-/ui-1.4.0.tgz", + "integrity": "sha512-5dDj5uDzUgK1iijWPRg6AnxjkHM04XhTQDJirM1h/8tIc7KyLtF9YyjcCpNEn259hPMXswpkfXKNgiag0skPFg==", + "requires": { + "@babel/runtime": "^7.18.3", + "@popperjs/core": "^2.11.5", + "@react-aria/ssr": "^3.2.0", + "@restart/hooks": "^0.4.7", "@types/warning": "^3.0.0", "dequal": "^2.0.2", "dom-helpers": "^5.2.0", - "prop-types": "^15.7.2", "uncontrollable": "^7.2.1", "warning": "^4.0.3" } @@ -17409,11 +17404,6 @@ "@types/node": "*" } }, - "@types/invariant": { - "version": "2.2.35", - "resolved": "https://registry.npmjs.org/@types/invariant/-/invariant-2.2.35.tgz", - "integrity": "sha512-DxX1V9P8zdJPYQat1gHyY0xj3efl8gnMVjiM9iCY6y27lj+PoQWkgjt8jDqmovPqULkKVpKRg8J36iQiA+EtEg==" - }, "@types/istanbul-lib-coverage": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", @@ -17584,7 +17574,7 @@ "@types/warning": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/warning/-/warning-3.0.0.tgz", - "integrity": "sha1-DSUBJorY+ZYrdA04fEZU9fjiPlI=" + "integrity": "sha512-t/Tvs5qR47OLOr+4E9ckN8AmP2Tf16gWq+/qA4iUGS/OOyHVO8wv2vjJuX8SNOUTJyWb+2t7wJm6cXILFnOROA==" }, "@types/ws": { "version": "8.2.2", @@ -19301,9 +19291,9 @@ "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" }, "dequal": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.2.tgz", - "integrity": "sha512-q9K8BlJVxK7hQYqa6XISGmBZbtQQWVXSrRrWreHC94rMt1QL/Impruc+7p2CYSYuVIUr+YCt6hjrs1kkdJRTug==" + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==" }, "destroy": { "version": "1.0.4", @@ -23968,24 +23958,20 @@ } }, "react-bootstrap": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/react-bootstrap/-/react-bootstrap-2.1.1.tgz", - "integrity": "sha512-Igagk6LziNW/HgBlMVx+QiwPVt/oqrZ7tiBKgv31VYc/56kJEU0Y+BCJS6hrQP6QmmIpdVtX8TRaanv9xsmW5A==", - "requires": { - "@babel/runtime": "^7.14.0", - "@restart/hooks": "^0.4.5", - "@restart/ui": "^0.2.5", - "@types/invariant": "^2.2.33", - "@types/prop-types": "^15.7.3", - "@types/react": ">=16.14.8", - "@types/react-transition-group": "^4.4.1", - "@types/warning": "^3.0.0", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/react-bootstrap/-/react-bootstrap-2.5.0.tgz", + "integrity": "sha512-j/aLR+okzbYk61TM3eDOU1NqOqnUdwyVrF+ojoCRUxPdzc2R0xXvqyRsjSoyRoCo7n82Fs/LWjPCin/QJNdwvA==", + "requires": { + "@babel/runtime": "^7.17.2", + "@restart/hooks": "^0.4.6", + "@restart/ui": "^1.3.1", + "@types/react-transition-group": "^4.4.4", "classnames": "^2.3.1", "dom-helpers": "^5.2.1", "invariant": "^2.2.4", - "prop-types": "^15.7.2", + "prop-types": "^15.8.1", "prop-types-extra": "^1.1.0", - "react-transition-group": "^4.4.1", + "react-transition-group": "^4.4.2", "uncontrollable": "^7.2.1", "warning": "^4.0.3" } diff --git a/package.json b/package.json index e95856a7f..d0197ca30 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "@types/react": "^17.0.38", "@types/react-dom": "^17.0.11", "react": "^17.0.2", - "react-bootstrap": "^2.1.1", + "react-bootstrap": "^2.5.0", "react-dom": "^17.0.2", "react-scripts": "5.0.0", "typescript": "^4.5.5", diff --git a/src/quizzer/AddQuizModal.tsx b/src/quizzer/AddQuizModal.tsx index b64c61555..c91e5340d 100644 --- a/src/quizzer/AddQuizModal.tsx +++ b/src/quizzer/AddQuizModal.tsx @@ -6,9 +6,12 @@ export const AddQuizModal = ({ handleClose, addQuiz }: { + show: boolean; + handleClose: () => void; + addQuiz: (title: string, bod: string) => void; }) => { const [title, setTitle] = useState