Skip to content

Commit dd2c75a

Browse files
committed
wire hire modal on profile page
1 parent 769ffe2 commit dd2c75a

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

frontend/src/pages/WorkerProfilePage.jsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,9 @@ export default function WorkerProfilePage() {
417417
const [passport, setPassport] = useState(null);
418418
const [loading, setLoading] = useState(true);
419419
const [error, setError] = useState(null);
420+
const [showHireModal, setShowHireModal] = useState(false);
421+
const [hireForm, setHireForm] = useState({ name: "", email: "", project: "", date: "", budget: "" });
422+
const [hireSent, setHireSent] = useState(false);
420423

421424
useEffect(() => {
422425
if (!id) return;
@@ -669,6 +672,7 @@ export default function WorkerProfilePage() {
669672
{isHi ? "Profile link copy करें" : "Copy Profile Link"}
670673
</button>
671674
<button
675+
onClick={() => { setHireForm({ name: "", email: "", project: "", date: "", budget: "" }); setHireSent(false); setShowHireModal(true); }}
672676
style={{ padding: "11px 22px", borderRadius: 999, border: "none", background: "#23314f", color: "#fff", fontSize: 13, fontWeight: 700, cursor: "pointer" }}
673677
>
674678
{isHi ? "Hire Request भेजें" : "Send Hire Request"}
@@ -677,5 +681,46 @@ export default function WorkerProfilePage() {
677681
</Card>
678682

679683
</main>
684+
685+
{showHireModal && (
686+
<div onClick={() => setShowHireModal(false)} style={{ position: "fixed", inset: 0, zIndex: 1000, background: "rgba(18,24,39,0.36)", backdropFilter: "blur(6px)", display: "flex", alignItems: "flex-end", justifyContent: "center" }}>
687+
<div onClick={(e) => e.stopPropagation()} style={{ width: "100%", maxWidth: 480, background: "#fff", borderRadius: "28px 28px 0 0", padding: "28px 24px 32px", boxShadow: "0 -8px 40px rgba(35,49,79,0.18)", position: "relative", maxHeight: "92dvh", overflowY: "auto" }}>
688+
<button onClick={() => setShowHireModal(false)} style={{ position: "absolute", top: 16, right: 18, border: "none", background: "none", color: "#94a3b8", fontSize: 22, cursor: "pointer" }}>×</button>
689+
{!hireSent ? (
690+
<>
691+
<p style={{ fontSize: 11, letterSpacing: 2, textTransform: "uppercase", color: "#3b82f6", margin: "0 0 6px" }}>{isHi ? "Hire Request" : "Hire Request"}</p>
692+
<h2 style={{ fontFamily: "Fraunces, serif", fontSize: 26, color: "#23314f", margin: "0 0 6px" }}>{passport.worker_name}</h2>
693+
<p style={{ fontSize: 13, color: "#64748b", margin: "0 0 18px" }}>{passport.specialization}</p>
694+
{[
695+
{ label: isHi ? "आपका नाम" : "Your Name", key: "name", type: "text", placeholder: isHi ? "पूरा नाम" : "Full name" },
696+
{ label: isHi ? "ईमेल" : "Email", key: "email", type: "email", placeholder: "your@email.com" },
697+
{ label: isHi ? "Project Details" : "Project Details", key: "project", type: "textarea", placeholder: isHi ? "काम का विवरण..." : "Describe the work..." },
698+
{ label: isHi ? "शुरुआत की तारीख" : "Preferred Start Date", key: "date", type: "date", placeholder: "" },
699+
{ label: isHi ? "बजट" : "Budget", key: "budget", type: "text", placeholder: isHi ? "जैसे ₹500/दिन" : "e.g. ₹500/day" },
700+
].map((field) => (
701+
<div key={field.key} style={{ marginBottom: 14 }}>
702+
<label style={{ fontSize: 12, fontWeight: 700, color: "#23314f", display: "block", marginBottom: 6 }}>{field.label}</label>
703+
{field.type === "textarea" ? (
704+
<textarea value={hireForm[field.key]} onChange={(e) => setHireForm((p) => ({ ...p, [field.key]: e.target.value }))} placeholder={field.placeholder} rows={3} style={{ width: "100%", borderRadius: 10, border: "1px solid rgba(35,49,79,0.15)", padding: "9px 12px", fontSize: 13, fontFamily: "inherit", resize: "none", outline: "none", boxSizing: "border-box" }} />
705+
) : (
706+
<input type={field.type} value={hireForm[field.key]} onChange={(e) => setHireForm((p) => ({ ...p, [field.key]: e.target.value }))} placeholder={field.placeholder} style={{ width: "100%", borderRadius: 10, border: "1px solid rgba(35,49,79,0.15)", padding: "9px 12px", fontSize: 13, fontFamily: "inherit", outline: "none", boxSizing: "border-box" }} />
707+
)}
708+
</div>
709+
))}
710+
<button onClick={() => hireForm.name && hireForm.email && hireForm.project && setHireSent(true)} style={{ width: "100%", padding: 13, borderRadius: 999, border: "none", background: "#23314f", color: "#fff", fontSize: 15, fontWeight: 700, cursor: "pointer" }}>
711+
{isHi ? "Request भेजें" : "Send Hire Request"}
712+
</button>
713+
</>
714+
) : (
715+
<div style={{ textAlign: "center", padding: "18px 0 6px" }}>
716+
<p style={{ fontSize: 11, letterSpacing: 2, textTransform: "uppercase", color: "#22c55e", margin: 0 }}>{isHi ? "Request भेजी गई" : "Request Sent"}</p>
717+
<h2 style={{ fontFamily: "Fraunces, serif", fontSize: 26, color: "#23314f", margin: "8px 0" }}>{isHi ? "हो गया!" : "Done!"}</h2>
718+
<p style={{ fontSize: 14, color: "#64748b", lineHeight: 1.7 }}>{passport.worker_name} {isHi ? "को जल्द संपर्क किया जाएगा।" : "will receive your request shortly."}</p>
719+
<button onClick={() => setShowHireModal(false)} style={{ marginTop: 18, padding: "11px 24px", borderRadius: 999, border: "none", background: "#23314f", color: "#fff", fontSize: 14, fontWeight: 700, cursor: "pointer" }}>{isHi ? "बंद करें" : "Close"}</button>
720+
</div>
721+
)}
722+
</div>
723+
</div>
724+
)}
680725
);
681726
}

0 commit comments

Comments
 (0)