diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..1c5472ed --- /dev/null +++ b/package-lock.json @@ -0,0 +1,441 @@ +{ + "name": "wiq_es1a", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "react-auth-kit": "^3.0.2-alpha.19" + } + }, + "node_modules/@next/env": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.1.0.tgz", + "integrity": "sha512-Py8zIo+02ht82brwwhTg36iogzFqGLPXlRGKQw5s+qP/kMNc4MAyDeEwBKDijk6zTIbegEgu8Qy7C1LboslQAw==", + "peer": true + }, + "node_modules/@next/swc-darwin-arm64": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.1.0.tgz", + "integrity": "sha512-nUDn7TOGcIeyQni6lZHfzNoo9S0euXnu0jhsbMOmMJUBfgsnESdjN97kM7cBqQxZa8L/bM9om/S5/1dzCrW6wQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.1.0.tgz", + "integrity": "sha512-1jgudN5haWxiAl3O1ljUS2GfupPmcftu2RYJqZiMJmmbBT5M1XDffjUtRUzP4W3cBHsrvkfOFdQ71hAreNQP6g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.1.0.tgz", + "integrity": "sha512-RHo7Tcj+jllXUbK7xk2NyIDod3YcCPDZxj1WLIYxd709BQ7WuRYl3OWUNG+WUfqeQBds6kvZYlc42NJJTNi4tQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.1.0.tgz", + "integrity": "sha512-v6kP8sHYxjO8RwHmWMJSq7VZP2nYCkRVQ0qolh2l6xroe9QjbgV8siTbduED4u0hlk0+tjS6/Tuy4n5XCp+l6g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.1.0.tgz", + "integrity": "sha512-zJ2pnoFYB1F4vmEVlb/eSe+VH679zT1VdXlZKX+pE66grOgjmKJHKacf82g/sWE4MQ4Rk2FMBCRnX+l6/TVYzQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.1.0.tgz", + "integrity": "sha512-rbaIYFt2X9YZBSbH/CwGAjbBG2/MrACCVu2X0+kSykHzHnYH5FjHxwXLkcoJ10cX0aWCEynpu+rP76x0914atg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.1.0.tgz", + "integrity": "sha512-o1N5TsYc8f/HpGt39OUQpQ9AKIGApd3QLueu7hXk//2xq5Z9OxmV6sQfNp8C7qYmiOlHYODOGqNNa0e9jvchGQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-ia32-msvc": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.1.0.tgz", + "integrity": "sha512-XXIuB1DBRCFwNO6EEzCTMHT5pauwaSj4SWs7CYnME57eaReAKBXCnkUE80p/pAZcewm7hs+vGvNqDPacEXHVkw==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-x64-msvc": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.1.0.tgz", + "integrity": "sha512-9WEbVRRAqJ3YFVqEZIxUqkiO8l1nool1LmNxygr5HWF8AcSYsEpneUDhmjUVJEzO2A04+oPtZdombzzPPkTtgg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@swc/helpers": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.2.tgz", + "integrity": "sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw==", + "peer": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "peer": true, + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001583", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001583.tgz", + "integrity": "sha512-acWTYaha8xfhA/Du/z4sNZjHUWjkiuoAi2LM+T/aL+kemKQgPT1xBb/YKjlQ0Qo8gvbHsGNplrEJ+9G3gL7i4Q==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "peer": true + }, + "node_modules/client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", + "peer": true + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "peer": true + }, + "node_modules/js-cookie": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz", + "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==", + "engines": { + "node": ">=14" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "peer": true + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "peer": true, + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/nanoid": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "peer": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/next": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/next/-/next-14.1.0.tgz", + "integrity": "sha512-wlzrsbfeSU48YQBjZhDzOwhWhGsy+uQycR8bHAOt1LY1bn3zZEcDyHQOEoN3aWzQ8LHCAJ1nqrWCc9XF2+O45Q==", + "peer": true, + "dependencies": { + "@next/env": "14.1.0", + "@swc/helpers": "0.5.2", + "busboy": "1.6.0", + "caniuse-lite": "^1.0.30001579", + "graceful-fs": "^4.2.11", + "postcss": "8.4.31", + "styled-jsx": "5.1.1" + }, + "bin": { + "next": "dist/bin/next" + }, + "engines": { + "node": ">=18.17.0" + }, + "optionalDependencies": { + "@next/swc-darwin-arm64": "14.1.0", + "@next/swc-darwin-x64": "14.1.0", + "@next/swc-linux-arm64-gnu": "14.1.0", + "@next/swc-linux-arm64-musl": "14.1.0", + "@next/swc-linux-x64-gnu": "14.1.0", + "@next/swc-linux-x64-musl": "14.1.0", + "@next/swc-win32-arm64-msvc": "14.1.0", + "@next/swc-win32-ia32-msvc": "14.1.0", + "@next/swc-win32-x64-msvc": "14.1.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.1.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "sass": "^1.3.0" + }, + "peerDependenciesMeta": { + "@opentelemetry/api": { + "optional": true + }, + "sass": { + "optional": true + } + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "peer": true + }, + "node_modules/postcss": { + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "peer": true, + "dependencies": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-auth-kit": { + "version": "3.0.2-alpha.19", + "resolved": "https://registry.npmjs.org/react-auth-kit/-/react-auth-kit-3.0.2-alpha.19.tgz", + "integrity": "sha512-xZStv05wItit/AN2qgSErYCtpn9u8rr3cpgMxG8ZOkJMcYa4wvFPkYoAWT5rkOuP85fp9B0AqGb5tUen0B5yeg==", + "dependencies": { + "js-cookie": "^3.0.1", + "rxjs": "^7.8.1" + }, + "peerDependencies": { + "next": ">=13.0 || ^14.x", + "react": ">=16.8.0 || ^17.x || ^18.x", + "react-dom": ">=16.8.0 || ^17.x || ^18.x" + } + }, + "node_modules/react-dom": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", + "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.0" + }, + "peerDependencies": { + "react": "^18.2.0" + } + }, + "node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/scheduler": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", + "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "peer": true, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/styled-jsx": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", + "integrity": "sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==", + "peer": true, + "dependencies": { + "client-only": "0.0.1" + }, + "engines": { + "node": ">= 12.0.0" + }, + "peerDependencies": { + "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..2d4da84c --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "react-auth-kit": "^3.0.2-alpha.19" + } +} diff --git a/webapp/package-lock.json b/webapp/package-lock.json index 27466aee..d3aef19f 100644 --- a/webapp/package-lock.json +++ b/webapp/package-lock.json @@ -8,6 +8,7 @@ "name": "webapp", "version": "0.1.0", "dependencies": { + "@auth-kit/react-router": "^3.0.2-alpha.19", "@emotion/react": "^11.11.3", "@emotion/styled": "^11.11.0", "@mui/material": "^5.15.3", @@ -16,7 +17,9 @@ "@testing-library/user-event": "^14.5.2", "axios": "^1.6.5", "react": "^18.2.0", + "react-auth-kit": "^3.0.2-alpha.19", "react-dom": "^18.2.0", + "react-router-dom": "^6.22.0", "react-scripts": "5.0.1", "web-vitals": "^3.5.1" }, @@ -68,6 +71,18 @@ "node": ">=6.0.0" } }, + "node_modules/@auth-kit/react-router": { + "version": "3.0.2-alpha.19", + "resolved": "https://registry.npmjs.org/@auth-kit/react-router/-/react-router-3.0.2-alpha.19.tgz", + "integrity": "sha512-EK69EVVJd6y84VwE8GqNQtui+fQhMlkkSiaTleW8fHR8i+N7Ydwjgq2gTPiZokEfKzTk0X5lp7/0KEIChXS6EQ==", + "dependencies": { + "react-auth-kit": "^3.0.2-alpha.19" + }, + "peerDependencies": { + "react": ">=16.8.0 || ^17.x || ^18.x", + "react-router": ">=6.x" + } + }, "node_modules/@babel/code-frame": { "version": "7.23.5", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", @@ -4752,6 +4767,156 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" }, + "node_modules/@next/env": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.1.0.tgz", + "integrity": "sha512-Py8zIo+02ht82brwwhTg36iogzFqGLPXlRGKQw5s+qP/kMNc4MAyDeEwBKDijk6zTIbegEgu8Qy7C1LboslQAw==", + "peer": true + }, + "node_modules/@next/swc-darwin-arm64": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.1.0.tgz", + "integrity": "sha512-nUDn7TOGcIeyQni6lZHfzNoo9S0euXnu0jhsbMOmMJUBfgsnESdjN97kM7cBqQxZa8L/bM9om/S5/1dzCrW6wQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.1.0.tgz", + "integrity": "sha512-1jgudN5haWxiAl3O1ljUS2GfupPmcftu2RYJqZiMJmmbBT5M1XDffjUtRUzP4W3cBHsrvkfOFdQ71hAreNQP6g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.1.0.tgz", + "integrity": "sha512-RHo7Tcj+jllXUbK7xk2NyIDod3YcCPDZxj1WLIYxd709BQ7WuRYl3OWUNG+WUfqeQBds6kvZYlc42NJJTNi4tQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.1.0.tgz", + "integrity": "sha512-v6kP8sHYxjO8RwHmWMJSq7VZP2nYCkRVQ0qolh2l6xroe9QjbgV8siTbduED4u0hlk0+tjS6/Tuy4n5XCp+l6g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.1.0.tgz", + "integrity": "sha512-zJ2pnoFYB1F4vmEVlb/eSe+VH679zT1VdXlZKX+pE66grOgjmKJHKacf82g/sWE4MQ4Rk2FMBCRnX+l6/TVYzQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.1.0.tgz", + "integrity": "sha512-rbaIYFt2X9YZBSbH/CwGAjbBG2/MrACCVu2X0+kSykHzHnYH5FjHxwXLkcoJ10cX0aWCEynpu+rP76x0914atg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.1.0.tgz", + "integrity": "sha512-o1N5TsYc8f/HpGt39OUQpQ9AKIGApd3QLueu7hXk//2xq5Z9OxmV6sQfNp8C7qYmiOlHYODOGqNNa0e9jvchGQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-ia32-msvc": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.1.0.tgz", + "integrity": "sha512-XXIuB1DBRCFwNO6EEzCTMHT5pauwaSj4SWs7CYnME57eaReAKBXCnkUE80p/pAZcewm7hs+vGvNqDPacEXHVkw==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-x64-msvc": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.1.0.tgz", + "integrity": "sha512-9WEbVRRAqJ3YFVqEZIxUqkiO8l1nool1LmNxygr5HWF8AcSYsEpneUDhmjUVJEzO2A04+oPtZdombzzPPkTtgg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { "version": "5.1.1-v1", "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz", @@ -5005,6 +5170,14 @@ "node": ">=12" } }, + "node_modules/@remix-run/router": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.15.0.tgz", + "integrity": "sha512-HOil5aFtme37dVQTB6M34G95kPM3MMuqSmIRVCC52eKV+Y/tGSqw9P3rWhlAx6A+mz+MoX+XxsGsNJbaI5qCgQ==", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@rollup/plugin-babel": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz", @@ -5354,6 +5527,15 @@ "url": "https://github.com/sponsors/gregberge" } }, + "node_modules/@swc/helpers": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.2.tgz", + "integrity": "sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw==", + "peer": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@testing-library/dom": { "version": "9.3.3", "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-9.3.3.tgz", @@ -7729,6 +7911,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "peer": true, + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, "node_modules/bytes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", @@ -7818,9 +8012,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001576", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001576.tgz", - "integrity": "sha512-ff5BdakGe2P3SQsMsiqmt1Lc8221NR1VzHj5jXN5vBny9A6fpze94HiVV/n7XRosOlsShJcvMv5mdnpjOGCEgg==", + "version": "1.0.30001583", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001583.tgz", + "integrity": "sha512-acWTYaha8xfhA/Du/z4sNZjHUWjkiuoAi2LM+T/aL+kemKQgPT1xBb/YKjlQ0Qo8gvbHsGNplrEJ+9G3gL7i4Q==", "funding": [ { "type": "opencollective", @@ -8124,6 +8318,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", + "peer": true + }, "node_modules/clipboardy": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-3.0.0.tgz", @@ -18233,6 +18433,14 @@ "@sideway/pinpoint": "^2.0.0" } }, + "node_modules/js-cookie": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz", + "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==", + "engines": { + "node": ">=14" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -19207,6 +19415,80 @@ "node": ">=12.22.0" } }, + "node_modules/next": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/next/-/next-14.1.0.tgz", + "integrity": "sha512-wlzrsbfeSU48YQBjZhDzOwhWhGsy+uQycR8bHAOt1LY1bn3zZEcDyHQOEoN3aWzQ8LHCAJ1nqrWCc9XF2+O45Q==", + "peer": true, + "dependencies": { + "@next/env": "14.1.0", + "@swc/helpers": "0.5.2", + "busboy": "1.6.0", + "caniuse-lite": "^1.0.30001579", + "graceful-fs": "^4.2.11", + "postcss": "8.4.31", + "styled-jsx": "5.1.1" + }, + "bin": { + "next": "dist/bin/next" + }, + "engines": { + "node": ">=18.17.0" + }, + "optionalDependencies": { + "@next/swc-darwin-arm64": "14.1.0", + "@next/swc-darwin-x64": "14.1.0", + "@next/swc-linux-arm64-gnu": "14.1.0", + "@next/swc-linux-arm64-musl": "14.1.0", + "@next/swc-linux-x64-gnu": "14.1.0", + "@next/swc-linux-x64-musl": "14.1.0", + "@next/swc-win32-arm64-msvc": "14.1.0", + "@next/swc-win32-ia32-msvc": "14.1.0", + "@next/swc-win32-x64-msvc": "14.1.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.1.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "sass": "^1.3.0" + }, + "peerDependenciesMeta": { + "@opentelemetry/api": { + "optional": true + }, + "sass": { + "optional": true + } + } + }, + "node_modules/next/node_modules/postcss": { + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "peer": true, + "dependencies": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, "node_modules/nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", @@ -21862,6 +22144,20 @@ "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" }, + "node_modules/react-auth-kit": { + "version": "3.0.2-alpha.19", + "resolved": "https://registry.npmjs.org/react-auth-kit/-/react-auth-kit-3.0.2-alpha.19.tgz", + "integrity": "sha512-xZStv05wItit/AN2qgSErYCtpn9u8rr3cpgMxG8ZOkJMcYa4wvFPkYoAWT5rkOuP85fp9B0AqGb5tUen0B5yeg==", + "dependencies": { + "js-cookie": "^3.0.1", + "rxjs": "^7.8.1" + }, + "peerDependencies": { + "next": ">=13.0 || ^14.x", + "react": ">=16.8.0 || ^17.x || ^18.x", + "react-dom": ">=16.8.0 || ^17.x || ^18.x" + } + }, "node_modules/react-dev-utils": { "version": "12.0.1", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz", @@ -22009,6 +22305,36 @@ "node": ">=0.10.0" } }, + "node_modules/react-router": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.22.0.tgz", + "integrity": "sha512-q2yemJeg6gw/YixRlRnVx6IRJWZD6fonnfZhN1JIOhV2iJCPeRNSH3V1ISwHf+JWcESzLC3BOLD1T07tmO5dmg==", + "dependencies": { + "@remix-run/router": "1.15.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8" + } + }, + "node_modules/react-router-dom": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.22.0.tgz", + "integrity": "sha512-z2w+M4tH5wlcLmH3BMMOMdrtrJ9T3oJJNsAlBJbwk+8Syxd5WFJ7J5dxMEW0/GEXD1BBis4uXRrNIz3mORr0ag==", + "dependencies": { + "@remix-run/router": "1.15.0", + "react-router": "6.22.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8" + } + }, "node_modules/react-scripts": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-5.0.1.tgz", @@ -23755,7 +24081,6 @@ "version": "7.8.1", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", - "dev": true, "dependencies": { "tslib": "^2.1.0" } @@ -25246,6 +25571,15 @@ "duplexer": "~0.1.1" } }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "peer": true, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/streamx": { "version": "2.15.6", "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.6.tgz", @@ -25485,6 +25819,29 @@ "webpack": "^5.0.0" } }, + "node_modules/styled-jsx": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", + "integrity": "sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==", + "peer": true, + "dependencies": { + "client-only": "0.0.1" + }, + "engines": { + "node": ">= 12.0.0" + }, + "peerDependencies": { + "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "babel-plugin-macros": { + "optional": true + } + } + }, "node_modules/stylehacks": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-5.1.1.tgz", diff --git a/webapp/package.json b/webapp/package.json index 74e31bee..44fe9415 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { + "@auth-kit/react-router": "^3.0.2-alpha.19", "@emotion/react": "^11.11.3", "@emotion/styled": "^11.11.0", "@mui/material": "^5.15.3", @@ -11,7 +12,9 @@ "@testing-library/user-event": "^14.5.2", "axios": "^1.6.5", "react": "^18.2.0", + "react-auth-kit": "^3.0.2-alpha.19", "react-dom": "^18.2.0", + "react-router-dom": "^6.22.0", "react-scripts": "5.0.1", "web-vitals": "^3.5.1" }, diff --git a/webapp/src/App.css b/webapp/src/App.css index 74b5e053..a3cbc06b 100644 --- a/webapp/src/App.css +++ b/webapp/src/App.css @@ -1,38 +1,40 @@ -.App { - text-align: center; -} - -.App-logo { - height: 40vmin; - pointer-events: none; -} - -@media (prefers-reduced-motion: no-preference) { - .App-logo { - animation: App-logo-spin infinite 20s linear; - } -} - -.App-header { - background-color: #282c34; - min-height: 100vh; +#root{ + height: 100vh; display: flex; flex-direction: column; align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; + text-align: center; + justify-content: space-between; +} + +h1{ + text-align: center; } -.App-link { - color: #61dafb; +input, button, a{ + appearance: none; + background-color: transparent; + border: 0.13rem solid #0F0F0F; + border-radius: 15px; + box-sizing: border-box; + color: #0F0F0F; + padding: 1rem; + text-align: center; + text-decoration: none; + transition: all 300ms cubic-bezier(.23, 1, 0.32, 1); + user-select: none; + -webkit-user-select: none; + touch-action: manipulation; + width: 100%; + will-change: transform; + -webkit-box-shadow: 10px 10px 6px 0px rgba(0,255,192,1); + -moz-box-shadow: 10px 10px 6px 0px rgba(0,255,192,1); + box-shadow: 5px 5px 6px 0px rgba(0,255,192,1); + margin: 1rem; } -@keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } +input:hover, button:hover, a:hover { + background-color: #00ffc0; + -webkit-box-shadow: 0 0 0 0 #000,0 0 0 2px #00ffc0; + box-shadow: 0 0 0 0 #000,0 0 0 2px #00ffc0 } diff --git a/webapp/src/App.js b/webapp/src/App.js index d932005b..c37a947f 100644 --- a/webapp/src/App.js +++ b/webapp/src/App.js @@ -1,38 +1,41 @@ import React, { useState } from 'react'; -import AddUser from './components/AddUser'; -import Login from './components/Login'; -import CssBaseline from '@mui/material/CssBaseline'; -import Container from '@mui/material/Container'; -import Typography from '@mui/material/Typography'; -import Link from '@mui/material/Link'; +import Authenticate from './pages/Authenticate/Authenticate.js'; +import Home from './pages/Home/Home.js'; +import Clasico from './pages/Clasico/Clasico.js'; +import WrongRoute from './pages/WrongRoute/WrongRoute.js'; +import './App.css'; -function App() { - const [showLogin, setShowLogin] = useState(true); +import {BrowserRouter, Routes, Route} from "react-router-dom"; +import AuthProvider from 'react-auth-kit'; +import AuthOutlet from '@auth-kit/react-router/AuthOutlet'; +import createStore from 'react-auth-kit/createStore'; - const handleToggleView = () => { - setShowLogin(!showLogin); - }; +const store = createStore({ + authName:'_auth', + authType:'cookie', + cookieDomain: window.location.hostname, + cookieSecure: window.location.protocol === 'https:' +}) + + const App = () => { + return ( + + + + {/** Rutas públicas */} + }/> + + {/** Rutas privadas */} + }> + } /> + } /> + - return ( - - - - Welcome to the 2024 edition of the Software Architecture course - - {showLogin ? : } - - {showLogin ? ( - - Don't have an account? Register here. - - ) : ( - - Already have an account? Login here. - - )} - - - ); -} + } /> + + + + ); + }; export default App; diff --git a/webapp/src/components/Footer/Footer.css b/webapp/src/components/Footer/Footer.css new file mode 100644 index 00000000..c422f99e --- /dev/null +++ b/webapp/src/components/Footer/Footer.css @@ -0,0 +1,3 @@ +footer{ + margin: 3rem; +} \ No newline at end of file diff --git a/webapp/src/components/Footer/Footer.js b/webapp/src/components/Footer/Footer.js new file mode 100644 index 00000000..7198079f --- /dev/null +++ b/webapp/src/components/Footer/Footer.js @@ -0,0 +1,14 @@ +import React from 'react'; +import { Link } from "react-router-dom"; +import './Footer.css'; + +const Footer = () => { + return( + + ); +} + +export default Footer; \ No newline at end of file diff --git a/webapp/src/components/Login/Login.css b/webapp/src/components/Login/Login.css new file mode 100644 index 00000000..c73fe721 --- /dev/null +++ b/webapp/src/components/Login/Login.css @@ -0,0 +1,13 @@ +.login-container { + display: grid; + grid-template-columns: 1fr; + gap: 1rem; +} + +.login-container h1{ + text-align: center; +} + +a{ + box-shadow: none; +} \ No newline at end of file diff --git a/webapp/src/components/Login.js b/webapp/src/components/Login/Login.js similarity index 54% rename from webapp/src/components/Login.js rename to webapp/src/components/Login/Login.js index 0ad6268e..e6a85166 100644 --- a/webapp/src/components/Login.js +++ b/webapp/src/components/Login/Login.js @@ -2,30 +2,48 @@ import React, { useState } from 'react'; import axios from 'axios'; import { Container, Typography, TextField, Button, Snackbar } from '@mui/material'; +import { useNavigate } from "react-router-dom"; +import useSignIn from 'react-auth-kit/hooks/useSignIn'; +import './Login.css'; const Login = () => { + const signIn = useSignIn(); const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); + const [token, setToken] = useState(''); const [error, setError] = useState(''); const [loginSuccess, setLoginSuccess] = useState(false); const [createdAt, setCreatedAt] = useState(''); const [openSnackbar, setOpenSnackbar] = useState(false); + const navigate = useNavigate(); + const apiEndpoint = process.env.REACT_APP_API_ENDPOINT || 'http://localhost:8000'; const loginUser = async () => { try { const response = await axios.post(`${apiEndpoint}/login`, { username, password }); - + console.log(response); // Extract data from the response const { createdAt: userCreatedAt } = response.data; + setToken(response.data.token); + + signIn({ + auth: { + token: token + }, + userState: {name: username} + }) setCreatedAt(userCreatedAt); setLoginSuccess(true); setOpenSnackbar(true); + + navigate('/home') } catch (error) { - setError(error.response.data.error); + //console.log(error); + //setError(error.response.data.error); } }; @@ -34,47 +52,50 @@ const Login = () => { }; return ( - + {loginSuccess ? ( - + Hello {username}! - - + + Your account was created on {new Date(createdAt).toLocaleDateString()}. - + ) : ( - - - Login - - + Login + setUsername(e.target.value)} /> - setPassword(e.target.value)} /> - + Login - - + + {openSnackbar && ( + + Login successful + + )} {error && ( - setError('')} message={`Error: ${error}`} /> + + Error: {error} + )} - + > )} - - ); -}; + + ) +} export default Login; diff --git a/webapp/src/components/Login.test.js b/webapp/src/components/Login/Login.test.js similarity index 100% rename from webapp/src/components/Login.test.js rename to webapp/src/components/Login/Login.test.js diff --git a/webapp/src/components/Nav/Nav.css b/webapp/src/components/Nav/Nav.css new file mode 100644 index 00000000..cbb4329b --- /dev/null +++ b/webapp/src/components/Nav/Nav.css @@ -0,0 +1,33 @@ +.logo{ + font-family: oswald,sans-serif; + width: 100%; + font-size: 5rem; + font-weight: 700; + margin: 0; + text-shadow: 4px 4px 0 #00ffc0; +} + +nav{ + width: 80vw; + display: flex; + flex-wrap: wrap; + border: 3px solid #0F0F0F; + border-radius: 1rem; + padding: 1rem; + margin: 1rem; + justify-content: center; + -webkit-box-shadow: 10px 10px 6px 0px rgba(0,255,192,1); + -moz-box-shadow: 10px 10px 6px 0px rgba(0,255,192,1); + box-shadow: 10px 10px 5px 0px rgba(0,255,192,1); +} + +nav ul{ + display: flex; + justify-content: center; + flex-direction: row; +} + +nav li{ + display: flex; + flex-direction: row; +} \ No newline at end of file diff --git a/webapp/src/components/Nav/Nav.js b/webapp/src/components/Nav/Nav.js new file mode 100644 index 00000000..95d8f951 --- /dev/null +++ b/webapp/src/components/Nav/Nav.js @@ -0,0 +1,17 @@ +import React from 'react'; +import { Link } from "react-router-dom"; +import './Nav.css'; + +const Nav = () => { + return( + + WIQ! + + Home + Sobre nosotros + + + ); +} + +export default Nav; \ No newline at end of file diff --git a/webapp/src/components/Preguntas.js b/webapp/src/components/Preguntas.js new file mode 100644 index 00000000..3083f529 --- /dev/null +++ b/webapp/src/components/Preguntas.js @@ -0,0 +1,56 @@ +const Preguntas = [ + { + pregunta: "¿Cuál es la capital de Francia?", + respuestas: ["Londres", "París", "Madrid", "Roma"], + respuestaCorrecta: "París" + }, + { + pregunta: "¿Cuál es el río más largo del mundo?", + respuestas: ["Amazonas", "Nilo", "Misisipi", "Yangtsé"], + respuestaCorrecta: "Amazonas" + } + //, + // { + // pregunta: "¿Cuál es el océano más grande?", + // respuestas: ["Pacífico", "Atlántico", "Índico", "Ártico"], + // respuestaCorrecta: "Pacífico" + // }, + // { + // pregunta: "¿Quién escribió 'Don Quijote de la Mancha'?", + // respuestas: ["Miguel de Cervantes", "Gabriel García Márquez", "William Shakespeare", "Leo Tolstoy"], + // respuestaCorrecta: "Miguel de Cervantes" + // }, + // { + // pregunta: "¿Cuál es el elemento más abundante en la Tierra?", + // respuestas: ["Hierro", "Oxígeno", "Hidrógeno", "Silicio"], + // respuestaCorrecta: "Oxígeno" + // }, + // { + // pregunta: "¿Cuál es el país más poblado del mundo?", + // respuestas: ["India", "China", "Estados Unidos", "Brasil"], + // respuestaCorrecta: "China" + // }, + // { + // pregunta: "¿Quién pintó la 'Mona Lisa'?", + // respuestas: ["Leonardo da Vinci", "Pablo Picasso", "Vincent van Gogh", "Rembrandt"], + // respuestaCorrecta: "Leonardo da Vinci" + // }, + // { + // pregunta: "¿Cuál es el hueso más largo del cuerpo humano?", + // respuestas: ["Fémur", "Tibia", "Húmero", "Radio"], + // respuestaCorrecta: "Fémur" + // }, + // { + // pregunta: "¿Quién fue el primer presidente de Estados Unidos?", + // respuestas: ["George Washington", "Thomas Jefferson", "Abraham Lincoln", "John Adams"], + // respuestaCorrecta: "George Washington" + // }, + // { + // pregunta: "¿Cuál es la montaña más alta del mundo?", + // respuestas: ["Monte Everest", "Monte Kilimanjaro", "Monte McKinley", "Monte Aconcagua"], + // respuestaCorrecta: "Monte Everest" + // } +]; + +export default Preguntas; + \ No newline at end of file diff --git a/webapp/src/components/AddUser.js b/webapp/src/components/Register/Register.js similarity index 100% rename from webapp/src/components/AddUser.js rename to webapp/src/components/Register/Register.js diff --git a/webapp/src/components/AddUser.test.js b/webapp/src/components/Register/Register.test.js similarity index 100% rename from webapp/src/components/AddUser.test.js rename to webapp/src/components/Register/Register.test.js diff --git a/webapp/src/pages/Authenticate/Authenticate.js b/webapp/src/pages/Authenticate/Authenticate.js new file mode 100644 index 00000000..5ebf98de --- /dev/null +++ b/webapp/src/pages/Authenticate/Authenticate.js @@ -0,0 +1,43 @@ +import React, { useState } from 'react'; +import AddUser from '../../components/Register/Register'; +import Login from '../../components/Login/Login'; +import CssBaseline from '@mui/material/CssBaseline'; +import Container from '@mui/material/Container'; +import Typography from '@mui/material/Typography'; +import Link from '@mui/material/Link'; +import Footer from '../../components/Footer/Footer.js'; + +import { BrowserRouter as Router, Route, Redirect } from 'react-router-dom'; +import { PrivateRoute, useAuth } from 'react-auth-kit'; + +function Authenticate() { + const [showLogin, setShowLogin] = useState(true); + + const handleToggleView = () => { + setShowLogin(!showLogin); + }; + + return ( + + + + Bienvenido a WIQ + + {showLogin ? : } + + {showLogin ? ( + + ¿No tienes cuenta? Regístrate. + + ) : ( + + Ya tienes cuenta? Inicia sesión. + + )} + + + + ); +} + +export default Authenticate; diff --git a/webapp/src/pages/Clasico/Clasico.css b/webapp/src/pages/Clasico/Clasico.css new file mode 100644 index 00000000..3684928a --- /dev/null +++ b/webapp/src/pages/Clasico/Clasico.css @@ -0,0 +1,70 @@ +body { + font-family: "Consolas", sans-serif; +} + +.menuContainer{ + display: flex; + flex-direction: column; + justify-content: center; + border: 3px solid #0F0F0F; + padding: 1rem; + -webkit-box-shadow: 10px 10px 6px 0px rgba(0,255,192,1); + -moz-box-shadow: 10px 10px 6px 0px rgba(0,255,192,1); + box-shadow: 10px 10px 5px 0px rgba(0,255,192,1); + border-radius: 1rem; +} + +.menuContainer > *{ + text-align: center; + margin: 1rem 0; + +} + +.container h1 { + text-align: center; +} + +.questionContainer { + display: grid; + justify-content: center; + align-items: center; + border: 3px solid #0F0F0F; + border-radius: 1rem; + padding: 1rem; + -webkit-box-shadow: 10px 10px 6px 0px rgba(0,255,192,1); + -moz-box-shadow: 10px 10px 6px 0px rgba(0,255,192,1); + box-shadow: 10px 10px 5px 0px rgba(0,255,192,1); +} + +.responsesContainer { + display: grid; + justify-content: center; + grid-template-columns: repeat(2, 1fr); + grid-template-rows: repeat(2, 1fr); + gap: 1rem; + margin-bottom: 1rem; +} + +button{ + margin: 0.25rem; +} + +/* CSS */ +.responsesContainer button { + appearance: none; + background-color: transparent; + border: 0.13rem solid #0f0f0f; + border-radius: 15px; + color: #0f0f0f; + padding: 1rem; + text-align: center; + text-decoration: none; + transition: all 300ms cubic-bezier(0.23, 1, 0.32, 1); + user-select: none; + -webkit-user-select: none; + touch-action: manipulation; + width: 100%; + will-change: transform; + margin: 0; +} + diff --git a/webapp/src/pages/Clasico/Clasico.js b/webapp/src/pages/Clasico/Clasico.js new file mode 100644 index 00000000..93688800 --- /dev/null +++ b/webapp/src/pages/Clasico/Clasico.js @@ -0,0 +1,124 @@ +import React, { useState, useEffect } from "react"; +import "./Clasico.css"; +import Preguntas from "../../components/Preguntas"; +import { useNavigate } from "react-router-dom"; +import Nav from '../../components/Nav/Nav.js'; +import { Link } from 'react-router-dom'; +import Footer from "../../components/Footer/Footer.js"; + +const JuegoPreguntas = () => { + const [indicePregunta, setIndicePregunta] = useState(0); + const [puntuacion, setPuntuacion] = useState(0); + const [respuestaSeleccionada, setRespuestaSeleccionada] = useState(null); + const [tiempoRestante, setTiempoRestante] = useState(10); + const [juegoTerminado, setJuegoTerminado] = useState(false); + const [mostrarMenu, setMostrarMenu] = useState(false); // Estado para mostrar el menú al finalizar el juego + const preguntaActual = Preguntas[indicePregunta]; + const navigate = useNavigate(); + + useEffect(() => { + if (tiempoRestante === 0) { + setTimeout(() => { + handleSiguientePregunta(); + }, 3000); + } + const timer = setInterval(() => { + setTiempoRestante((prevTiempo) => (prevTiempo <= 0 ? 0 : prevTiempo - 1)); + }, 1000); + return () => clearInterval(timer); + }, [tiempoRestante, indicePregunta]); + + useEffect(() => { + if (juegoTerminado) { + setMostrarMenu(true); + } + }, [juegoTerminado]); + + const handleRespuestaSeleccionada = (respuesta) => { + if (!juegoTerminado) { + setRespuestaSeleccionada(respuesta); + } + }; + + const estiloRespuesta = (respuesta) => { + if (juegoTerminado) { + if (respuesta === preguntaActual.respuestaCorrecta) { + return { backgroundColor: "green" }; + } else if (respuesta === respuestaSeleccionada) { + return { backgroundColor: "red" }; + } + } else { + if (respuesta === respuestaSeleccionada) { + return { backgroundColor: "#0F0F0F", color: "#F0F0F0" }; + } + } + return {}; + }; + + const handleSiguientePregunta = () => { + if (respuestaSeleccionada === preguntaActual.respuestaCorrecta) { + setPuntuacion(puntuacion + 1); + } + setRespuestaSeleccionada(null); + setTiempoRestante(10); + if (indicePregunta + 1 < Preguntas.length) { + setIndicePregunta(indicePregunta + 1); + } else { + setJuegoTerminado(true); + } + }; + + const handleRepetirJuego = () => { + // Reiniciar el estado para repetir el juego + setIndicePregunta(0); + setPuntuacion(0); + setRespuestaSeleccionada(null); + setTiempoRestante(10); + setJuegoTerminado(false); + setMostrarMenu(false); + }; + + if (mostrarMenu) { + return ( + <> + + + ¡Juego terminado! + + Tu puntuación: {puntuacion}/{Preguntas.length} + + Repetir Juego + Volver al Menú Principal + + + > + ); + } + + return ( + <> + + + Pregunta {indicePregunta + 1}: + {preguntaActual.pregunta} + + {preguntaActual.respuestas.map((respuesta, index) => ( + handleRespuestaSeleccionada(respuesta)} + disabled={tiempoRestante === 0 || juegoTerminado} + style={estiloRespuesta(respuesta)} + > + {respuesta} + + ))} + + Tiempo restante: {tiempoRestante} + Puntuación: {puntuacion} + + + > + ); +}; + +export default JuegoPreguntas; diff --git a/webapp/src/pages/Home/Home.css b/webapp/src/pages/Home/Home.css new file mode 100644 index 00000000..68a3a232 --- /dev/null +++ b/webapp/src/pages/Home/Home.css @@ -0,0 +1,22 @@ +.games-container{ + display: grid; + grid-template-columns: 1fr; + justify-content: center; +} + +ul{ + display: flex; + flex-wrap: wrap; + align-items: center; + grid-template-columns: 1fr; + list-style-type: none; + text-align: center; + gap: 1rem; + margin: 1rem; + padding: 0; +} + +ul li{ + text-decoration: none; + +} \ No newline at end of file diff --git a/webapp/src/pages/Home/Home.js b/webapp/src/pages/Home/Home.js new file mode 100644 index 00000000..e5d08fda --- /dev/null +++ b/webapp/src/pages/Home/Home.js @@ -0,0 +1,29 @@ +import React from "react"; +import "./Home.css"; +import Nav from '../../components/Nav/Nav.js'; +import Footer from '../../components/Footer/Footer.js'; +import { Link } from "react-router-dom"; + +const Home = () => { + return ( + <> + + + + Bienvenido a WIQ! + Selecciona un modo de juego + + + Clásico + Batería de sabios + Descartando + La pregunta caliente + Descubriendo ciudades + + + + > + ); +}; + +export default Home; diff --git a/webapp/src/pages/WrongRoute/WrongRoute.css b/webapp/src/pages/WrongRoute/WrongRoute.css new file mode 100644 index 00000000..0d301563 --- /dev/null +++ b/webapp/src/pages/WrongRoute/WrongRoute.css @@ -0,0 +1,166 @@ +#notfound{ + width: 90%; + display: flex; + justify-content: center; + margin: auto 0; +} + +#notfound .notfound-bg>div { + overflow: hidden; + position: absolute; + top: 0; + bottom: 0; + width: 1px; + background-color: #eee +} +.notfound-bg>div{ + z-index: -1; +} + +#notfound .notfound-bg>div:nth-child(1) { + left: 20% +} + +#notfound .notfound-bg>div:nth-child(2) { + left: 40% +} + +#notfound .notfound-bg>div:nth-child(3) { + left: 60% +} + +#notfound .notfound-bg>div:nth-child(4) { + left: 80% +} + +#notfound .notfound-bg>div:after { + content: ''; + position: absolute; + top: 0; + left: -.5px; + transform: translateY(50%); + height: 160px; + width: 10rem; + background-color: #00ffc0 +} + +@keyframes drop { + 90% { + height: 20px + } + + 100% { + height: 160px; + -webkit-transform: translateY(calc(100vh + 160px)); + transform: translateY(calc(100vh + 160px)) + } +} + +#notfound .notfound-bg>div:nth-child(1):after { + animation: drop 3s infinite linear; + animation-delay: .2s +} + +#notfound .notfound-bg>div:nth-child(2):after { + animation: drop 2s infinite linear; + animation-delay: .7s +} + +#notfound .notfound-bg>div:nth-child(3):after { + animation: drop 3s infinite linear; + animation-delay: .9s +} + +#notfound .notfound-bg>div:nth-child(4):after { + animation: drop 2s infinite linear; + animation-delay: 1.2s +} + +.notfound { + max-width: 520px; + width: 100%; + text-align: center +} + +.notfound .notfound-404 { + height: 210px; + line-height: 210px +} + +.notfound .notfound-404 h1 { + font-family: oswald,sans-serif; + font-size: 188px; + font-weight: 700; + margin: 0; + text-shadow: 4px 4px 0 #00ffc0; +} + +.notfound h2 { + font-family: oswald,sans-serif; + font-size: 42px; + font-weight: 700; + margin: 0; + text-transform: uppercase; + letter-spacing: 1.6px +} + +.notfound p { + font-family: lato,sans-serif; + color: #000; + font-weight: 400; + margin-top: 20px; + margin-bottom: 25px +} + +.notfound a { + font-family: lato,sans-serif; + padding: 10px 30px; + display: inline-block; + color: #000; + font-weight: 400; + text-transform: uppercase; + -webkit-box-shadow: 0 0 0 2px #000,2px 2px 0 2px #00ffc0; + box-shadow: 0 0 0 2px #000,2px 2px 0 2px #00ffc0; + text-decoration: none; + -webkit-transition: .2s all; + transition: .2s all +} + +.notfound a:hover { + background-color: #00ffc0; + -webkit-box-shadow: 0 0 0 0 #000,0 0 0 2px #00ffc0; + box-shadow: 0 0 0 0 #000,0 0 0 2px #00ffc0 +} + +.notfound-social { + margin-top: 35px +} + +.notfound-social>a { + width: 40px; + height: 40px; + line-height: 40px; + padding: 0; + margin: 0 5px +} + +.notfound-social>a:hover { + background-color: #00ffc0; + -webkit-box-shadow: 0 0 0 0 #000,0 0 0 2px #00ffc0; + box-shadow: 0 0 0 0 #000,0 0 0 2px #00ffc0 +} + +@media only screen and (max-width: 480px) { + .notfound .notfound-404 { + height:122px; + line-height: 122px + } + + .notfound .notfound-404 h1 { + font-size: 122px + } + + .notfound h2 { + font-size: 26px + } +} diff --git a/webapp/src/pages/WrongRoute/WrongRoute.js b/webapp/src/pages/WrongRoute/WrongRoute.js new file mode 100644 index 00000000..96b25bfb --- /dev/null +++ b/webapp/src/pages/WrongRoute/WrongRoute.js @@ -0,0 +1,28 @@ +import React from "react"; +import "./WrongRoute.css"; +import { Link } from 'react-router-dom'; + +const WrongRoute = () => { + return ( + + + + + + + + + + 404 + + Página no encontrada + + La página que estabas buscando no está disponible + + Página principal + + + ); +}; + +export default WrongRoute;
Your account was created on {new Date(createdAt).toLocaleDateString()}. -
+ Tu puntuación: {puntuacion}/{Preguntas.length} +
{preguntaActual.pregunta}
+ La página que estabas buscando no está disponible +