From 02d76e4c3c667c9aa702a82a335dc1f239dac3cc Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Thu, 20 Apr 2023 22:43:30 +0100 Subject: [PATCH] Created the stats page where a user can select another user to view their stats; Improved the whole stats and the home page --- package.json | 2 + src/components/Exercises/Speaking.tsx | 2 +- src/components/Navbar.tsx | 2 +- src/components/UserResultChart.tsx | 15 +- src/hooks/useStats.tsx | 6 +- src/interfaces/user.ts | 2 +- src/pages/api/stats/[user].ts | 29 ++++ src/pages/exam/index.tsx | 5 + src/pages/index.tsx | 37 +++-- src/pages/stats.tsx | 126 ++++++++++++++++ src/pages/users.tsx | 4 +- src/utils/stats.ts | 58 ++++---- yarn.lock | 197 +++++++++++++++++--------- 13 files changed, 361 insertions(+), 124 deletions(-) create mode 100644 src/pages/api/stats/[user].ts create mode 100644 src/pages/stats.tsx diff --git a/package.json b/package.json index d732b887..90b6da33 100644 --- a/package.json +++ b/package.json @@ -40,10 +40,12 @@ "react-toastify": "^9.1.2", "swr": "^2.1.3", "typescript": "4.9.5", + "uuid": "^9.0.0", "zustand": "^4.3.6" }, "devDependencies": { "@types/lodash": "^4.14.191", + "@types/uuid": "^9.0.1", "@wixc3/react-board": "^2.2.0", "autoprefixer": "^10.4.13", "postcss": "^8.4.21", diff --git a/src/components/Exercises/Speaking.tsx b/src/components/Exercises/Speaking.tsx index 5d45b4d8..29b77a38 100644 --- a/src/components/Exercises/Speaking.tsx +++ b/src/components/Exercises/Speaking.tsx @@ -41,7 +41,7 @@ export default function Speaking({id, title, text, type, prompts, onNext, onBack