Skip to content

Commit 7d555a4

Browse files
committed
appointment frontend
1 parent f83add7 commit 7d555a4

62 files changed

Lines changed: 2391 additions & 575 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

frontend/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
"lint": "eslint"
1010
},
1111
"dependencies": {
12+
"@tanstack/react-query": "^5.90.21",
1213
"axios": "^1.13.5",
14+
"date-fns": "^4.1.0",
1315
"lucide-react": "^0.575.0",
1416
"next": "16.1.6",
1517
"react": "19.2.3",

frontend/pnpm-lock.yaml

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/public/staff.jpg

73.7 KB
Loading
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use client';
2+
3+
import { useAppointmentHistory } from '../../../../features/appointments/hooks/useAppointmentHistory';
4+
import AppointmentList from '../../../../features/appointments/components/AppointmentList';
5+
import { useCancelAppointment } from '@/src/features/appointments/hooks/useCancelAppointment';
6+
7+
export default function AppointmentsPage() {
8+
const { data, isLoading } = useAppointmentHistory();
9+
10+
if (isLoading) return <p>Loading...</p>;
11+
12+
return (
13+
<div>
14+
<h1 className="text-2xl font-bold mb-6">
15+
My Appointments
16+
</h1>
17+
18+
<AppointmentList appointments={data || []} />
19+
</div>
20+
);
21+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import BookingForm from '../../../../features/appointments/components/BookingForm';
2+
3+
export default function BookPage() {
4+
return (
5+
<div className="min-h-[calc(100vh-80px)] bg-gray-50 p-8">
6+
7+
{/* Page Header */}
8+
<div className="mb-8">
9+
<h1 className="text-3xl font-semibold text-gray-900">
10+
Book Appointment
11+
</h1>
12+
<p className="text-gray-500 mt-1">
13+
Choose a department, doctor and available time slot.
14+
</p>
15+
</div>
16+
17+
{/* Card Container */}
18+
<div className="bg-white rounded-2xl shadow-sm border border-gray-100 p-8 max-w-3xl">
19+
<BookingForm />
20+
</div>
21+
22+
</div>
23+
);
24+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
'use client';
2+
3+
import { useAuth } from '../../../auth/auth.provider';
4+
import { useRouter, usePathname } from 'next/navigation';
5+
import { useEffect } from 'react';
6+
import Link from 'next/link';
7+
8+
export default function PatientDashboardLayout({
9+
children,
10+
}: {
11+
children: React.ReactNode;
12+
}) {
13+
const { auth, logout } = useAuth();
14+
const router = useRouter();
15+
const pathname = usePathname();
16+
17+
useEffect(() => {
18+
if (!auth.isRestoring && !auth.accessToken) {
19+
router.replace('/login');
20+
}
21+
}, [auth.isRestoring, auth.accessToken, router]);
22+
23+
if (auth.isRestoring) return <div>Loading...</div>;
24+
if (!auth.accessToken) return null;
25+
26+
return (
27+
<div className="h-screen flex overflow-hidden">
28+
29+
{/* Sidebar */}
30+
<aside className="w-64 bg-white text-black p-6 flex flex-col justify-between">
31+
<div>
32+
<h2 className="text-lg font-bold mb-8">
33+
Patient Panel
34+
</h2>
35+
36+
<nav className="space-y-4">
37+
38+
<SidebarLink
39+
href="/dashboard"
40+
label="Dashboard"
41+
active={pathname === '/dashboard'}
42+
/>
43+
44+
<SidebarLink
45+
href="/dashboard/appointments"
46+
label="Appointments"
47+
active={pathname === '/dashboard/appointments'}
48+
/>
49+
50+
<SidebarLink
51+
href="/dashboard/book"
52+
label="Book Appointment"
53+
active={pathname === '/dashboard/book'}
54+
/>
55+
56+
</nav>
57+
</div>
58+
59+
<button
60+
onClick={logout}
61+
className="bg-red-500 hover:bg-red-600 px-4 py-2 rounded"
62+
>
63+
Logout
64+
</button>
65+
</aside>
66+
67+
{/* Right Content */}
68+
<main className="flex-1 bg-gray-100 overflow-y-auto p-8">
69+
{children}
70+
</main>
71+
</div>
72+
);
73+
}
74+
75+
function SidebarLink({
76+
href,
77+
label,
78+
active,
79+
}: {
80+
href: string;
81+
label: string;
82+
active: boolean;
83+
}) {
84+
return (
85+
<Link
86+
href={href}
87+
className='block px-3 py-2 rounded bg-white text-black font-semibold hover:border-2'
88+
>
89+
{label}
90+
</Link>
91+
);
92+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export default function DashboardHome() {
2+
return (
3+
<div>
4+
<h1 className="text-2xl font-bold mb-4">
5+
Welcome to your Dashboard
6+
</h1>
7+
8+
<p>
9+
Overview content goes here.
10+
</p>
11+
</div>
12+
);
13+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use client';
2+
3+
import { AuthProvider } from '@/src/auth/auth.provider';
4+
5+
export default function PatientRootLayout({
6+
children,
7+
}: {
8+
children: React.ReactNode;
9+
}) {
10+
return (
11+
<AuthProvider>
12+
{children}
13+
</AuthProvider>
14+
);
15+
}

0 commit comments

Comments
 (0)