diff --git a/client/pages/Activity.tsx b/client/pages/Activity.tsx index 172d6699..7d59271d 100644 --- a/client/pages/Activity.tsx +++ b/client/pages/Activity.tsx @@ -543,9 +543,21 @@ function QuestsTab({ userId, onXPGain }: { userId?: string; onXPGain: (amount: n ); } -function JobsTab({ openExternalLink }: { openExternalLink: (url: string) => Promise }) { +function JobsTab({ openExternalLink, userId }: { openExternalLink: (url: string) => Promise; userId?: string }) { const [jobs, setJobs] = useState([]); const [loading, setLoading] = useState(true); + const [appliedJobs, setAppliedJobs] = useState>(() => { + try { + const saved = localStorage.getItem('aethex_job_applications'); + return saved ? new Set(JSON.parse(saved)) : new Set(); + } catch { + return new Set(); + } + }); + const [applyingTo, setApplyingTo] = useState(null); + const [showApplyModal, setShowApplyModal] = useState(null); + const [applyMessage, setApplyMessage] = useState(""); + const [applySuccess, setApplySuccess] = useState(null); useEffect(() => { const fetchJobs = async () => { @@ -564,6 +576,33 @@ function JobsTab({ openExternalLink }: { openExternalLink: (url: string) => Prom fetchJobs(); }, []); + const handleQuickApply = (jobId: string, e: MouseEvent) => { + e.stopPropagation(); + if (!userId) return; + setShowApplyModal(jobId); + setApplyMessage(""); + }; + + const submitApplication = () => { + if (!showApplyModal || !userId) return; + setApplyingTo(showApplyModal); + + setTimeout(() => { + const newApplied = new Set(appliedJobs).add(showApplyModal); + setAppliedJobs(newApplied); + try { + localStorage.setItem('aethex_job_applications', JSON.stringify([...newApplied])); + } catch {} + + setApplySuccess(showApplyModal); + setApplyingTo(null); + setShowApplyModal(null); + setApplyMessage(""); + + setTimeout(() => setApplySuccess(null), 3000); + }, 800); + }; + const categories = [ { label: "Full-Time", icon: Briefcase, color: "#60a5fa" }, { label: "Contract", icon: Target, color: "#4ade80" }, @@ -576,12 +615,101 @@ function JobsTab({ openExternalLink }: { openExternalLink: (url: string) => Prom ); + const selectedJob = jobs.find(j => j.id === showApplyModal); + return ( + + {applySuccess && ( + + + Application submitted! + + )} + + + + {showApplyModal && selectedJob && ( + setShowApplyModal(null)} + > + e.stopPropagation()} + className="bg-[#2b2d31] rounded-2xl p-5 w-full max-w-sm border border-[#3f4147] shadow-2xl" + > +
+

Quick Apply

+ +
+ +
+

{selectedJob.title}

+

{selectedJob.company_name || "Remote Opportunity"}

+
+ +
+ +