Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.env.local
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
Expand Down
35 changes: 7 additions & 28 deletions app/auth/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ export default function Register() {
const isFormValid =
name.trim() &&
email.trim() &&
/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) &&
password.trim() &&
confirmPassword.trim() &&
password === confirmPassword &&
Expand Down Expand Up @@ -311,7 +310,7 @@ export default function Register() {
}`}
/>
Email Address
{email && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) && (
{email && email.includes("@") && (
<Check className="h-3 w-3 text-green-500 animate-scale-in" />
)}
</Label>
Expand All @@ -325,47 +324,27 @@ export default function Register() {
onBlur={() => setFocusedField(null)}
placeholder="Enter your email"
required
className={`glass-effect focus:ring-yellow-400/20 pl-4 pr-4 py-3 text-sm sm:text-base transition-all duration-300 group-hover:shadow-lg ${
email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) && email.length > 0
? "border-red-400/60 focus:border-red-400/80 hover:border-red-400/70"
: "border-yellow-400/30 focus:border-yellow-400/60 hover:border-yellow-400/50"
}`}
className="glass-effect border-yellow-400/30 focus:border-yellow-400/60 focus:ring-yellow-400/20 pl-4 pr-4 py-3 text-sm sm:text-base transition-all duration-300 hover:border-yellow-400/50 group-hover:shadow-lg"
disabled={isLoading}
/>
<div
className={`absolute inset-0 rounded-md border pointer-events-none transition-all duration-300 ${
focusedField === "email"
? email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) && email.length > 0
? "border-red-400/40 shadow-lg shadow-red-400/20"
: "border-yellow-400/40 shadow-lg shadow-yellow-400/20"
: email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) && email.length > 0
? "border-red-400/20"
? "border-yellow-400/40 shadow-lg shadow-yellow-400/20"
: "border-yellow-400/20"
}`}
></div>
{/* Progress indicator */}
<div
className={`absolute bottom-0 left-0 h-0.5 transition-all duration-300 ${
email && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)
? "w-full bg-gradient-to-r from-green-400 to-blue-500"
: email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) && email.length > 0
? "w-full bg-gradient-to-r from-red-400 to-orange-500"
className={`absolute bottom-0 left-0 h-0.5 bg-gradient-to-r from-yellow-400 to-blue-500 transition-all duration-300 ${
email && email.includes("@")
? "w-full"
: email
? "w-1/2 bg-gradient-to-r from-yellow-400 to-blue-500"
? "w-1/2"
: "w-0"
}`}
></div>
</div>

{/* Email validation feedback */}
{email && email.length > 0 && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) && (
<div className="animate-fade-in-up">
<p className="text-xs text-red-500 flex items-center gap-1 animate-bounce">
<Mail className="h-3 w-3" />
Please enter a valid email address
</p>
</div>
)}
</div>

{/* Enhanced Password field with strength indicator */}
Expand Down
36 changes: 8 additions & 28 deletions app/auth/signin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export default function SignIn() {
}`}
/>
Email Address
{email && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) && (
{email && email.includes("@") && (
<Check className="h-3 w-3 text-green-500 animate-scale-in" />
)}
</Label>
Expand All @@ -208,47 +208,27 @@ export default function SignIn() {
onBlur={() => setFocusedField(null)}
placeholder="Enter your email"
required
className={`glass-effect focus:ring-yellow-400/20 pl-4 pr-4 py-3 text-sm sm:text-base transition-all duration-300 group-hover:shadow-lg ${
email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) && email.length > 0
? "border-red-400/60 focus:border-red-400/80 hover:border-red-400/70"
: "border-yellow-400/30 focus:border-yellow-400/60 hover:border-yellow-400/50"
}`}
className="glass-effect border-yellow-400/30 focus:border-yellow-400/60 focus:ring-yellow-400/20 pl-4 pr-4 py-3 text-sm sm:text-base transition-all duration-300 hover:border-yellow-400/50 group-hover:shadow-lg"
disabled={isLoading}
/>
<div
className={`absolute inset-0 rounded-md border pointer-events-none transition-all duration-300 ${
focusedField === "email"
? email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) && email.length > 0
? "border-red-400/40 shadow-lg shadow-red-400/20"
: "border-yellow-400/40 shadow-lg shadow-yellow-400/20"
: email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) && email.length > 0
? "border-red-400/20"
? "border-yellow-400/40 shadow-lg shadow-yellow-400/20"
: "border-yellow-400/20"
}`}
></div>
{/* Progress indicator */}
<div
className={`absolute bottom-0 left-0 h-0.5 transition-all duration-300 ${
email && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)
? "w-full bg-gradient-to-r from-green-400 to-blue-500"
: email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) && email.length > 0
? "w-full bg-gradient-to-r from-red-400 to-orange-500"
className={`absolute bottom-0 left-0 h-0.5 bg-gradient-to-r from-yellow-400 to-blue-500 transition-all duration-300 ${
email && email.includes("@")
? "w-full"
: email
? "w-1/2 bg-gradient-to-r from-yellow-400 to-blue-500"
? "w-1/2"
: "w-0"
}`}
></div>
</div>

{/* Email validation feedback */}
{email && email.length > 0 && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) && (
<div className="animate-fade-in-up">
<p className="text-xs text-red-500 flex items-center gap-1 animate-bounce">
<Mail className="h-3 w-3" />
Please enter a valid email address
</p>
</div>
)}
</div>

{/* Enhanced password field with better UX */}
Expand Down Expand Up @@ -338,7 +318,7 @@ export default function SignIn() {
>
<Button
type="submit"
disabled={isLoading || !email.trim() || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) || !password.trim()}
disabled={isLoading || !email.trim() || !password.trim()}
className="w-full bolt-gradient text-white font-semibold py-4 sm:py-5 rounded-xl relative text-lg sm:text-xl disabled:opacity-50 disabled:cursor-not-allowed shadow-lg hover:scale-105 transition-all duration-300 focus:ring-4 focus:ring-blue-300 focus:outline-none"
aria-label="Sign in to your account"
>
Expand Down
26 changes: 2 additions & 24 deletions app/contact/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ export default function ContactForm() {
const [isSubmitting, setIsSubmitting] = useState(false);
const [isSubmitted, setIsSubmitted] = useState(false);

// Email validation function
const isValidEmail = (email: string) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);

const handleInputChange = (
e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
) => {
Expand All @@ -52,12 +49,6 @@ export default function ContactForm() {

const handleSubmit = async (e: React.FormEvent<HTMLButtonElement>) => {
e.preventDefault();

// Validate email before submission
if (!isValidEmail(formData.email)) {
return;
}

setIsSubmitting(true);

// Simulate form submission
Expand Down Expand Up @@ -232,9 +223,6 @@ export default function ContactForm() {
<label htmlFor="email" className="flex items-center gap-2 text-sm sm:text-base font-medium text-foreground">
<Mail className="h-4 w-4 text-green-500" />
Email Address
{formData.email && isValidEmail(formData.email) && (
<span className="text-green-500 text-xs">✓</span>
)}
</label>
<input
type="email"
Expand All @@ -243,19 +231,9 @@ export default function ContactForm() {
value={formData.email}
onChange={handleInputChange}
required
className={`w-full px-4 py-3 sm:py-4 rounded-xl glass-effect border transition-all duration-300 text-sm sm:text-base placeholder:text-muted-foreground/60 ${
formData.email && !isValidEmail(formData.email) && formData.email.length > 0
? "border-red-500/50 focus:border-red-500/70 focus:ring-2 focus:ring-red-500/20"
: "border-border/50 focus:border-green-500/50 focus:ring-2 focus:ring-green-500/20"
}`}
className="w-full px-4 py-3 sm:py-4 rounded-xl glass-effect border border-border/50 focus:border-green-500/50 focus:ring-2 focus:ring-green-500/20 transition-all duration-300 text-sm sm:text-base placeholder:text-muted-foreground/60"
placeholder="[email protected]"
/>
{formData.email && formData.email.length > 0 && !isValidEmail(formData.email) && (
<p className="text-xs text-red-500 flex items-center gap-1">
<Mail className="h-3 w-3" />
Please enter a valid email address
</p>
)}
</div>

{/* Phone Field */}
Expand Down Expand Up @@ -501,4 +479,4 @@ export default function ContactForm() {
`}</style>
</div>
);
}
}
Loading
Loading