diff --git a/src/app/post-job/page.tsx b/src/app/post-job/page.tsx index 59848c6..f9d93e3 100644 --- a/src/app/post-job/page.tsx +++ b/src/app/post-job/page.tsx @@ -3,15 +3,15 @@ import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; import NavbarStyleCentered from "@/components/navbar/NavbarStyleCentered/NavbarStyleCentered"; import FooterBase from "@/components/sections/footer/FooterBase"; +import { Briefcase, Mail } from "lucide-react"; import { useState } from "react"; -import { Briefcase, Mail, CheckCircle, AlertCircle } from "lucide-react"; const navItems = [ - { name: "Search Jobs", id: "/search" }, + { name: "Search Jobs", id: "search" }, { name: "Post a Job", id: "/post-job" }, - { name: "Admin", id: "admin-login" }, - { name: "Browse", id: "/browse" }, - { name: "Contact", id: "#contact" }, + { name: "Applications", id: "/applications" }, + { name: "Browse", id: "browse" }, + { name: "Contact", id: "contact" }, ]; const footerColumns = [ @@ -19,7 +19,7 @@ const footerColumns = [ title: "Product", items: [ { label: "Search Jobs", href: "/search" }, { label: "Post a Job", href: "/post-job" }, - { label: "Browse by Province", href: "#provinces" }, + { label: "My Applications", href: "/applications" }, { label: "For Employers", href: "#" }, ], }, @@ -41,111 +41,30 @@ const footerColumns = [ }, ]; -interface FormErrors { - jobTitle?: string; - company?: string; - location?: string; - salary?: string; - description?: string; - requirements?: string; - email?: string; -} - -interface FormData { - jobTitle: string; - company: string; - location: string; - salary: string; - jobType: string; - description: string; - requirements: string; - email: string; - contactPhone?: string; -} - export default function PostJobPage() { - const [formData, setFormData] = useState({ - jobTitle: "", company: "", location: "", salary: "", jobType: "Full-time", description: "", requirements: "", email: "", contactPhone: ""}); + const [formData, setFormData] = useState({ + jobTitle: "", company: "", location: "", province: "", jobType: "Full-Time", salaryRange: "", description: "", requirements: "", contactEmail: "", benefits: ""}); - const [errors, setErrors] = useState({}); - const [isSubmitting, setIsSubmitting] = useState(false); - const [submitStatus, setSubmitStatus] = useState<"idle" | "success" | "error">( - "idle" - ); + const [submitted, setSubmitted] = useState(false); - const validateForm = (): boolean => { - const newErrors: FormErrors = {}; - - if (!formData.jobTitle.trim()) { - newErrors.jobTitle = "Job title is required"; - } - if (!formData.company.trim()) { - newErrors.company = "Company name is required"; - } - if (!formData.location.trim()) { - newErrors.location = "Location is required"; - } - if (!formData.salary.trim()) { - newErrors.salary = "Salary range is required"; - } - if (formData.description.trim().length < 20) { - newErrors.description = "Description must be at least 20 characters"; - } - if (formData.requirements.trim().length < 10) { - newErrors.requirements = "Requirements must be at least 10 characters"; - } - if ( - !formData.email.trim() || - !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(formData.email) - ) { - newErrors.email = "Valid email is required"; - } - - setErrors(newErrors); - return Object.keys(newErrors).length === 0; - }; - - const handleSubmit = async (e: React.FormEvent) => { - e.preventDefault(); - - if (!validateForm()) { - setSubmitStatus("error"); - return; - } - - setIsSubmitting(true); - setSubmitStatus("idle"); - - try { - // Simulate API call - await new Promise((resolve) => setTimeout(resolve, 1500)); - setSubmitStatus("success"); - setFormData({ - jobTitle: "", company: "", location: "", salary: "", jobType: "Full-time", description: "", requirements: "", email: "", contactPhone: ""}); - setErrors({}); - - // Reset success message after 5 seconds - setTimeout(() => setSubmitStatus("idle"), 5000); - } catch (error) { - setSubmitStatus("error"); - } finally { - setIsSubmitting(false); - } - }; - - const handleInputChange = ( + const handleChange = ( e: React.ChangeEvent< HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement > ) => { const { name, value } = e.target; setFormData((prev) => ({ ...prev, [name]: value })); - if (errors[name as keyof FormErrors]) { - setErrors((prev) => ({ - ...prev, - [name]: undefined, - })); - } + }; + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + console.log("Job Posted:", formData); + setSubmitted(true); + setTimeout(() => { + setFormData({ + jobTitle: "", company: "", location: "", province: "", jobType: "Full-Time", salaryRange: "", description: "", requirements: "", contactEmail: "", benefits: ""}); + setSubmitted(false); + }, 2000); }; return ( @@ -170,270 +89,250 @@ export default function PostJobPage() { /> -
+
- {/* Header */} -
-
- - - Post a Job +
+
+ + + Post Your Job
-

- Hire Top Talent in the Netherlands +

+ Create Your Job Listing

-

- Post your job opening and reach qualified candidates across all Dutch - provinces +

+ Fill in the details below to post your job opening and reach qualified candidates + across the Netherlands.

- {/* Status Messages */} - {submitStatus === "success" && ( -
- -
-

Job Posted Successfully!

-

- Your job listing is now live and visible to job seekers across the - Netherlands. -

-
+ {submitted && ( +
+

✓ Job posted successfully!

)} - {submitStatus === "error" && Object.keys(errors).length > 0 && ( -
- -
-

Validation Errors

-

- Please correct the errors below and try again. -

-
-
- )} - - {/* Job Form */}
{/* Job Title */}
-
- {/* Company Name */} + {/* Company */}
-
- {/* Location and Job Type */} + {/* Location */}
-
-
+
+ + {/* Job Type */} +
+
+
-
- - {/* Salary */} -
- - - {errors.salary && ( -

{errors.salary}

- )} +
+ + +
{/* Description */}
-