Add src/app/login/page.tsx
This commit is contained in:
188
src/app/login/page.tsx
Normal file
188
src/app/login/page.tsx
Normal file
@@ -0,0 +1,188 @@
|
||||
"use client";
|
||||
|
||||
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
|
||||
import NavbarStyleCentered from "@/components/navbar/NavbarStyleCentered/NavbarStyleCentered";
|
||||
import FooterBase from "@/components/sections/footer/FooterBase";
|
||||
import Input from "@/components/form/Input";
|
||||
import ButtonHoverMagnetic from "@/components/button/ButtonHoverMagnetic/ButtonHoverMagnetic";
|
||||
import { useState } from "react";
|
||||
import { Lock, Mail } from "lucide-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export default function LoginPage() {
|
||||
const [email, setEmail] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [error, setError] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
const router = useRouter();
|
||||
|
||||
const handleLogin = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
setError("");
|
||||
setLoading(true);
|
||||
|
||||
try {
|
||||
// Basic validation
|
||||
if (!email || !password) {
|
||||
setError("Please enter email and password");
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Replace with actual authentication logic
|
||||
// For now, accept demo credentials
|
||||
if (email === "admin@citycellworld.com" && password === "admin123") {
|
||||
// Store authentication token or session
|
||||
localStorage.setItem("adminToken", "authenticated");
|
||||
router.push("/admin");
|
||||
} else {
|
||||
setError("Invalid email or password");
|
||||
}
|
||||
} catch (err) {
|
||||
setError("Login failed. Please try again.");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<ThemeProvider
|
||||
defaultButtonVariant="shift-hover"
|
||||
defaultTextAnimation="background-highlight"
|
||||
borderRadius="rounded"
|
||||
contentWidth="medium"
|
||||
sizing="largeSmallSizeMediumTitles"
|
||||
background="circleGradient"
|
||||
cardStyle="soft-shadow"
|
||||
primaryButtonStyle="primary-glow"
|
||||
secondaryButtonStyle="glass"
|
||||
headingFontWeight="semibold"
|
||||
>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarStyleCentered
|
||||
brandName="City Cellworld"
|
||||
navItems={[
|
||||
{ name: "Home", id: "/" },
|
||||
{ name: "Services", id: "services" },
|
||||
{ name: "Products", id: "products" },
|
||||
{ name: "About", id: "why-choose" },
|
||||
{ name: "Contact", id: "contact-faq" },
|
||||
]}
|
||||
button={{
|
||||
text: "Call Now", href: "tel:+919876543210"}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div id="login" data-section="login" className="min-h-screen flex items-center justify-center py-12 px-4">
|
||||
<div className="w-full max-w-md">
|
||||
<div className="bg-card rounded-lg shadow-lg p-8">
|
||||
<div className="text-center mb-8">
|
||||
<Lock className="w-12 h-12 mx-auto mb-4 text-primary-cta" />
|
||||
<h1 className="text-3xl font-bold text-foreground mb-2">Admin Login</h1>
|
||||
<p className="text-foreground/70">Access the admin dashboard to manage prices and inventory</p>
|
||||
</div>
|
||||
|
||||
<form onSubmit={handleLogin} className="space-y-6">
|
||||
{error && (
|
||||
<div className="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded">
|
||||
{error}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div>
|
||||
<label htmlFor="email" className="block text-sm font-medium text-foreground mb-2">
|
||||
Email Address
|
||||
</label>
|
||||
<div className="relative">
|
||||
<Mail className="absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-foreground/50" />
|
||||
<Input
|
||||
value={email}
|
||||
onChange={setEmail}
|
||||
type="email"
|
||||
placeholder="admin@citycellworld.com"
|
||||
required
|
||||
className="pl-10"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label htmlFor="password" className="block text-sm font-medium text-foreground mb-2">
|
||||
Password
|
||||
</label>
|
||||
<div className="relative">
|
||||
<Lock className="absolute left-3 top-1/2 transform -translate-y-1/2 w-5 h-5 text-foreground/50" />
|
||||
<Input
|
||||
value={password}
|
||||
onChange={setPassword}
|
||||
type="password"
|
||||
placeholder="Enter your password"
|
||||
required
|
||||
className="pl-10"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
disabled={loading}
|
||||
className="w-full bg-primary-cta text-primary-cta-text font-semibold py-3 rounded-lg hover:opacity-90 transition-opacity disabled:opacity-50"
|
||||
>
|
||||
{loading ? "Logging in..." : "Login to Admin"}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div className="mt-6 pt-6 border-t border-foreground/20">
|
||||
<p className="text-sm text-foreground/70 text-center">
|
||||
Demo credentials:
|
||||
</p>
|
||||
<p className="text-sm text-foreground/70 text-center">
|
||||
Email: admin@citycellworld.com
|
||||
</p>
|
||||
<p className="text-sm text-foreground/70 text-center">
|
||||
Password: admin123
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer" data-section="footer">
|
||||
<FooterBase
|
||||
logoText="City Cellworld"
|
||||
copyrightText="© 2025 City Cellworld. All rights reserved. Your trusted mobile store in Ongole."
|
||||
columns={[
|
||||
{
|
||||
title: "Quick Links", items: [
|
||||
{ label: "Home", href: "/" },
|
||||
{ label: "Products", href: "/products" },
|
||||
{ label: "Services", href: "services" },
|
||||
{ label: "About", href: "why-choose" },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Services", items: [
|
||||
{ label: "Phone Sales", href: "/products" },
|
||||
{ label: "Screen Repair", href: "services" },
|
||||
{ label: "Battery Service", href: "services" },
|
||||
{ label: "Accessories", href: "/products" },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Contact", items: [
|
||||
{
|
||||
label: "Call: +91-9876-543-210", href: "tel:+919876543210"},
|
||||
{
|
||||
label: "WhatsApp: Chat Now", href: "https://wa.me/919876543210"},
|
||||
{
|
||||
label: "Email: info@citycellworld.com", href: "mailto:info@citycellworld.com"},
|
||||
{
|
||||
label: "Visit Store", href: "https://maps.google.com/?q=Vijaya+Complex+Kurnool+Road+Ongole"},
|
||||
],
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user