From 92a803a9bf42cc92ef33619e2dc3a4758aa38c68 Mon Sep 17 00:00:00 2001 From: Josh Date: Sun, 16 Mar 2025 15:14:25 +0000 Subject: [PATCH] Added MilestoneTracker.js draft --- src/components/MilestoneTracker.js | 212 +++++++++++++++++++++++++++++ user_profile.db | Bin 36864 -> 36864 bytes 2 files changed, 212 insertions(+) create mode 100644 src/components/MilestoneTracker.js diff --git a/src/components/MilestoneTracker.js b/src/components/MilestoneTracker.js new file mode 100644 index 0000000..c513ac6 --- /dev/null +++ b/src/components/MilestoneTracker.js @@ -0,0 +1,212 @@ +import React, { useState } from "react"; +import { Card, CardContent } from "@/components/ui/card"; +import { Button } from "@/components/ui/button"; +import { Progress } from "@/components/ui/progress"; +import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs"; +import { CheckCircle, Clock, Target, PlusCircle, Search } from "lucide-react"; +import { Input } from "@/components/ui/input"; +import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog"; + +const careerClusters = [ + "Software Development", + "Healthcare", + "Engineering", + "Finance", + "Education", + "Marketing", + "Cybersecurity", + "Construction", + "Legal", + "Data Science", + "Sales", + "Human Resources", + "Manufacturing", + "Aviation", + "Social Work", + "Design & UX", + "Hospitality", + "Retail Management", + "Real Estate", + "Transportation", + "Agriculture", + "Public Administration", + "Energy & Environment" +]; + +const universalPrerequisites = { + "Software Development": ["Learn a Programming Language", "Build and Deploy a Small Project", "Understand Data Structures & Algorithms"], + "Healthcare": ["Complete Required Certifications", "Pass Licensing Exam", "Gain Clinical Experience"], + "Engineering": ["Earn a Relevant Engineering Degree", "Obtain Engineering Certification (PE/EIT)", "Gain Hands-on Experience"], + "Finance": ["Earn a Bachelor's in Finance or Related Field", "Gain Experience with Financial Modeling", "Obtain CFA or CPA Certification"], + "Education": ["Complete a Teaching Credential", "Pass State Licensing Exam", "Gain Classroom Experience"], + "Marketing": ["Learn Digital Marketing Basics", "Build a Portfolio of Campaigns", "Gain Experience in Market Research"], + "Cybersecurity": ["Learn Network Security Fundamentals", "Obtain CompTIA Security+ or CISSP", "Gain Hands-on Security Experience"], + "Construction": ["Complete an Apprenticeship Program", "Earn a Safety Certification (OSHA)", "Gain On-Site Experience"], + "Legal": ["Earn a Law Degree (JD)", "Pass the Bar Exam", "Gain Internship Experience at a Law Firm"], + "Data Science": ["Learn Python & SQL", "Complete a Machine Learning Course", "Build a Data Science Portfolio"], + "Sales": ["Develop Strong Communication Skills", "Understand CRM Tools", "Gain Sales Experience"], + "Human Resources": ["Earn a Bachelor's in HR or Business", "Obtain PHR or SHRM Certification", "Gain HR Generalist Experience"], + "Manufacturing": ["Learn Manufacturing Processes", "Complete a Safety Training Course", "Gain Hands-on Experience in Production"], + "Aviation": ["Earn a Pilot’s License", "Pass FAA Certification Exams", "Gain Flight Hours"], + "Social Work": ["Earn a Social Work Degree", "Obtain State Licensing", "Gain Casework Experience"], + "Design & UX": ["Learn UI/UX Design Principles", "Build a Portfolio of Designs", "Gain Experience with Design Tools (Figma, Adobe XD)"], + "Hospitality": ["Gain Customer Service Experience", "Complete Hospitality Management Courses", "Develop Event Planning Skills"], + "Retail Management": ["Gain Experience in Retail Operations", "Learn Inventory & Budget Management", "Develop Leadership Skills"], + "Real Estate": ["Earn a Real Estate License", "Develop Sales & Negotiation Skills", "Understand Market Trends"], + "Transportation": ["Obtain a Commercial Driver's License (CDL)", "Complete Logistics Training", "Gain Hands-on Experience in Transportation"], + "Agriculture": ["Learn Crop & Soil Science Basics", "Understand Farm Equipment Operation", "Gain Hands-on Farming Experience"], + "Public Administration": ["Earn a Public Administration Degree", "Understand Government Policies & Regulations", "Gain Leadership Experience"], + "Energy & Environment": ["Learn Renewable Energy Technologies", "Understand Environmental Regulations", "Gain Fieldwork Experience"] + }; + +const MilestoneTracker = () => { + const [activeTab, setActiveTab] = useState("career"); + const [customMilestones, setCustomMilestones] = useState({ career: [], financial: [], retirement: [] }); + const [isDialogOpen, setIsDialogOpen] = useState(false); + const [newMilestone, setNewMilestone] = useState(""); + const [careerSearch, setCareerSearch] = useState(""); + const [filteredCareers, setFilteredCareers] = useState(careerClusters); + + + useEffect(() => { + const fetchUserProfile = async () => { + try { + const response = await fetch("/api/user/profile", { + method: "GET", + credentials: "include", // Ensure cookies/session are sent + }); + if (response.ok) { + const data = await response.json(); + setIsPremiumUser(data.is_premium === 1); // Expecting { is_premium: 0 or 1 } + } else { + setIsPremiumUser(false); // Default to false if there's an error + } + } catch (error) { + console.error("Error fetching user profile:", error); + setIsPremiumUser(false); + } + }; + fetchUserProfile(); + }, []); + + if (isPremiumUser === null) { + return
Loading...
; // Show loading state while fetching + } + + if (!isPremiumUser) { + return ( +
+ +

Access Restricted

+

Upgrade to Aptiva Premium to access the Milestone Tracker.

+ +
+ ); + } + + const handleAddMilestone = () => { + if (newMilestone.trim() !== "") { + setCustomMilestones((prev) => ({ + ...prev, + [activeTab]: [...prev[activeTab], { title: newMilestone, status: "upcoming", progress: 0 }], + })); + setNewMilestone(""); + setIsDialogOpen(false); + } + }; + + const handleCareerSearch = (e) => { + const query = e.target.value.toLowerCase(); + setCareerSearch(query); + setFilteredCareers( + careerClusters.filter((career) => career.toLowerCase().includes(query)) + ); + }; + + return ( +
+

Milestone Tracker

+ + {/* Career Search Section */} +
+

Search for a Career Path

+ +
+ {filteredCareers.map((career, index) => ( +
+ {career} +
+ ))} +
+
+ + {/* Milestone Tracker Section */} + + + Career + Financial + Retirement + + + + {/* Add Milestone Section */} + + + + + + Add a New Milestone + + setNewMilestone(e.target.value)} placeholder="Enter milestone title" /> + + + + + + + {/* Display User-Added Milestones */} + + {customMilestones[activeTab].map((milestone, index) => ( + + +
+ {milestone.status === "completed" && } + {milestone.status === "in-progress" && } + {milestone.status === "upcoming" && } +

{milestone.title}

+
+ +
+
+ ))} +
+ + + + + + + + Add a New Milestone + + setNewMilestone(e.target.value)} placeholder="Enter milestone title" /> + + + + + +
+ ); +}; + + +export default MilestoneTracker; \ No newline at end of file diff --git a/user_profile.db b/user_profile.db index 786e7d5e02a66efe16a33930806ba4be51f2d3f7..9bbe93a47d833e9536c9a4b39f6d1a144293704b 100644 GIT binary patch delta 152 zcmZozz|^pSX@az%2m=EHClJE``$QdMeh~(}WJX>dW(E${5C+zejd{;lxSH%3*~L{= z8C&c(^YTbA%Ihd(7RMJ9rRHXq<|=slg}A!A1}V6>x;cjWgeVwjZl21P$I8ODhEaKA xqdengHQonI9IF}lSM%5KTWuCp(C43QE1$;`%*e$cDQPS&=+DHtdAq!40RS^4A_f2e delta 117 zcmZozz|^pSX@az%5Ca1PClJE`+e95>ejx_EWJX@TH4GeVQyF-eH|9NK**L+Gar0ER zJXWqI1x9vpRaM3o=FM@e5{!(Ro7H$9FmbG5;9tXE!*8`&P(h!6vaNg`4?_?mCxfJ< OvACc=)8_5+o&^9u(ioEf