Skip to content

Commit 2050d2b

Browse files
authored
Merge pull request #9 from CommonsHub/room-booking-dropdowns
Room booking: time/duration dropdowns
2 parents 3195420 + 21ec4c9 commit 2050d2b

1 file changed

Lines changed: 69 additions & 24 deletions

File tree

src/components/room-booking-form.tsx

Lines changed: 69 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,39 @@ import { Textarea } from "@/components/ui/textarea"
99
import { Checkbox } from "@/components/ui/checkbox"
1010
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
1111
import { Loader2, CheckCircle, Calendar } from "lucide-react"
12+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
1213
import { RoomMiniCalendar } from "@/components/room-mini-calendar"
1314

15+
// Time options: 8am to 9pm
16+
const TIME_OPTIONS = [
17+
{ value: "08:00", label: "8:00 AM" },
18+
{ value: "09:00", label: "9:00 AM" },
19+
{ value: "10:00", label: "10:00 AM" },
20+
{ value: "11:00", label: "11:00 AM" },
21+
{ value: "12:00", label: "12:00 PM" },
22+
{ value: "13:00", label: "1:00 PM" },
23+
{ value: "14:00", label: "2:00 PM" },
24+
{ value: "15:00", label: "3:00 PM" },
25+
{ value: "16:00", label: "4:00 PM" },
26+
{ value: "17:00", label: "5:00 PM" },
27+
{ value: "18:00", label: "6:00 PM" },
28+
{ value: "19:00", label: "7:00 PM" },
29+
{ value: "20:00", label: "8:00 PM" },
30+
{ value: "21:00", label: "9:00 PM" },
31+
]
32+
33+
// Duration options: 1h to 8h
34+
const DURATION_OPTIONS = [
35+
{ value: "1", label: "1 hour" },
36+
{ value: "2", label: "2 hours" },
37+
{ value: "3", label: "3 hours" },
38+
{ value: "4", label: "4 hours" },
39+
{ value: "5", label: "5 hours" },
40+
{ value: "6", label: "6 hours" },
41+
{ value: "7", label: "7 hours" },
42+
{ value: "8", label: "8 hours" },
43+
]
44+
1445
interface RoomBookingFormProps {
1546
roomId: string
1647
roomName: string
@@ -27,8 +58,8 @@ export function RoomBookingForm({ roomId, roomName, pricePerHour, tokensPerHour
2758
email: "",
2859
organisation: "",
2960
numberOfPeople: "",
30-
time: "",
31-
duration: "",
61+
time: "09:00",
62+
duration: "2",
3263
projector: false,
3364
whiteboard: false,
3465
facilitationKit: false,
@@ -99,8 +130,8 @@ export function RoomBookingForm({ roomId, roomName, pricePerHour, tokensPerHour
99130
email: "",
100131
organisation: "",
101132
numberOfPeople: "",
102-
time: "",
103-
duration: "",
133+
time: "09:00",
134+
duration: "2",
104135
projector: false,
105136
whiteboard: false,
106137
facilitationKit: false,
@@ -151,30 +182,44 @@ export function RoomBookingForm({ roomId, roomName, pricePerHour, tokensPerHour
151182
</div>
152183

153184
<div className="grid grid-cols-1 sm:grid-cols-3 gap-4">
154-
<div className="space-y-2">
155-
<Label htmlFor="time" className="block min-h-[2.5rem] flex items-start">Start Time *</Label>
156-
<Input
157-
id="time"
158-
type="time"
159-
required
185+
<div className="space-y-1">
186+
<Label htmlFor="time">Start Time *</Label>
187+
<Select
160188
value={formData.time}
161-
onChange={(e) => setFormData({ ...formData, time: e.target.value })}
162-
/>
189+
onValueChange={(value) => setFormData({ ...formData, time: value })}
190+
>
191+
<SelectTrigger id="time">
192+
<SelectValue placeholder="Select time" />
193+
</SelectTrigger>
194+
<SelectContent>
195+
{TIME_OPTIONS.map((opt) => (
196+
<SelectItem key={opt.value} value={opt.value}>
197+
{opt.label}
198+
</SelectItem>
199+
))}
200+
</SelectContent>
201+
</Select>
163202
</div>
164-
<div className="space-y-2">
165-
<Label htmlFor="duration" className="block min-h-[2.5rem] flex items-start">Duration (hours) *</Label>
166-
<Input
167-
id="duration"
168-
type="number"
169-
min="1"
170-
step="0.5"
171-
required
203+
<div className="space-y-1">
204+
<Label htmlFor="duration">Duration *</Label>
205+
<Select
172206
value={formData.duration}
173-
onChange={(e) => setFormData({ ...formData, duration: e.target.value })}
174-
/>
207+
onValueChange={(value) => setFormData({ ...formData, duration: value })}
208+
>
209+
<SelectTrigger id="duration">
210+
<SelectValue placeholder="Select duration" />
211+
</SelectTrigger>
212+
<SelectContent>
213+
{DURATION_OPTIONS.map((opt) => (
214+
<SelectItem key={opt.value} value={opt.value}>
215+
{opt.label}
216+
</SelectItem>
217+
))}
218+
</SelectContent>
219+
</Select>
175220
</div>
176-
<div className="space-y-2">
177-
<Label htmlFor="numberOfPeople" className="block min-h-[2.5rem] flex items-start">Number of People *</Label>
221+
<div className="space-y-1">
222+
<Label htmlFor="numberOfPeople">Number of People *</Label>
178223
<Input
179224
id="numberOfPeople"
180225
type="number"

0 commit comments

Comments
 (0)