From c198f2edfa16712041143d22fdf2d7f59a6f3a0b Mon Sep 17 00:00:00 2001 From: leesiyuan Date: Sat, 19 Oct 2024 12:56:24 +0800 Subject: [PATCH 1/5] Update FilterBar.tsx Remove unnecessary settings and duplicate match --- .../(main)/components/filter/FilterBar.tsx | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/peerprep-fe/src/app/(main)/components/filter/FilterBar.tsx b/peerprep-fe/src/app/(main)/components/filter/FilterBar.tsx index bb6ef52337..61e1c5e7f6 100644 --- a/peerprep-fe/src/app/(main)/components/filter/FilterBar.tsx +++ b/peerprep-fe/src/app/(main)/components/filter/FilterBar.tsx @@ -1,7 +1,5 @@ 'use client'; -import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; -import { Settings } from 'lucide-react'; import { FilterSelect } from './FilterSelect'; import { FilterBadge } from './FilterBadge'; import { TopicsPopover } from './TopicsPopover'; @@ -70,25 +68,6 @@ export default function FilterBar({ onChange={handleSearch} /> - - {!isAdmin ? ( - - ) : ( - - )}
{filters.difficulty && ( From f9198e5f649fc53fec5e96365d06a9e2b4b511f4 Mon Sep 17 00:00:00 2001 From: leesiyuan Date: Sat, 19 Oct 2024 12:56:35 +0800 Subject: [PATCH 2/5] Create matching page --- peerprep-fe/src/app/(main)/match/page.tsx | 57 +++++++++++++++++++++++ peerprep-fe/src/app/admin/match/page.tsx | 57 +++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 peerprep-fe/src/app/(main)/match/page.tsx create mode 100644 peerprep-fe/src/app/admin/match/page.tsx diff --git a/peerprep-fe/src/app/(main)/match/page.tsx b/peerprep-fe/src/app/(main)/match/page.tsx new file mode 100644 index 0000000000..cd0dcba7b6 --- /dev/null +++ b/peerprep-fe/src/app/(main)/match/page.tsx @@ -0,0 +1,57 @@ +"use client" + +import { useState, useEffect } from "react" +import { User, Code } from "lucide-react" + +export default function LoadingPage() { + const [elapsedTime, setElapsedTime] = useState(0) + const [usersWaiting, setUsersWaiting] = useState(4) + + useEffect(() => { + const timer = setInterval(() => { + setElapsedTime((prevTime) => prevTime + 1) + }, 1000) + + return () => clearInterval(timer) + }, []) + + return ( +
+
+
+ + PeerPrep +
+ +
+
+
+

Finding a match

+

+ We're pairing you with another coder. This may take a few moments. +

+
+
+
+
+
+ Time elapsed: {elapsedTime} seconds +
+
+
+ + {usersWaiting} users waiting +
+ +

+ Tip: While you wait, why not review some coding concepts? +

+
+
+ ) +} \ No newline at end of file diff --git a/peerprep-fe/src/app/admin/match/page.tsx b/peerprep-fe/src/app/admin/match/page.tsx new file mode 100644 index 0000000000..cd0dcba7b6 --- /dev/null +++ b/peerprep-fe/src/app/admin/match/page.tsx @@ -0,0 +1,57 @@ +"use client" + +import { useState, useEffect } from "react" +import { User, Code } from "lucide-react" + +export default function LoadingPage() { + const [elapsedTime, setElapsedTime] = useState(0) + const [usersWaiting, setUsersWaiting] = useState(4) + + useEffect(() => { + const timer = setInterval(() => { + setElapsedTime((prevTime) => prevTime + 1) + }, 1000) + + return () => clearInterval(timer) + }, []) + + return ( +
+
+
+ + PeerPrep +
+ +
+
+
+

Finding a match

+

+ We're pairing you with another coder. This may take a few moments. +

+
+
+
+
+
+ Time elapsed: {elapsedTime} seconds +
+
+
+ + {usersWaiting} users waiting +
+ +

+ Tip: While you wait, why not review some coding concepts? +

+
+
+ ) +} \ No newline at end of file From e8737755cc47f0a627006bdfaa530202327a8129 Mon Sep 17 00:00:00 2001 From: leesiyuan Date: Sat, 19 Oct 2024 13:02:22 +0800 Subject: [PATCH 3/5] Remove admin match page Admin should not be able to match --- peerprep-fe/src/app/admin/match/page.tsx | 57 ------------------------ 1 file changed, 57 deletions(-) delete mode 100644 peerprep-fe/src/app/admin/match/page.tsx diff --git a/peerprep-fe/src/app/admin/match/page.tsx b/peerprep-fe/src/app/admin/match/page.tsx deleted file mode 100644 index cd0dcba7b6..0000000000 --- a/peerprep-fe/src/app/admin/match/page.tsx +++ /dev/null @@ -1,57 +0,0 @@ -"use client" - -import { useState, useEffect } from "react" -import { User, Code } from "lucide-react" - -export default function LoadingPage() { - const [elapsedTime, setElapsedTime] = useState(0) - const [usersWaiting, setUsersWaiting] = useState(4) - - useEffect(() => { - const timer = setInterval(() => { - setElapsedTime((prevTime) => prevTime + 1) - }, 1000) - - return () => clearInterval(timer) - }, []) - - return ( -
-
-
- - PeerPrep -
- -
-
-
-

Finding a match

-

- We're pairing you with another coder. This may take a few moments. -

-
-
-
-
-
- Time elapsed: {elapsedTime} seconds -
-
-
- - {usersWaiting} users waiting -
- -

- Tip: While you wait, why not review some coding concepts? -

-
-
- ) -} \ No newline at end of file From 81da6efd3a1a957ecde4fe8530d9eb65a5b7484d Mon Sep 17 00:00:00 2001 From: leesiyuan Date: Sat, 19 Oct 2024 13:02:47 +0800 Subject: [PATCH 4/5] Update button Admin should be able to add question while non admins can match with others --- peerprep-fe/src/components/navbar/Navbar.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/peerprep-fe/src/components/navbar/Navbar.tsx b/peerprep-fe/src/components/navbar/Navbar.tsx index 184d6a3771..59df51bcee 100644 --- a/peerprep-fe/src/components/navbar/Navbar.tsx +++ b/peerprep-fe/src/components/navbar/Navbar.tsx @@ -38,9 +38,14 @@ export default function Navbar() { Questions - - Match - + {/* Admin users should be able to add questions instead of match */} + {user?.isAdmin ? + + Match + : + + Add Question + } {isAuth ? ( From 2fd8e223144dd8d42063ee2f8220e7b30255c779 Mon Sep 17 00:00:00 2001 From: leesiyuan Date: Sat, 19 Oct 2024 13:06:47 +0800 Subject: [PATCH 5/5] Update Navbar.tsx Update logic for isAdmin field --- peerprep-fe/src/components/navbar/Navbar.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/peerprep-fe/src/components/navbar/Navbar.tsx b/peerprep-fe/src/components/navbar/Navbar.tsx index 59df51bcee..c6a072b1aa 100644 --- a/peerprep-fe/src/components/navbar/Navbar.tsx +++ b/peerprep-fe/src/components/navbar/Navbar.tsx @@ -30,7 +30,7 @@ export default function Navbar() { PeerPrep
- {user?.isAdmin && ( + {user!.isAdmin && ( Admin @@ -39,7 +39,7 @@ export default function Navbar() { Questions {/* Admin users should be able to add questions instead of match */} - {user?.isAdmin ? + {!user!.isAdmin ? Match :