diff --git a/package-lock.json b/package-lock.json index 75d8a03..7ad058c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "dependencies": { "@fvilers/disable-react-devtools": "^1.3.0", "@hookform/resolvers": "^3.3.4", - "@tanstack/query-core": "^5.17.10", "@tanstack/react-query": "^5.17.9", "@tanstack/react-query-devtools": "^5.17.9", "axios": "^1.6.5", @@ -22,9 +21,7 @@ "react-hook-form": "^7.49.2", "react-hot-toast": "^2.4.1", "react-router-dom": "^6.21.1", - "react-spinners": "^0.13.8", "tailwind-merge": "^2.2.0", - "wonka": "^6.3.4", "zod": "^3.22.4" }, "devDependencies": { @@ -790,9 +787,8 @@ } }, "node_modules/@tanstack/query-core": { - "version": "5.17.10", - "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.17.10.tgz", - "integrity": "sha512-bJ2oQUDBftvHcEkLS3gyzzShSeZpJyzNNRu8oHK13iNdsofyaDXtNO/c1Zy/PZYVX+PhqOXwoT42gMiEMRSSfQ==", + "version": "5.17.9", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/tannerlinsley" @@ -835,15 +831,6 @@ "react": "^18.0.0" } }, - "node_modules/@tanstack/react-query/node_modules/@tanstack/query-core": { - "version": "5.17.9", - "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.17.9.tgz", - "integrity": "sha512-8xcvpWIPaRMDNLMvG9ugcUJMgFK316ZsqkPPbsI+TMZsb10N9jk0B6XgPk4/kgWC2ziHyWR7n7wUhxmD0pChQw==", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/tannerlinsley" - } - }, "node_modules/@types/babel__core": { "version": "7.20.5", "dev": true, @@ -901,12 +888,12 @@ }, "node_modules/@types/prop-types": { "version": "15.7.11", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/@types/react": { "version": "18.2.47", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "@types/prop-types": "*", @@ -924,7 +911,7 @@ }, "node_modules/@types/scheduler": { "version": "0.16.8", - "dev": true, + "devOptional": true, "license": "MIT" }, "node_modules/@types/semver": { @@ -1500,7 +1487,6 @@ }, "node_modules/csstype": { "version": "3.1.3", - "dev": true, "license": "MIT" }, "node_modules/debug": { @@ -2344,8 +2330,7 @@ }, "node_modules/jotai-tanstack-query": { "version": "0.8.1", - "resolved": "https://registry.npmjs.org/jotai-tanstack-query/-/jotai-tanstack-query-0.8.1.tgz", - "integrity": "sha512-pwovDx7tnMR+YzJv05sJykisXEDVD5b400NUCVMM3VvXq9aR9EnwUvSPF8/fqaULDgMmua168gWoe3QpuF5DkQ==", + "license": "MIT", "peerDependencies": { "@tanstack/query-core": "*", "jotai": ">=1.11.0", @@ -3068,15 +3053,6 @@ "react-dom": ">=16.8" } }, - "node_modules/react-spinners": { - "version": "0.13.8", - "resolved": "https://registry.npmjs.org/react-spinners/-/react-spinners-0.13.8.tgz", - "integrity": "sha512-3e+k56lUkPj0vb5NDXPVFAOkPC//XyhKPJjvcGjyMNPWsBKpplfeyialP74G7H7+It7KzhtET+MvGqbKgAqpZA==", - "peerDependencies": { - "react": "^16.0.0 || ^17.0.0 || ^18.0.0", - "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0" - } - }, "node_modules/read-cache": { "version": "1.0.0", "dev": true, @@ -3710,8 +3686,7 @@ }, "node_modules/wonka": { "version": "6.3.4", - "resolved": "https://registry.npmjs.org/wonka/-/wonka-6.3.4.tgz", - "integrity": "sha512-CjpbqNtBGNAeyNS/9W6q3kSkKE52+FjIj7AkFlLr11s/VWGUu6a2CdYSdGxocIhIVjaW/zchesBQUKPVU69Cqg==" + "license": "MIT" }, "node_modules/wrap-ansi": { "version": "8.1.0", diff --git a/package.json b/package.json index 0be97ea..63520ef 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ "dependencies": { "@fvilers/disable-react-devtools": "^1.3.0", "@hookform/resolvers": "^3.3.4", - "@tanstack/query-core": "^5.17.10", "@tanstack/react-query": "^5.17.9", "@tanstack/react-query-devtools": "^5.17.9", "axios": "^1.6.5", @@ -25,9 +24,7 @@ "react-hook-form": "^7.49.2", "react-hot-toast": "^2.4.1", "react-router-dom": "^6.21.1", - "react-spinners": "^0.13.8", "tailwind-merge": "^2.2.0", - "wonka": "^6.3.4", "zod": "^3.22.4" }, "devDependencies": { @@ -49,4 +46,4 @@ "typescript": "^5.3.3", "vite": "^5.0.11" } -} +} \ No newline at end of file diff --git a/src/atoms/quiz.ts b/src/atoms/quiz.ts deleted file mode 100644 index 3114170..0000000 --- a/src/atoms/quiz.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { api } from "@/api/axios"; -import { QuizResponse } from "@/api/types/quiz"; -import { atom } from "jotai"; -import { atomWithQuery } from "jotai-tanstack-query"; - -interface updateParamsAtom { - newName: string | undefined; - newSlug: string | undefined; -} - -interface updateCurrTermProps { - value: number; - length: number; -} - -export const userNameAtom = atom(""); -export const quizSlugAtom = atom(""); -export const currTermAtom = atom(0); - -export const quizNameAtom = atom( - get => get(quizAtom).data?.data.name ?? "Go Back" -); - -export const quizLengthAtom = atom( - get => get(quizAtom).data?.data.questions.length ?? 0 -); - -export const quizAtom = atomWithQuery(get => ({ - queryKey: ["quiz", get(userNameAtom), get(quizSlugAtom)], - queryFn: () => - api.get( - `/api/v1/Quiz/${get(userNameAtom)}/${get(quizSlugAtom)}` - ), -})); - -export const updateParamsAtom = atom( - null, - (get, set, { newName, newSlug }: updateParamsAtom) => { - if (newName !== get(userNameAtom) || newSlug !== get(quizSlugAtom)) { - set(userNameAtom, newName); - set(quizSlugAtom, newSlug); - set(currTermAtom, 0); - } - } -); - -export const updateCurrTermAtom = atom( - null, - (get, set, { value, length }: updateCurrTermProps) => { - const prev = get(currTermAtom); - value > 0 - ? prev === length - 1 - ? set(currTermAtom, 0) - : set(currTermAtom, prev + 1) - : prev === 0 - ? set(currTermAtom, length - 1) - : set(currTermAtom, prev - 1); - } -); diff --git a/src/components/App.tsx b/src/components/App.tsx index e24dae1..966e7c3 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -11,11 +11,7 @@ import Verified from "./pages/Auth/Verified"; import Home from "./pages/Home/Home"; import PersistLogin from "./router/PersistLogin"; import Flashcards from "./pages/Quiz/Flashcards/Flashcards"; -import NotFound from "./pages/Status/NotFound/NotFound"; -import QuizLayout from "./layout/QuizLayout"; -import Error from "./pages/Status/Error"; -import Loading from "./pages/Status/Loading"; -import Unauthorized from "./pages/Status/Unauthorized"; +import NotFound from "./pages/Status/NotFound"; export default function App() { return ( @@ -36,21 +32,10 @@ export default function App() { } /> - {/* } /> */} - } /> - } /> - } /> - } /> - - - }> - } /> - } - /> - } /> + } /> + } /> + } /> ); diff --git a/src/components/layout/Background/Background.tsx b/src/components/layout/Background/Background.tsx deleted file mode 100644 index 8bcb250..0000000 --- a/src/components/layout/Background/Background.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import Left from "./Left"; -import Right from "./Right"; - -export default function Background() { - return ( - <> -
- - - - ); -} diff --git a/src/components/layout/Background/Left.tsx b/src/components/layout/Background/Left.tsx deleted file mode 100644 index e2b865e..0000000 --- a/src/components/layout/Background/Left.tsx +++ /dev/null @@ -1,31 +0,0 @@ -export default function Left() { - return ( - - - - - - - - - - ); -} diff --git a/src/components/layout/Background/Right.tsx b/src/components/layout/Background/Right.tsx deleted file mode 100644 index a8825e9..0000000 --- a/src/components/layout/Background/Right.tsx +++ /dev/null @@ -1,47 +0,0 @@ -export default function Right() { - return ( - - - - - - - - - - - - - - - ); -} diff --git a/src/components/layout/Header/QuizHeader.tsx b/src/components/layout/Header/QuizHeader.tsx index 3533d50..60d20a1 100644 --- a/src/components/layout/Header/QuizHeader.tsx +++ b/src/components/layout/Header/QuizHeader.tsx @@ -1,33 +1,30 @@ import MainLogo from "@/assets/images/light.png"; import { X } from "lucide-react"; -import { Link, useNavigate } from "react-router-dom"; +import { Link } from "react-router-dom"; import DarkModeButton from "./DarkModeButton"; import Logo from "./Logo"; -import { useAtomValue } from "jotai"; -import { quizNameAtom } from "@/atoms/quiz"; -export default function QuizHeader() { - const navigate = useNavigate(); - const name = useAtomValue(quizNameAtom); +interface QuizHeaderProps { + name: string; +} +export default function QuizHeader({ name }: QuizHeaderProps) { return (