Skip to content

Commit 5f808eb

Browse files
authored
Merge pull request #59 from aryadharmadhikari/redesign/sign-up
Refactor(auth): Redesign Sign-Up Form UI and Maintainability
2 parents f5061a1 + f41c7aa commit 5f808eb

File tree

7 files changed

+231
-254
lines changed

7 files changed

+231
-254
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
# production
2626
/build
2727

28+
#Code Editor/IDE files
29+
/.idea/
30+
2831
# misc
2932
.DS_Store
3033
*.pem

LEADERBOARD.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
21
# GitHub Leaderboard
32

43
🏆 **Welcome to the Official Leaderboard!** 🏆
54

65
Celebrate the remarkable contributions of our top contributors.
76

8-
| S/N | Rank || Contributor | Merged PRs |
9-
|--| ---- | -- |----------- | ---------- |
10-
| 1 | 🥇 | <img src='https://avatars.githubusercontent.com/u/131811805?v=4' alt='Avatar' width='30' height='30'> | [Seyi-Amusan](https://github.com/Seyi-Amusan) | 11 |
11-
| 2 | 🥈 | <img src='https://avatars.githubusercontent.com/u/116392457?v=4' alt='Avatar' width='30' height='30'> | [alexgrate](https://github.com/alexgrate) | 6 |
12-
| 3 | 🥉 | <img src='https://avatars.githubusercontent.com/u/193773700?v=4' alt='Avatar' width='30' height='30'> | [aryadharmadhikari](https://github.com/aryadharmadhikari) | 3 |
13-
| 4 | 🥉 | <img src='https://avatars.githubusercontent.com/u/101010436?v=4' alt='Avatar' width='30' height='30'> | [MichaelOmoniyi](https://github.com/MichaelOmoniyi) | 3 |
14-
| 5 | 4 | <img src='https://avatars.githubusercontent.com/u/73708569?v=4' alt='Avatar' width='30' height='30'> | [Jonniie](https://github.com/Jonniie) | 1 |
15-
| 6 | 4 | <img src='https://avatars.githubusercontent.com/u/168524066?v=4' alt='Avatar' width='30' height='30'> | [kumaradarsh2](https://github.com/kumaradarsh2) | 1 |
7+
| S/N | Rank | | Contributor | Merged PRs |
8+
| --- | ---- | ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | ---------- |
9+
| 1 | 🥇 | <img src='https://avatars.githubusercontent.com/u/131811805?v=4' alt='Avatar' width='30' height='30'> | [Seyi-Amusan](https://github.com/Seyi-Amusan) | 11 |
10+
| 2 | 🥈 | <img src='https://avatars.githubusercontent.com/u/116392457?v=4' alt='Avatar' width='30' height='30'> | [alexgrate](https://github.com/alexgrate) | 6 |
11+
| 3 | 🥉 | <img src='https://avatars.githubusercontent.com/u/193773700?v=4' alt='Avatar' width='30' height='30'> | [aryadharmadhikari](https://github.com/aryadharmadhikari) | 3 |
12+
| 4 | 🥉 | <img src='https://avatars.githubusercontent.com/u/101010436?v=4' alt='Avatar' width='30' height='30'> | [MichaelOmoniyi](https://github.com/MichaelOmoniyi) | 3 |
13+
| 5 | 4 | <img src='https://avatars.githubusercontent.com/u/73708569?v=4' alt='Avatar' width='30' height='30'> | [Jonniie](https://github.com/Jonniie) | 1 |
14+
| 6 | 4 | <img src='https://avatars.githubusercontent.com/u/168524066?v=4' alt='Avatar' width='30' height='30'> | [kumaradarsh2](https://github.com/kumaradarsh2) | 1 |
1615

1716
A heartfelt **thank you** to all our fantastic contributors for their hard work and dedication! Together, we're making a difference in the open-source community.
1817

1918
---
2019

21-
*Want to see your name on the leaderboard? Contribute to our project on [GitHub](https://github.com/mlsanigeria/speak-to-docs) and make an impact!*
22-
20+
_Want to see your name on the leaderboard? Contribute to our project on [GitHub](https://github.com/mlsanigeria/speak-to-docs) and make an impact!_

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,19 @@ Watch our info session on how to get started with Hacktoberfest and contribute t
8888
We maintain a leaderboard to track your contributions and their impact on our projects. The more you contribute, the higher you'll climb on the leaderboard.
8989

9090
<!-- Section Start -->
91+
9192
### Top 10 Contributors
9293

9394
Thank you to all our fantastic contributors for their hard work and dedication! Here are our top 10 contributors:
9495

95-
| S/N | Rank || Contributor | Merged PRs |
96-
|--| ---- | -- |----------- | ---------- |
97-
| 1 | 🥇 | <img src='https://avatars.githubusercontent.com/u/131811805?v=4' alt='Avatar' width='30' height='30'> | [Seyi-Amusan](https://github.com/Seyi-Amusan) | 11 |
98-
| 2 | 🥈 | <img src='https://avatars.githubusercontent.com/u/116392457?v=4' alt='Avatar' width='30' height='30'> | [alexgrate](https://github.com/alexgrate) | 6 |
99-
| 3 | 🥉 | <img src='https://avatars.githubusercontent.com/u/193773700?v=4' alt='Avatar' width='30' height='30'> | [aryadharmadhikari](https://github.com/aryadharmadhikari) | 3 |
100-
| 4 | 🥉 | <img src='https://avatars.githubusercontent.com/u/101010436?v=4' alt='Avatar' width='30' height='30'> | [MichaelOmoniyi](https://github.com/MichaelOmoniyi) | 3 |
101-
| 5 | 4 | <img src='https://avatars.githubusercontent.com/u/73708569?v=4' alt='Avatar' width='30' height='30'> | [Jonniie](https://github.com/Jonniie) | 1 |
102-
| 6 | 4 | <img src='https://avatars.githubusercontent.com/u/168524066?v=4' alt='Avatar' width='30' height='30'> | [kumaradarsh2](https://github.com/kumaradarsh2) | 1 |
96+
| S/N | Rank | | Contributor | Merged PRs |
97+
| --- | ---- | ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | ---------- |
98+
| 1 | 🥇 | <img src='https://avatars.githubusercontent.com/u/131811805?v=4' alt='Avatar' width='30' height='30'> | [Seyi-Amusan](https://github.com/Seyi-Amusan) | 11 |
99+
| 2 | 🥈 | <img src='https://avatars.githubusercontent.com/u/116392457?v=4' alt='Avatar' width='30' height='30'> | [alexgrate](https://github.com/alexgrate) | 6 |
100+
| 3 | 🥉 | <img src='https://avatars.githubusercontent.com/u/193773700?v=4' alt='Avatar' width='30' height='30'> | [aryadharmadhikari](https://github.com/aryadharmadhikari) | 3 |
101+
| 4 | 🥉 | <img src='https://avatars.githubusercontent.com/u/101010436?v=4' alt='Avatar' width='30' height='30'> | [MichaelOmoniyi](https://github.com/MichaelOmoniyi) | 3 |
102+
| 5 | 4 | <img src='https://avatars.githubusercontent.com/u/73708569?v=4' alt='Avatar' width='30' height='30'> | [Jonniie](https://github.com/Jonniie) | 1 |
103+
| 6 | 4 | <img src='https://avatars.githubusercontent.com/u/168524066?v=4' alt='Avatar' width='30' height='30'> | [kumaradarsh2](https://github.com/kumaradarsh2) | 1 |
103104

104105
Thank you to all our fantastic contributors for their hard work and dedication!
105106

src/app/signup/page.tsx

Lines changed: 8 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,14 @@
1-
"use client";
1+
// src/app/signup/page.tsx
2+
import { SignUpForm } from "@/components/features/signup/signup-form";
3+
import { Suspense } from "react"; // Needed if using useSearchParams in SignUpForm
24

3-
import { useState, Suspense } from "react";
4-
import { useRouter, useSearchParams } from "next/navigation";
5-
6-
function SignupFormContent() {
7-
const router = useRouter();
8-
const searchParams = useSearchParams();
9-
const [form, setForm] = useState({
10-
firstname: "",
11-
lastname: "",
12-
username: "",
13-
email: "",
14-
password: "",
15-
});
16-
const [message, setMessage] = useState("");
17-
18-
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
19-
setForm({ ...form, [e.target.name]: e.target.value });
20-
};
21-
22-
const handleSubmit = async (e: React.FormEvent) => {
23-
e.preventDefault();
24-
setMessage("Creating account...");
25-
26-
try {
27-
const response = await fetch(
28-
"https://naija-nutri-hub.azurewebsites.net/sign-up",
29-
{
30-
method: "POST",
31-
headers: { "Content-Type": "application/json" },
32-
body: JSON.stringify(form),
33-
},
34-
);
35-
36-
const data = await response.json();
37-
38-
if (response.ok) {
39-
setMessage("Sign up successful! Redirecting...");
40-
localStorage.setItem("pendingEmail", form.email);
41-
42-
router.push(`/verify-account?email=${encodeURIComponent(form.email)}`);
43-
} else {
44-
setMessage(`Sign up failed: ${data.message || "Try again."}`);
45-
}
46-
} catch (error) {
47-
console.error(error);
48-
setMessage("Network error. Please try again.");
49-
}
50-
};
51-
52-
return (
53-
<div className="flex items-center justify-center min-h-screen bg-neutral-900 text-white px-4">
54-
<form
55-
onSubmit={handleSubmit}
56-
className="flex flex-col gap-4 w-full max-w-md bg-neutral-800 p-8 rounded-2xl shadow-lg"
57-
>
58-
<h2 className="text-2xl font-semibold text-center mb-4 text-[#FF7A50]">
59-
Create Your Account
60-
</h2>
61-
62-
<input
63-
name="firstname"
64-
placeholder="First Name"
65-
onChange={handleChange}
66-
required
67-
className="p-3 rounded-md bg-neutral-700 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-[#FF7A50]"
68-
/>
69-
<input
70-
name="lastname"
71-
placeholder="Last Name"
72-
onChange={handleChange}
73-
required
74-
className="p-3 rounded-md bg-neutral-700 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-[#FF7A50]"
75-
/>
76-
<input
77-
name="username"
78-
placeholder="Username"
79-
onChange={handleChange}
80-
required
81-
className="p-3 rounded-md bg-neutral-700 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-[#FF7A50]"
82-
/>
83-
<input
84-
name="email"
85-
type="email"
86-
placeholder="Email"
87-
onChange={handleChange}
88-
required
89-
className="p-3 rounded-md bg-neutral-700 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-[#FF7A50]"
90-
/>
91-
<input
92-
name="password"
93-
type="password"
94-
placeholder="Password"
95-
onChange={handleChange}
96-
required
97-
className="p-3 rounded-md bg-neutral-700 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-[#FF7A50]"
98-
/>
99-
100-
<button
101-
type="submit"
102-
className="bg-[#FF7A50] hover:bg-[#ff885f] text-white font-semibold py-3 rounded-md transition-all"
103-
>
104-
Sign Up
105-
</button>
106-
107-
{message && (
108-
<p className="mt-3 text-center text-sm text-gray-300">{message}</p>
109-
)}
110-
</form>
111-
</div>
112-
);
113-
}
114-
115-
export default function SignupForm() {
5+
export default function SignUpPage() {
1166
return (
7+
// Wrap in Suspense if SignUpForm reads search params
1178
<Suspense fallback={<div>Loading...</div>}>
118-
<SignupFormContent />
9+
<div className="flex items-center justify-center min-h-screen">
10+
<SignUpForm />
11+
</div>
11912
</Suspense>
12013
);
12114
}

0 commit comments

Comments
 (0)