blob: 8c4e8ddcfe02c20f0b181d4639337e7113f5a773 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
"use client";
import { useState } from "react";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
// Client component for selecting a lesson
function LessonSelector({ userId }: { userId: number }) {
const [lessonId, setLessonId] = useState<string>("");
return (
<div className="container mx-auto py-8">
<Card className="p-6 max-w-md mx-auto">
<h1 className="text-2xl font-bold mb-6">Start Study Session</h1>
<form action={`/study?lessonId=${lessonId}`}>
<div className="space-y-4">
<div>
<Label htmlFor="lessonId">Lesson ID</Label>
<Input
id="lessonId"
value={lessonId}
onChange={(e) => setLessonId(e.target.value)}
placeholder="Enter lesson ID"
type="number"
required
/>
</div>
<Button type="submit" className="w-full">
Start Study Session
</Button>
</div>
</form>
<div className="mt-6 pt-6 border-t border-gray-200">
<h2 className="text-lg font-medium mb-3">Available Lessons</h2>
<p className="text-sm text-gray-500 mb-4">
Here are some example lesson IDs you can use:
</p>
<div className="flex flex-wrap gap-2">
<Button
variant="outline"
size="sm"
onClick={() => setLessonId("1")}
>
Lesson 1
</Button>
<Button
variant="outline"
size="sm"
onClick={() => setLessonId("2")}
>
Lesson 2
</Button>
<Button
variant="outline"
size="sm"
onClick={() => setLessonId("5")}
>
Lesson 5
</Button>
</div>
<div className="mt-4">
<Button variant="ghost" size="sm" asChild className="text-blue-500">
<a href="/">Back to Home</a>
</Button>
</div>
</div>
</Card>
</div>
);
}
export default LessonSelector;
|