editJob(job.id)} key={job.id} className="border-b border-gray-100 pb-3 last:border-0 last:pb-0">
diff --git a/frontend/src/app/alumni/search/page.js b/frontend/src/app/alumni/search/page.js
index 80e8123..4bb1e27 100644
--- a/frontend/src/app/alumni/search/page.js
+++ b/frontend/src/app/alumni/search/page.js
@@ -1,323 +1,225 @@
"use client";
-import React, { useState } from 'react';
-import { Search, Filter, MapPin, Briefcase, GraduationCap, ChevronDown, ChevronUp, X } from 'lucide-react';
-import Footer from '@/components/footer';
-const AlumniSearchPage = () => {
- const [searchTerm, setSearchTerm] = useState('');
- const [industryFilter, setIndustryFilter] = useState('');
- const [locationFilter, setLocationFilter] = useState('');
- const [graduationYearFilter, setGraduationYearFilter] = useState('');
- const [showFilters, setShowFilters] = useState(false);
- const [selectedAlumni, setSelectedAlumni] = useState(null);
+import React, { useState, useEffect } from "react";
+import { useRouter } from "next/navigation";
+import axios from "axios";
+import Link from "next/link";
+import Image from "next/image";
+import Footer from "@/components/footer";
+import Navbar from "@/components/Navbar";
- // Sample alumni data
- const alumniData = [
- {
- id: 1,
- name: 'Alex Johnson',
- gradYear: 2018,
- major: 'Computer Science',
- industry: 'Technology',
- company: 'Google',
- position: 'Software Engineer',
- location: 'San Francisco, CA',
- profileImg: '/api/placeholder/100/100',
- bio: 'Full-stack developer with expertise in React and Node.js. Passionate about creating user-friendly applications and mentoring new developers.',
- skills: ['JavaScript', 'React', 'Node.js', 'Cloud Computing', 'System Design'],
- openToMentoring: true
- },
- {
- id: 2,
- name: 'Sarah Miller',
- gradYear: 2020,
- major: 'Business Administration',
- industry: 'Finance',
- company: 'Morgan Stanley',
- position: 'Investment Analyst',
- location: 'New York, NY',
- profileImg: '/api/placeholder/100/100',
- bio: 'Investment professional focused on emerging markets. Completed MBA in 2022. Previously worked in consulting.',
- skills: ['Financial Analysis', 'Investment Management', 'Market Research', 'Strategic Planning'],
- openToMentoring: true
- },
- {
- id: 3,
- name: 'David Chen',
- gradYear: 2015,
- major: 'Biomedical Engineering',
- industry: 'Healthcare',
- company: 'Johnson & Johnson',
- position: 'Product Manager',
- location: 'Boston, MA',
- profileImg: '/api/placeholder/100/100',
- bio: 'Product manager with background in biomedical engineering. Working on innovative medical devices and healthcare technology solutions.',
- skills: ['Product Management', 'Medical Devices', 'Regulatory Compliance', 'R&D'],
- openToMentoring: false
- },
- {
- id: 4,
- name: 'Priya Patel',
- gradYear: 2019,
- major: 'Marketing',
- industry: 'Media',
- company: 'Netflix',
- position: 'Marketing Strategist',
- location: 'Los Angeles, CA',
- profileImg: '/api/placeholder/100/100',
- bio: 'Digital marketing specialist with focus on content strategy and audience engagement. Previously at Disney and Meta.',
- skills: ['Digital Marketing', 'Content Strategy', 'Brand Development', 'Analytics'],
- openToMentoring: true
- }
- ];
-
- const industries = ['Technology', 'Finance', 'Healthcare', 'Media', 'Education', 'Manufacturing'];
- const locations = ['San Francisco, CA', 'New York, NY', 'Boston, MA', 'Los Angeles, CA', 'Chicago, IL', 'Seattle, WA'];
- const graduationYears = [2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023];
-
- // Filter alumni based on search and filters
- const filteredAlumni = alumniData.filter(alumni => {
- const matchesSearch = searchTerm === '' ||
- alumni.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
- alumni.company.toLowerCase().includes(searchTerm.toLowerCase()) ||
- alumni.position.toLowerCase().includes(searchTerm.toLowerCase());
-
- const matchesIndustry = industryFilter === '' || alumni.industry === industryFilter;
- const matchesLocation = locationFilter === '' || alumni.location === locationFilter;
- const matchesGradYear = graduationYearFilter === '' || alumni.gradYear.toString() === graduationYearFilter;
-
- return matchesSearch && matchesIndustry && matchesLocation && matchesGradYear;
+export default function AlumniSearch() {
+ const [searchParams, setSearchParams] = useState({
+ name: "",
+ graduationYear: "",
+ company: ""
});
-
- const resetFilters = () => {
- setIndustryFilter('');
- setLocationFilter('');
- setGraduationYearFilter('');
+
+ const [results, setResults] = useState([]);
+ const [isLoading, setIsLoading] = useState(false);
+ const [error, setError] = useState("");
+ const [totalResults, setTotalResults] = useState(0);
+
+ const router = useRouter();
+
+ const handleSearch = async (e) => {
+ if (e) e.preventDefault();
+ setError("");
+ setIsLoading(true);
+
+ try {
+ // Filter out empty search parameters
+ const queryParams = Object.entries(searchParams)
+ .filter(([_, value]) => value !== "")
+ .map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
+ .join("&");
+
+ const { data } = await axios.get(`http://localhost:5000/api/users/search?${queryParams}`);
+
+ setResults(data.alumni || []);
+ setTotalResults(data.total || data.alumni?.length || 0);
+ } catch (err) {
+ setError(err.response?.data?.error || "Failed to search alumni");
+ console.error(err);
+ setResults([]);
+ } finally {
+ setIsLoading(false);
+ }
};
-
+
+ const handleInputChange = (e) => {
+ const { name, value } = e.target;
+ setSearchParams(prev => ({
+ ...prev,
+ [name]: value
+ }));
+ };
+
+ const clearSearch = () => {
+ setSearchParams({
+ name: "",
+ graduationYear: "",
+ company: ""
+ });
+ setResults([]);
+ };
+
+ // Handle graduation year range for dropdown (last 30 years)
+ const currentYear = new Date().getFullYear();
+ const graduationYears = [];
+ for (let year = currentYear; year >= currentYear - 30; year--) {
+ graduationYears.push(year);
+ }
+
return (
-
-
-
Find Alumni
-
- {/* Search Bar */}
-
-
-
+ <>
+
+
+
+ {/*
+
Alumni Directory
+
-
setSearchTerm(e.target.value)}
- />
-
+
*/}
- {/* Filters Toggle */}
-
-
+
+
Search Alumni
- {/* Filters Container */}
- {showFilters && (
-
-
- {/* Industry Filter */}
-
-
-
-
-
- {/* Location Filter */}
-
-
-
-
-
- {/* Graduation Year Filter */}
-
-
-
-
+ {error && (
+
+ {error}
+
+ )}
+
+
-
- {/* Results Count */}
-
- Found {filteredAlumni.length} alumni
-
-
- {/* Alumni List */}
-
- {filteredAlumni.map(alumni => (
-
setSelectedAlumni(alumni)}
- >
-
-
-

-
-
{alumni.name}
-
{alumni.position}
-
{alumni.company}
-
-
-
-
-
-
- {alumni.industry}
-
-
-
- {alumni.location}
-
-
-
- {alumni.major}, Class of {alumni.gradYear}
-
-
-
- {alumni.openToMentoring && (
-
-
- Open to Mentoring
-
-
- )}
-
-
- ))}
+
- {/* No Results */}
- {filteredAlumni.length === 0 && (
-
-
No alumni match your search criteria
-
+ {/* Results Section */}
+
+
+
+ {results.length > 0 ? `${totalResults} Alumni Found` : "Alumni Directory"}
+
- )}
-
- {/* Alumni Detail Modal */}
- {selectedAlumni && (
-
-
-
-
-
-

-
-
{selectedAlumni.name}
-
{selectedAlumni.position} at {selectedAlumni.company}
-
{selectedAlumni.location}
+
+ {isLoading ? (
+
+
+
Searching for alumni...
+
+ ) : results.length > 0 ? (
+
+ {results.map((alumni) => (
+
+
+
+
+ {alumni.firstName.charAt(0)}{alumni.lastName.charAt(0)}
+
+
+
+
{alumni.firstName} {alumni.lastName}
+ Class of {alumni.graduationYear}
+
+
{alumni.degreeProgram} in {alumni.major}
+ {alumni.company && alumni.jobTitle && (
+
{alumni.jobTitle} at {alumni.company}
+ )}
+ {alumni.email && alumni.phone && (
+
{alumni.phone}, {alumni.email}
+ )}
+
-
-
-
-
-
-
About
-
{selectedAlumni.bio}
-
-
-
-
Education
-
{selectedAlumni.major}, Class of {selectedAlumni.gradYear}
-
-
-
-
Skills
-
- {selectedAlumni.skills.map(skill => (
-
- {skill}
-
- ))}
-
-
-
-
- {selectedAlumni.openToMentoring && (
-
- )}
-
+
+ ))}
+
+ ) : (
+
+
+
No alumni found
+
Try adjusting your search criteria
-
- )}
+ )}
+
-
+
+ >
);
-};
-
-export default AlumniSearchPage;
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/frontend/src/components/Navbar/index.jsx b/frontend/src/components/Navbar/index.jsx
index b3a0a85..7a2aeb0 100644
--- a/frontend/src/components/Navbar/index.jsx
+++ b/frontend/src/components/Navbar/index.jsx
@@ -53,6 +53,7 @@ const Navbar = () => {
{/*
Forums */}
Jobs & Internships
Events
+
Search