ui: comment unused ui in login - signup page

This commit is contained in:
Sosokker 2025-04-20 16:06:11 +07:00
parent bce5a18f66
commit ce4798ecfc
2 changed files with 27 additions and 45 deletions

View File

@ -97,13 +97,13 @@ export default function LoginPage() {
> >
TODO TODO
</Link> </Link>
<Link {/* <Link
href="/" href="/"
className="text-sm text-gray-500 hover:text-[#FF5A5F] transition-colors flex items-center" className="text-sm text-gray-500 hover:text-[#FF5A5F] transition-colors flex items-center"
> >
<span>Back to website</span> <span>Back to website</span>
<Icons.arrowRight className="ml-1 h-4 w-4" /> <Icons.arrowRight className="ml-1 h-4 w-4" />
</Link> </Link> */}
</div> </div>
<h1 className="text-gray-900 text-3xl font-bold mb-2"> <h1 className="text-gray-900 text-3xl font-bold mb-2">

View File

@ -12,7 +12,7 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label"; import { Label } from "@/components/ui/label";
import { Icons } from "@/components/icons"; import { Icons } from "@/components/icons";
import { Checkbox } from "@/components/ui/checkbox"; // import { Checkbox } from "@/components/ui/checkbox";
import Image from "next/image"; import Image from "next/image";
export default function SignupPage() { export default function SignupPage() {
@ -20,13 +20,12 @@ export default function SignupPage() {
const { login } = useAuth(); const { login } = useAuth();
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const [formData, setFormData] = useState({ const [formData, setFormData] = useState({
firstName: "", username: "",
lastName: "",
email: "", email: "",
password: "", password: "",
}); });
const [showPassword, setShowPassword] = useState(false); const [showPassword, setShowPassword] = useState(false);
const [agreedToTerms, setAgreedToTerms] = useState(false); // const [agreedToTerms, setAgreedToTerms] = useState(false);
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => { const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const { name, value } = e.target; const { name, value } = e.target;
@ -36,16 +35,15 @@ export default function SignupPage() {
const handleSubmit = async (e: React.FormEvent) => { const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault(); e.preventDefault();
if (!agreedToTerms) { // if (!agreedToTerms) {
toast.error("You must agree to the Terms & Conditions"); // toast.error("You must agree to the Terms & Conditions");
return; // return;
} // }
setIsLoading(true); setIsLoading(true);
try { try {
const { firstName, lastName, email, password } = formData; const { username, email, password } = formData;
const username = `${firstName} ${lastName}`.trim();
const user = await signupUserApi({ username, email, password }); const user = await signupUserApi({ username, email, password });
// In a real app, we'd get a token back from signup or do a separate login // In a real app, we'd get a token back from signup or do a separate login
@ -105,13 +103,13 @@ export default function SignupPage() {
> >
TODO TODO
</Link> </Link>
<Link {/* <Link
href="/" href="/"
className="text-sm text-gray-500 hover:text-[#FF5A5F] transition-colors flex items-center" className="text-sm text-gray-500 hover:text-[#FF5A5F] transition-colors flex items-center"
> >
<span>Back to website</span> <span>Back to website</span>
<Icons.arrowRight className="ml-1 h-4 w-4" /> <Icons.arrowRight className="ml-1 h-4 w-4" />
</Link> </Link> */}
</div> </div>
<h1 className="text-gray-900 text-3xl font-bold mb-2"> <h1 className="text-gray-900 text-3xl font-bold mb-2">
@ -125,35 +123,19 @@ export default function SignupPage() {
</p> </p>
<form onSubmit={handleSubmit} className="space-y-6"> <form onSubmit={handleSubmit} className="space-y-6">
<div className="grid grid-cols-2 gap-4"> <div className="space-y-2">
<div className="space-y-2"> <Label htmlFor="username" className="text-gray-900">
<Label htmlFor="firstName" className="text-gray-900"> Username
First name </Label>
</Label> <Input
<Input id="username"
id="firstName" name="username"
name="firstName" placeholder="johndoe"
placeholder="John" value={formData.username}
value={formData.firstName} onChange={handleChange}
onChange={handleChange} required
required className="bg-white border-gray-300 text-gray-900 placeholder-gray-400"
className="bg-white border-gray-300 text-gray-900 placeholder-gray-400" />
/>
</div>
<div className="space-y-2">
<Label htmlFor="lastName" className="text-gray-900">
Last name
</Label>
<Input
id="lastName"
name="lastName"
placeholder="Doe"
value={formData.lastName}
onChange={handleChange}
required
className="bg-white border-gray-300 text-gray-900 placeholder-gray-400"
/>
</div>
</div> </div>
<div className="space-y-2"> <div className="space-y-2">
<Label htmlFor="email" className="text-gray-900"> <Label htmlFor="email" className="text-gray-900">
@ -199,7 +181,7 @@ export default function SignupPage() {
</div> </div>
</div> </div>
<div className="flex items-center space-x-2"> {/* <div className="flex items-center space-x-2">
<Checkbox <Checkbox
id="terms" id="terms"
checked={agreedToTerms} checked={agreedToTerms}
@ -217,7 +199,7 @@ export default function SignupPage() {
Terms & Conditions Terms & Conditions
</Link> </Link>
</label> </label>
</div> </div> */}
<Button <Button
type="submit" type="submit"