Skip to content

Commit 5af1c38

Browse files
authored
Merge pull request #2 from kpcode11/feat-UI
Developed auth page. developed landing page with subtle animations
2 parents b6b08eb + abac21c commit 5af1c38

41 files changed

Lines changed: 1410 additions & 1142 deletions

Some content is hidden

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

components.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@
1818
"lib": "@/lib",
1919
"hooks": "@/hooks"
2020
},
21-
"registries": {}
21+
"registries": {
22+
"@efferd": "https://efferd.com/r/{name}.json"
23+
}
2224
}

package-lock.json

Lines changed: 70 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
"@prisma/client": "^5.20.0",
1515
"@radix-ui/react-dialog": "^1.0.5",
1616
"@radix-ui/react-label": "^2.0.2",
17-
"@radix-ui/react-slot": "^1.0.2",
17+
"@radix-ui/react-slot": "^1.2.4",
1818
"@tanstack/react-query": "^5.90.19",
1919
"axios": "^1.13.2",
2020
"bcryptjs": "^2.4.3",
2121
"class-variance-authority": "^0.7.1",
2222
"clsx": "^2.1.1",
2323
"date-fns": "^3.6.0",
2424
"lucide-react": "^0.344.0",
25+
"motion": "^12.28.1",
2526
"next": "^14.2.0",
2627
"next-auth": "^4.24.0",
2728
"react": "^18.3.0",

src/app/(auth)/layout.tsx

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,4 @@ export default function AuthLayout({
99
</div>
1010
);
1111
}
12-
<input
13-
type="email"
14-
placeholder="Email"
15-
value={email}
16-
onChange={(e) => setEmail(e.target.value)}
17-
required
18-
className="border p-2 mb-4"
19-
/>
20-
<input
21-
type="password"
22-
placeholder="Password"
23-
value={password}
24-
onChange={(e) => setPassword(e.target.value)}
25-
required
26-
className="border p-2 mb-4"
27-
/>
28-
<Button type="submit">Login</Button>
29-
</Form>
30-
</div>
31-
);
32-
};
33-
34-
export default LoginPage;
12+

src/app/(auth)/login/page.tsx

Lines changed: 4 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,5 @@
1-
'use client';
1+
import { AuthPage } from "@/components/auth-page";
22

3-
import { useState } from 'react';
4-
import { signIn } from 'next-auth/react';
5-
import { useRouter } from 'next/navigation';
6-
import { Button } from '@/components/ui/button';
7-
8-
export default function LoginPage() {
9-
const router = useRouter();
10-
const [email, setEmail] = useState('');
11-
const [password, setPassword] = useState('');
12-
const [error, setError] = useState('');
13-
const [loading, setLoading] = useState(false);
14-
15-
const handleSubmit = async (e: React.FormEvent) => {
16-
e.preventDefault();
17-
setLoading(true);
18-
setError('');
19-
20-
try {
21-
const result = await signIn('credentials', {
22-
redirect: false,
23-
email,
24-
password,
25-
});
26-
27-
if (result?.error) {
28-
setError('Invalid email or password');
29-
} else {
30-
router.push('/admin');
31-
}
32-
} catch (err) {
33-
setError('An error occurred during login');
34-
} finally {
35-
setLoading(false);
36-
}
37-
};
38-
39-
return (
40-
<div className="flex min-h-screen items-center justify-center bg-gray-50">
41-
<div className="w-full max-w-md space-y-8 rounded-lg bg-white p-8 shadow-lg">
42-
<div className="text-center">
43-
<h1 className="text-3xl font-bold">Login</h1>
44-
<p className="mt-2 text-gray-600">Cureos Hospital Management System</p>
45-
</div>
46-
{error && (
47-
<div className="rounded-md bg-red-50 p-3 text-sm text-red-600">
48-
{error}
49-
</div>
50-
)}
51-
<form onSubmit={handleSubmit} className="mt-8 space-y-6">
52-
<div className="space-y-4">
53-
<div>
54-
<label htmlFor="email" className="block text-sm font-medium text-gray-700">
55-
Email
56-
</label>
57-
<input
58-
id="email"
59-
name="email"
60-
type="email"
61-
required
62-
value={email}
63-
onChange={(e) => setEmail(e.target.value)}
64-
className="mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-blue-500"
65-
placeholder="Enter your email"
66-
/>
67-
</div>
68-
<div>
69-
<label htmlFor="password" className="block text-sm font-medium text-gray-700">
70-
Password
71-
</label>
72-
<input
73-
id="password"
74-
name="password"
75-
type="password"
76-
required
77-
value={password}
78-
onChange={(e) => setPassword(e.target.value)}
79-
className="mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-blue-500"
80-
placeholder="Enter your password"
81-
/>
82-
</div>
83-
</div>
84-
<Button
85-
type="submit"
86-
disabled={loading}
87-
className="w-full"
88-
>
89-
{loading ? 'Signing in...' : 'Sign in'}
90-
</Button>
91-
</form>
92-
</div>
93-
</div>
94-
);
95-
}
3+
export default function Page() {
4+
return <AuthPage />;
5+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use client';
2+
3+
export default function ClaimsPage() {
4+
return (
5+
<div className="p-8">
6+
<h1 className="text-3xl font-bold">Insurance Claims</h1>
7+
<p className="mt-4 text-gray-600">Manage insurance claims here.</p>
8+
</div>
9+
);
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use client';
2+
3+
export default function PoliciesPage() {
4+
return (
5+
<div className="p-8">
6+
<h1 className="text-3xl font-bold">Insurance Policies</h1>
7+
<p className="mt-4 text-gray-600">Manage insurance policies here.</p>
8+
</div>
9+
);
10+
}

src/app/(dashboard)/admin/page.tsx

Lines changed: 7 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,12 @@
1-
src/app/(auth)/login/page.tsx:
1+
'use client';
22

3-
import React, { useState } from 'react';
4-
import { useRouter } from 'next/router';
5-
import { Button } from '@/components/ui/button';
6-
import { Form } from '@/components/ui/form';
7-
import { useAuth } from '@/lib/auth';
8-
9-
const LoginPage = () => {
10-
const router = useRouter();
11-
const { login } = useAuth();
12-
const [email, setEmail] = useState('');
13-
const [password, setPassword] = useState('');
14-
const [error, setError] = useState('');
15-
16-
const handleSubmit = async (e: React.FormEvent) => {
17-
e.preventDefault();
18-
try {
19-
await login(email, password);
20-
router.push('/dashboard/doctor'); // Redirect to the doctor's dashboard after login
21-
} catch (err) {
22-
setError('Invalid email or password');
23-
}
24-
};
3+
import React from 'react';
254

5+
export default function AdminPage() {
266
return (
27-
<div className="flex flex-col items-center justify-center h-screen">
28-
<h1 className="text-2xl font-bold">Login</h1>
29-
{error && <p className="text-red-500">{error}</p>}
30-
<Form onSubmit={handleSubmit}>
31-
<div>
32-
<label htmlFor="email">Email</label>
33-
<input
34-
type="email"
35-
id="email"
36-
value={email}
37-
onChange={(e) => setEmail(e.target.value)}
38-
required
39-
/>
40-
</div>
41-
<div>
42-
<label htmlFor="password">Password</label>
43-
<input
44-
type="password"
45-
id="password"
46-
value={password}
47-
onChange={(e) => setPassword(e.target.value)}
48-
required
49-
/>
50-
</div>
51-
<Button type="submit">Login</Button>
52-
</Form>
7+
<div className="p-8">
8+
<h1 className="text-3xl font-bold">Admin Dashboard</h1>
9+
<p className="mt-4 text-gray-600">Welcome to the admin dashboard.</p>
5310
</div>
5411
);
55-
};
56-
57-
export default LoginPage;
12+
}

0 commit comments

Comments
 (0)