From 17fbfec07eea6398efdcf080bd3ccb3df82622af Mon Sep 17 00:00:00 2001 From: bender Date: Sat, 30 May 2026 18:45:15 +0000 Subject: [PATCH 1/5] Add src/app/admin/layout.tsx --- src/app/admin/layout.tsx | 83 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 src/app/admin/layout.tsx diff --git a/src/app/admin/layout.tsx b/src/app/admin/layout.tsx new file mode 100644 index 0000000..a02c468 --- /dev/null +++ b/src/app/admin/layout.tsx @@ -0,0 +1,83 @@ +"use client"; + +import { useEffect } from "react"; +import { useRouter } from "next/navigation"; +import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; +import ReactLenis from "lenis/react"; +import NavbarStyleApple from '@/components/navbar/NavbarStyleApple/NavbarStyleApple'; +import FooterCard from '@/components/sections/footer/FooterCard'; +import { Facebook, Instagram, Twitter } from "lucide-react"; + +export default function AdminLayout({ + children, +}: { + children: React.ReactNode; + }) { + const router = useRouter(); + + useEffect(() => { + if (typeof window !== 'undefined') { + const isLoggedIn = localStorage.getItem("adminLoggedIn"); + if (!isLoggedIn) { + router.push("/login"); + } + } + }, [router]); + + const handleLogout = () => { + localStorage.removeItem("adminLoggedIn"); + router.push("/login"); + }; + + return ( + + + +
+ {children} +
+ +
+
+ ); +} -- 2.49.1 From e606c0d5bb5e08b90a5acc0db586ef164cef9f9e Mon Sep 17 00:00:00 2001 From: bender Date: Sat, 30 May 2026 18:45:16 +0000 Subject: [PATCH 2/5] Add src/app/admin/page.tsx --- src/app/admin/page.tsx | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/app/admin/page.tsx diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx new file mode 100644 index 0000000..8109f9e --- /dev/null +++ b/src/app/admin/page.tsx @@ -0,0 +1,33 @@ +"use client"; + +import React from "react"; +import { useRouter } from "next/navigation"; + +export default function AdminDashboardPage() { + const router = useRouter(); + + return ( +
+

+ Welcome to the Admin Dashboard! +

+

+ Here you can manage your products, orders, and other platform settings. +

+
+ + +
+
+ ); +} -- 2.49.1 From 44bfa7708676120bb9b79216a2bdada0a84307b6 Mon Sep 17 00:00:00 2001 From: bender Date: Sat, 30 May 2026 18:45:16 +0000 Subject: [PATCH 3/5] Add src/app/login/page.tsx --- src/app/login/page.tsx | 98 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 src/app/login/page.tsx diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx new file mode 100644 index 0000000..e150cdf --- /dev/null +++ b/src/app/login/page.tsx @@ -0,0 +1,98 @@ +"use client"; + +import { useState } from "react"; +import { useRouter } from "next/navigation"; +import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; +import ReactLenis from "lenis/react"; + +export default function LoginPage() { + const [username, setUsername] = useState(""); + const [password, setPassword] = useState(""); + const [error, setError] = useState(""); + const router = useRouter(); + + const handleLogin = (e: React.FormEvent) => { + e.preventDefault(); + setError(""); + + // Hardcoded credentials for demonstration + if (username === "admin" && password === "admin123") { + localStorage.setItem("adminLoggedIn", "true"); + router.push("/admin"); + } else { + setError("Invalid username or password"); + } + }; + + return ( + + +
+
+

+ Admin Login +

+
+
+ + setUsername(e.target.value)} + /> +
+
+ + setPassword(e.target.value)} + /> +
+ {error &&

{error}

} +
+ +
+
+
+
+
+
+ ); +} -- 2.49.1 From 31220cb1c3fcee3173ad3e5c85d9952605e13acf Mon Sep 17 00:00:00 2001 From: bender Date: Sat, 30 May 2026 18:45:17 +0000 Subject: [PATCH 4/5] Add src/app/order/page.tsx --- src/app/order/page.tsx | 368 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 368 insertions(+) create mode 100644 src/app/order/page.tsx diff --git a/src/app/order/page.tsx b/src/app/order/page.tsx new file mode 100644 index 0000000..2b68433 --- /dev/null +++ b/src/app/order/page.tsx @@ -0,0 +1,368 @@ +"use client"; + +import ButtonHoverBubble from "@/components/button/ButtonHoverBubble"; +import NavbarStyleApple from "@/components/navbar/NavbarStyleApple/NavbarStyleApple"; +import FooterCard from "@/components/sections/footer/FooterCard"; +import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; +import { CheckCircle, XCircle } from "lucide-react"; +import React, { useState, useEffect, useRef } from "react"; +import ReactLenis from "lenis/react"; + +interface Wilaya { + code: string; + name: string; + communes: string[]; +} + +const AlgerianWilayas: Wilaya[] = [ + { "code": "01", "name": "Adrar", "communes": ["Adrar", "Tamest", "Reggane", "Bourg Haouas"] }, + { "code": "02", "name": "Chlef", "communes": ["Chlef", "El Karimia", "Ouled Fares", "Ténès"] }, + { "code": "03", "name": "Laghouat", "communes": ["Laghouat", "Aflou", "Ksar El Hirane", "Brida"] }, + { "code": "04", "name": "Oum El Bouaghi", "communes": ["Oum El Bouaghi", "Ain Beida", "Ain M'lila", "Meskhiana"] }, + { "code": "05", "name": "Batna", "communes": ["Batna", "Barika", "Arris", "Menaa"] }, + { "code": "06", "name": "Béjaïa", "communes": ["Béjaïa", "Akbou", "Amizour", "Kherrata"] }, + { "code": "07", "name": "Biskra", "communes": ["Biskra", "Ouled Djellal", "Tolga", "Sidi Okba"] }, + { "code": "08", "name": "Béchar", "communes": ["Béchar", "Abadla", "Taghit", "Béni Ounif"] }, + { "code": "09", "name": "Blida", "communes": ["Blida", "Boufarik", "Meftah", "Larbaa"] }, + { "code": "10", "name": "Bouira", "communes": ["Bouira", "Lakhdaria", "Sour El Ghozlane", "Ain Bessem"] }, + { "code": "11", "name": "Tamanrasset", "communes": ["Tamanrasset", "In Salah", "In Guezzam", "Idlès"] }, + { "code": "12", "name": "Tébessa", "communes": ["Tébessa", "Bir El Ater", "Ouenza", "El Ma Labiodh"] }, + { "code": "13", "name": "Tlemcen", "communes": ["Tlemcen", "Ghazaouet", "Maghnia", "Remchi"] }, + { "code": "14", "name": "Tiaret", "communes": ["Tiaret", "Frenda", "Mahdia", "Rahouia"] }, + { "code": "15", "name": "Tizi Ouzou", "communes": ["Tizi Ouzou", "Larbaâ Nath Irathen", "Azazga", "Bouzeguene"] }, + { "code": "16", "name": "Alger", "communes": ["Alger Centre", "Bab El Oued", "Bir Mourad Raïs", "Hussein Dey"] }, + { "code": "17", "name": "Djelfa", "communes": ["Djelfa", "Messaad", "Ain Oussara", "Hassi Bahbah"] }, + { "code": "18", "name": "Jijel", "communes": ["Jijel", "Taher", "El Milia", "Chekfa"] }, + { "code": "19", "name": "Sétif", "communes": ["Sétif", "El Eulma", "Ain Oulmene", "Bougaa"] }, + { "code": "20", "name": "Saïda", "communes": ["Saïda", "Ain El Hadjar", "Sidi Boubkeur", "Youb"] }, + { "code": "21", "name": "Skikda", "communes": ["Skikda", "Collo", "Azzaba", "El Harrouch"] }, + { "code": "22", "name": "Sidi Bel Abbès", "communes": ["Sidi Bel Abbès", "Sfisef", "Telagh", "Ras El Ma"] }, + { "code": "23", "name": "Annaba", "communes": ["Annaba", "El Bouni", "Sidi Amar", "Berrahal"] }, + { "code": "24", "name": "Guelma", "communes": ["Guelma", "Hammam Debagh", "Ain Makhlouf", "Oued Zenati"] }, + { "code": "25", "name": "Constantine", "communes": ["Constantine", "El Khroub", "Hamma Bouziane", "Didouche Mourad"] }, + { "code": "26", "name": "Médéa", "communes": ["Médéa", "Berrouaghia", "Ksar Boukhari", "Chahbounia"] }, + { "code": "27", "name": "Mostaganem", "communes": ["Mostaganem", "Ain Tedles", "Hassi Mameche", "Bouguirat"] }, + { "code": "28", "name": "M'Sila", "communes": ["M'Sila", "Bou Saada", "Magra", "Sidi Aïssa"] }, + { "code": "29", "name": "Mascara", "communes": ["Mascara", "Mohammadia", "Sig", "Bou Hanifia"] }, + { "code": "30", "name": "Ouargla", "communes": ["Ouargla", "Touggourt", "Hassi Messaoud", "N'Goussa"] }, + { "code": "31", "name": "Oran", "communes": ["Oran", "Es Sénia", "Bir El Djir", "Arzew"] }, + { "code": "32", "name": "El Bayadh", "communes": ["El Bayadh", "Bougtoub", "Brezina", "Chellala"] }, + { "code": "33", "name": "Illizi", "communes": ["Illizi", "Djanet", "Bordj Omar Driss", "Debdeb"] }, + { "code": "34", "name": "Bordj Bou Arréridj", "communes": ["Bordj Bou Arréridj", "Ras El Oued", "Ain Taghrout", "El Hamadia"] }, + { "code": "35", "name": "Boumerdès", "communes": ["Boumerdès", "Dellys", "Boudouaou", "Khemis El Khechna"] }, + { "code": "36", "name": "El Tarf", "communes": ["El Tarf", "El Kala", "Ben M'hidi", "Drean"] }, + { "code": "37", "name": "Tindouf", "communes": ["Tindouf", "Oum El Assel"] }, + { "code": "38", "name": "Tissemsilt", "communes": ["Tissemsilt", "Théniet El Had", "Lardjem", "Bordj Bounaama"] }, + { "code": "39", "name": "El Oued", "communes": ["El Oued", "Guemar", "Robbah", "Hassani Abdelkrim"] }, + { "code": "40", "name": "Khenchela", "communes": ["Khenchela", "Chechar", "Kais", "Djellal"] }, + { "code": "41", "name": "Souk Ahras", "communes": ["Souk Ahras", "Sedrata", "Taoura", "Merahna"] }, + { "code": "42", "name": "Tipaza", "communes": ["Tipaza", "Cherchell", "Hadjout", "Kolea"] }, + { "code": "43", "name": "Mila", "communes": ["Mila", "Chelghoum Laid", "Grarem Gouga", "Rouached"] }, + { "code": "44", "name": "Aïn Defla", "communes": ["Aïn Defla", "Khemis Miliana", "El Attaf", "Miliana"] }, + { "code": "45", "name": "Naâma", "communes": ["Naâma", "Mécheria", "Ain Sefra", "Sfissifa"] }, + { "code": "46", "name": "Aïn Témouchent", "communes": ["Aïn Témouchent", "Hammam Bou Hadjar", "Beni Saf", "El Amria"] }, + { "code": "47", "name": "Ghardaïa", "communes": ["Ghardaïa", "El Guerrara", "Bounoura", "Daya Ben Dahoua"] }, + { "code": "48", "name": "Relizane", "communes": ["Relizane", "Oued Rhiou", "Mazouna", "Zemmoura"] }, + { "code": "49", "name": "El M'ghair", "communes": ["El M'ghair", "Djamaa", "M'ghair", "Sidi Khelil"] }, + { "code": "50", "name": "El Menia", "communes": ["El Menia", "Hassi Gara", "Hassi Fehal"] }, + { "code": "51", "name": "Ouled Djellal", "communes": ["Ouled Djellal", "Sidi Khaled", "Besbes", "Ras El Mia"] }, + { "code": "52", "name": "Bordj Baji Mokhtar", "communes": ["Bordj Baji Mokhtar", "Timiaouine"] }, + { "code": "53", "name": "Béni Abbès", "communes": ["Béni Abbès", "Kerzaz", "Tabelbala", "Ouled Khoudir"] }, + { "code": "54", "name": "Timimoun", "communes": ["Timimoun", "Aougrout", "Charouin", "Deladla"] }, + { "code": "55", "name": "Touggourt", "communes": ["Touggourt", "Temacine", "Blidet Amor", "M'Rara"] }, + { "code": "56", "name": "Djanet", "communes": ["Djanet", "Bordj El Houasse"] }, + { "code": "57", "name": "In Salah", "communes": ["In Salah", "Foggaret Ezzoua", "Ain Ghar"] }, + { "code": "58", "name": "In Guezzam", "communes": ["In Guezzam", "Tin Zaouatine"] } +]; + +interface OrderFormData { + firstName: string; + lastName: string; + phoneNumber: string; + wilaya: string; + commune: string; + quantity: number; +} + +const OrderFormPage = () => { + const [firstName, setFirstName] = useState(""); + const [lastName, setLastName] = useState(""); + const [phoneNumber, setPhoneNumber] = useState(""); + const [wilaya, setWilaya] = useState(""); + const [commune, setCommune] = useState(""); const [quantity, setQuantity] = useState(1); + const [errors, setErrors] = useState>({}); + const [submissionStatus, setSubmissionStatus] = useState<"idle" | "success" | "error">("idle"); + + const availableCommunes = wilaya + ? AlgerianWilayas.find((w) => w.name === wilaya)?.communes || [] + : []; + + useEffect(() => { + // Reset commune when wilaya changes + setCommune(""); + }, [wilaya]); + + const validateForm = () => { + const newErrors: Record = {}; + if (!firstName) newErrors.firstName = "First Name is required."; + if (!lastName) newErrors.lastName = "Last Name is required."; + // Algerian phone number validation: starts with 05, 06, or 07, followed by 8 digits + if (!phoneNumber) { + newErrors.phoneNumber = "Phone Number is required."; + } else if (!/^(05|06|07)\d{8}$/.test(phoneNumber)) { + newErrors.phoneNumber = "Invalid Algerian phone number (e.g., 05XXXXXXXX)."; + } + if (!wilaya) newErrors.wilaya = "Wilaya is required."; + if (!commune) newErrors.commune = "Commune is required."; + if (quantity < 1) newErrors.quantity = "Quantity must be at least 1."; + setErrors(newErrors); + return Object.keys(newErrors).length === 0; + }; + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + setSubmissionStatus("idle"); + + if (validateForm()) { + const formData: OrderFormData = { + firstName, + lastName, + phoneNumber, + wilaya, + commune, + quantity, + }; + console.log("Form data submitted:", formData); + + // Simulate backend saving and success animation + setTimeout(() => { + try { + localStorage.setItem("latestOrder", JSON.stringify(formData)); + setSubmissionStatus("success"); + // Reset form + setFirstName(""); + setLastName(""); + setPhoneNumber(""); + setWilaya(""); + setCommune(""); + setQuantity(1); + setErrors({}); + } catch (error) { + console.error("Error saving to local storage:", error); + setSubmissionStatus("error"); + } + }, 1000); + } else { + setSubmissionStatus("error"); // Indicate form validation failed + } + }; + + const navItems = [ + { name: "Home", id: "/" }, + { name: "Features", id: "/#features" }, + { name: "Products", id: "/#products" }, + { name: "Testimonials", id: "/#testimonials" }, + { name: "FAQs", id: "/#faqs" }, + { name: "Order Now", id: "/order" }, + ]; + + return ( + + + + +
+
+
+

+ Place Your Order +

+

+ Fill out the form below to complete your purchase. +

+
+
+
+
+ +
+ setFirstName(e.target.value)} + /> + {errors.firstName &&

{errors.firstName}

} +
+
+
+ +
+ setLastName(e.target.value)} + /> + {errors.lastName &&

{errors.lastName}

} +
+
+
+ +
+ setPhoneNumber(e.target.value)} + /> + {errors.phoneNumber &&

{errors.phoneNumber}

} +
+
+
+ +
+ + {errors.wilaya &&

{errors.wilaya}

} +
+
+
+ +
+ + {errors.commune &&

{errors.commune}

} +
+
+
+ +
+ setQuantity(Math.max(1, parseInt(e.target.value) || 1))} + /> + {errors.quantity &&

{errors.quantity}

} +
+
+
+
+ +
+ + {submissionStatus === "success" && ( +
+ +

Order placed successfully!

+
+ )} + {submissionStatus === "error" && Object.keys(errors).length > 0 && ( +
+ +

Please correct the errors above.

+
+ )} +
+
+
+ + {/* Sticky 'Order Now' button for mobile */} +
+ +
+ + +
+
+ ); +}; + +export const metadata = { + title: "Place Your Order - Product Platform", description: "Complete your order with our secure and easy-to-use order form. Select your wilaya and commune for quick delivery."}; + +export default OrderFormPage; -- 2.49.1 From 2614ba0adeb5ef743867e69dbb3fc4d482f00d13 Mon Sep 17 00:00:00 2001 From: bender Date: Sat, 30 May 2026 18:45:17 +0000 Subject: [PATCH 5/5] Update src/app/page.tsx --- src/app/page.tsx | 245 ++++++++++------------------------------------- 1 file changed, 50 insertions(+), 195 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index bcbe76b..b78437b 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -33,29 +33,19 @@ export default function LandingPage() { @@ -64,20 +54,15 @@ export default function LandingPage() {
); -} +} \ No newline at end of file -- 2.49.1