Skip to content

Commit f9198e5

Browse files
committed
Create matching page
1 parent c198f2e commit f9198e5

File tree

2 files changed

+114
-0
lines changed

2 files changed

+114
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
"use client"
2+
3+
import { useState, useEffect } from "react"
4+
import { User, Code } from "lucide-react"
5+
6+
export default function LoadingPage() {
7+
const [elapsedTime, setElapsedTime] = useState(0)
8+
const [usersWaiting, setUsersWaiting] = useState(4)
9+
10+
useEffect(() => {
11+
const timer = setInterval(() => {
12+
setElapsedTime((prevTime) => prevTime + 1)
13+
}, 1000)
14+
15+
return () => clearInterval(timer)
16+
}, [])
17+
18+
return (
19+
<div className="min-h-screen bg-[#1a1f2e] text-gray-300 flex flex-col">
20+
<header className="p-4 flex justify-between items-center border-b border-gray-700">
21+
<div className="flex items-center space-x-2">
22+
<Code className="h-6 w-6" />
23+
<span className="text-lg font-semibold">PeerPrep</span>
24+
</div>
25+
<User className="h-6 w-6" />
26+
</header>
27+
<main className="flex-grow flex flex-col items-center justify-center px-4 space-y-6">
28+
<div className="animate-spin rounded-full h-16 w-16 border-t-4 border-b-4 border-purple-500"></div>
29+
<h1 className="text-2xl font-bold text-white">Finding a match</h1>
30+
<p className="text-sm text-center max-w-md">
31+
We&apos;re pairing you with another coder. This may take a few moments.
32+
</p>
33+
<div className="w-full max-w-md space-y-2">
34+
<div className="h-1 bg-gray-700 rounded-full overflow-hidden">
35+
<div
36+
className="h-full bg-purple-500 rounded-full"
37+
style={{ width: `${(elapsedTime % 60) / 60 * 100}%` }}
38+
></div>
39+
</div>
40+
<div className="text-sm text-center">
41+
Time elapsed: {elapsedTime} seconds
42+
</div>
43+
</div>
44+
<div className="flex items-center space-x-2 text-sm">
45+
<User className="h-4 w-4" />
46+
<span>{usersWaiting} users waiting</span>
47+
</div>
48+
<button className="px-4 py-2 bg-purple-600 text-white rounded-md hover:bg-purple-700 transition-colors w-full max-w-md">
49+
Cancel Matching
50+
</button>
51+
<p className="text-sm text-gray-500 mt-4">
52+
Tip: While you wait, why not review some coding concepts?
53+
</p>
54+
</main>
55+
</div>
56+
)
57+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
"use client"
2+
3+
import { useState, useEffect } from "react"
4+
import { User, Code } from "lucide-react"
5+
6+
export default function LoadingPage() {
7+
const [elapsedTime, setElapsedTime] = useState(0)
8+
const [usersWaiting, setUsersWaiting] = useState(4)
9+
10+
useEffect(() => {
11+
const timer = setInterval(() => {
12+
setElapsedTime((prevTime) => prevTime + 1)
13+
}, 1000)
14+
15+
return () => clearInterval(timer)
16+
}, [])
17+
18+
return (
19+
<div className="min-h-screen bg-[#1a1f2e] text-gray-300 flex flex-col">
20+
<header className="p-4 flex justify-between items-center border-b border-gray-700">
21+
<div className="flex items-center space-x-2">
22+
<Code className="h-6 w-6" />
23+
<span className="text-lg font-semibold">PeerPrep</span>
24+
</div>
25+
<User className="h-6 w-6" />
26+
</header>
27+
<main className="flex-grow flex flex-col items-center justify-center px-4 space-y-6">
28+
<div className="animate-spin rounded-full h-16 w-16 border-t-4 border-b-4 border-purple-500"></div>
29+
<h1 className="text-2xl font-bold text-white">Finding a match</h1>
30+
<p className="text-sm text-center max-w-md">
31+
We&apos;re pairing you with another coder. This may take a few moments.
32+
</p>
33+
<div className="w-full max-w-md space-y-2">
34+
<div className="h-1 bg-gray-700 rounded-full overflow-hidden">
35+
<div
36+
className="h-full bg-purple-500 rounded-full"
37+
style={{ width: `${(elapsedTime % 60) / 60 * 100}%` }}
38+
></div>
39+
</div>
40+
<div className="text-sm text-center">
41+
Time elapsed: {elapsedTime} seconds
42+
</div>
43+
</div>
44+
<div className="flex items-center space-x-2 text-sm">
45+
<User className="h-4 w-4" />
46+
<span>{usersWaiting} users waiting</span>
47+
</div>
48+
<button className="px-4 py-2 bg-purple-600 text-white rounded-md hover:bg-purple-700 transition-colors w-full max-w-md">
49+
Cancel Matching
50+
</button>
51+
<p className="text-sm text-gray-500 mt-4">
52+
Tip: While you wait, why not review some coding concepts?
53+
</p>
54+
</main>
55+
</div>
56+
)
57+
}

0 commit comments

Comments
 (0)