Skip to content

Commit e434753

Browse files
committed
UI/UX: Improve booking flow, fix date bug, add responsiveness & stepper
- Improve overall UI and UX for Patient → BookAppointment. - Fix bug where incorrect appointment date was sent to the backend: • ensure selected calendar date is the single source of truth, • normalize/validate date & timezone before sending, • add unit tests for date handling. - Replace scrollable booking steps with a step-by-step wizard (accessible keyboard nav + progress indicator). - Make booking page responsive across breakpoints (mobile / tablet / desktop). - Add top navigation link to Doctor page. - Refactor and cleanup components in client/src/components/Patient/BookAppointment/. - Update styles, add ARIA attributes, and add basic E2E test for booking happy path. Closes #69. Related: #60.
1 parent 036378a commit e434753

11 files changed

Lines changed: 1592 additions & 344 deletions

File tree

client/src/components/Patient/BookAppointment/BookingForm.jsx

Lines changed: 306 additions & 87 deletions
Large diffs are not rendered by default.

client/src/components/Patient/BookAppointment/BookingSummary.jsx

Lines changed: 79 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,85 @@
1-
const BookingSummary = ({ selectedDate, selectedSlot, isTeleconsultation, consultationFee }) => {
1+
import { Calendar, Clock, FileText, Video, DollarSign } from 'lucide-react';
2+
3+
const BookingSummary = ({
4+
selectedDate,
5+
selectedSlot,
6+
reason,
7+
isTeleconsultation,
8+
consultationFee,
9+
}) => {
10+
const formatDate = (dateString) => {
11+
const date = new Date(dateString);
12+
return date.toLocaleDateString('en-US', {
13+
weekday: 'long',
14+
year: 'numeric',
15+
month: 'long',
16+
day: 'numeric',
17+
});
18+
};
19+
220
return (
3-
<div className="bg-gray-50 p-4 rounded-lg">
4-
<h4 className="font-medium text-gray-900 mb-2">Booking Summary</h4>
5-
<div className="text-sm space-y-1">
6-
<div className="flex justify-between">
7-
<span>Date:</span>
8-
<span>
9-
{new Date(selectedDate).toLocaleDateString('en-US', {
10-
weekday: 'long',
11-
year: 'numeric',
12-
month: 'long',
13-
day: 'numeric',
14-
})}
15-
</span>
16-
</div>
17-
<div className="flex justify-between">
18-
<span>Time:</span>
19-
<span>{selectedSlot}</span>
20-
</div>
21-
<div className="flex justify-between">
22-
<span>Type:</span>
23-
<span>{isTeleconsultation ? 'Teleconsultation' : 'In-person'}</span>
24-
</div>
25-
<div className="flex justify-between font-medium">
26-
<span>Fee:</span>
27-
<span>{consultationFee}</span>
21+
<div className="space-y-3">
22+
<div className="bg-gradient-to-br from-slate-50 to-gray-50 rounded-xl p-4 border-2 border-gray-200">
23+
<div className="space-y-3">
24+
<div className="flex items-start gap-3 pb-3 border-b border-gray-200">
25+
<Calendar className="w-5 h-5 text-slate-700 flex-shrink-0 mt-0.5" />
26+
<div className="flex-1">
27+
<div className="text-xs lg:text-sm font-semibold text-gray-600 mb-1">
28+
Appointment Date
29+
</div>
30+
<div className="text-sm lg:text-base text-gray-900 font-bold">
31+
{formatDate(selectedDate)}
32+
</div>
33+
</div>
34+
</div>
35+
36+
<div className="flex items-start gap-3 pb-3 border-b border-gray-200">
37+
<Clock className="w-5 h-5 text-slate-700 flex-shrink-0 mt-0.5" />
38+
<div className="flex-1">
39+
<div className="text-xs lg:text-sm font-semibold text-gray-600 mb-1">Time Slot</div>
40+
<div className="text-sm lg:text-base text-gray-900 font-bold">{selectedSlot}</div>
41+
</div>
42+
</div>
43+
44+
<div className="flex items-start gap-3 pb-3 border-b border-gray-200">
45+
<Video className="w-5 h-5 text-slate-700 flex-shrink-0 mt-0.5" />
46+
<div className="flex-1">
47+
<div className="text-xs lg:text-sm font-semibold text-gray-600 mb-1">
48+
Consultation Type
49+
</div>
50+
<div className="text-sm lg:text-base text-gray-900 font-bold">
51+
{isTeleconsultation ? '📹 Teleconsultation (Video Call)' : '🏥 In-Person Visit'}
52+
</div>
53+
</div>
54+
</div>
55+
56+
<div className="flex items-start gap-3 pb-3 border-b border-gray-200">
57+
<FileText className="w-5 h-5 text-slate-700 flex-shrink-0 mt-0.5" />
58+
<div className="flex-1">
59+
<div className="text-xs lg:text-sm font-semibold text-gray-600 mb-1">
60+
Reason for Visit
61+
</div>
62+
<div className="text-xs lg:text-sm text-gray-900 leading-relaxed">{reason}</div>
63+
</div>
64+
</div>
65+
66+
<div className="flex items-center justify-between pt-2 bg-white rounded-lg p-3 shadow-sm">
67+
<div className="flex items-center gap-2">
68+
<DollarSign className="w-5 h-5 text-slate-700" />
69+
<span className="text-xs lg:text-sm font-semibold text-gray-700">
70+
Consultation Fee
71+
</span>
72+
</div>
73+
<div className="text-xl lg:text-2xl font-bold text-gray-900">{consultationFee}</div>
74+
</div>
2875
</div>
2976
</div>
77+
78+
<div className="bg-blue-50 border-2 border-blue-200 rounded-xl p-3">
79+
<p className="text-xs lg:text-sm text-blue-900 leading-relaxed">
80+
✓ Please review all details carefully. You'll receive a confirmation after booking.
81+
</p>
82+
</div>
3083
</div>
3184
);
3285
};

0 commit comments

Comments
 (0)