Switch to version 1: remove src/app/admin/page.tsx
This commit is contained in:
@@ -1,334 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
|
||||
import NavbarStyleCentered from "@/components/navbar/NavbarStyleCentered/NavbarStyleCentered";
|
||||
import { useState } from "react";
|
||||
import { BarChart3, Users, Briefcase, FileText, TrendingUp, LogOut } from "lucide-react";
|
||||
|
||||
const navItems = [
|
||||
{ name: "Search Jobs", id: "" },
|
||||
{ name: "Post a Job", id: "" },
|
||||
{ name: "Admin", id: "/admin" },
|
||||
{ name: "Browse", id: "" },
|
||||
{ name: "Contact", id: "" },
|
||||
];
|
||||
|
||||
type TabType = "jobs" | "applications" | "users" | "analytics";
|
||||
|
||||
export default function AdminDashboard() {
|
||||
const [activeTab, setActiveTab] = useState<TabType>("jobs");
|
||||
const [jobs] = useState([
|
||||
{ id: 1, title: "Senior Developer", company: "Tech Corp", status: "Active", applications: 12, posted: "2 days ago" },
|
||||
{ id: 2, title: "Product Manager", company: "Startup Inc", status: "Active", applications: 8, posted: "5 days ago" },
|
||||
{ id: 3, title: "Designer", company: "Creative Agency", status: "Inactive", applications: 5, posted: "10 days ago" },
|
||||
]);
|
||||
|
||||
const [applications] = useState([
|
||||
{ id: 1, candidate: "John Smith", position: "Senior Developer", status: "Under Review", appliedDate: "2025-01-20" },
|
||||
{ id: 2, candidate: "Sarah Johnson", position: "Product Manager", status: "Interview", appliedDate: "2025-01-19" },
|
||||
{ id: 3, candidate: "Mike Davis", position: "Senior Developer", status: "Rejected", appliedDate: "2025-01-18" },
|
||||
]);
|
||||
|
||||
const [users] = useState([
|
||||
{ id: 1, name: "Alice Chen", email: "alice@example.com", role: "Job Seeker", joined: "2025-01-10", status: "Active" },
|
||||
{ id: 2, name: "Bob Wilson", email: "bob@example.com", role: "Employer", joined: "2025-01-05", status: "Active" },
|
||||
{ id: 3, name: "Carol White", email: "carol@example.com", role: "Job Seeker", joined: "2024-12-20", status: "Inactive" },
|
||||
]);
|
||||
|
||||
const [analytics] = useState({
|
||||
totalJobs: 284,
|
||||
activeApplications: 156,
|
||||
totalUsers: 2341,
|
||||
avgTimeToHire: "18 days", monthlyGrowth: "+12.5%", conversionRate: "8.3%"});
|
||||
|
||||
const handleLogout = () => {
|
||||
window.location.href = "/";
|
||||
};
|
||||
|
||||
return (
|
||||
<ThemeProvider
|
||||
defaultButtonVariant="text-stagger"
|
||||
defaultTextAnimation="reveal-blur"
|
||||
borderRadius="pill"
|
||||
contentWidth="medium"
|
||||
sizing="mediumLargeSizeLargeTitles"
|
||||
background="none"
|
||||
cardStyle="solid"
|
||||
primaryButtonStyle="gradient"
|
||||
secondaryButtonStyle="solid"
|
||||
headingFontWeight="bold"
|
||||
>
|
||||
<div id="nav" data-section="nav">
|
||||
<NavbarStyleCentered
|
||||
brandName="Jobee Admin"
|
||||
navItems={navItems}
|
||||
button={{
|
||||
text: "Logout", onClick: handleLogout,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="min-h-screen bg-slate-50 pt-24 pb-12">
|
||||
<div className="mx-auto max-w-7xl px-4">
|
||||
<h1 className="text-4xl font-bold text-slate-900 mb-8">Admin Dashboard</h1>
|
||||
|
||||
{/* Tab Navigation */}
|
||||
<div className="flex gap-4 mb-8 border-b border-slate-200">
|
||||
<button
|
||||
onClick={() => setActiveTab("jobs")}
|
||||
className={`pb-4 px-4 font-semibold transition-colors ${
|
||||
activeTab === "jobs"
|
||||
? "text-blue-600 border-b-2 border-blue-600"
|
||||
: "text-slate-600 hover:text-slate-900"
|
||||
}`}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<Briefcase size={20} />
|
||||
Job Management
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setActiveTab("applications")}
|
||||
className={`pb-4 px-4 font-semibold transition-colors ${
|
||||
activeTab === "applications"
|
||||
? "text-blue-600 border-b-2 border-blue-600"
|
||||
: "text-slate-600 hover:text-slate-900"
|
||||
}`}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<FileText size={20} />
|
||||
Applications
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setActiveTab("users")}
|
||||
className={`pb-4 px-4 font-semibold transition-colors ${
|
||||
activeTab === "users"
|
||||
? "text-blue-600 border-b-2 border-blue-600"
|
||||
: "text-slate-600 hover:text-slate-900"
|
||||
}`}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<Users size={20} />
|
||||
User Management
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setActiveTab("analytics")}
|
||||
className={`pb-4 px-4 font-semibold transition-colors ${
|
||||
activeTab === "analytics"
|
||||
? "text-blue-600 border-b-2 border-blue-600"
|
||||
: "text-slate-600 hover:text-slate-900"
|
||||
}`}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<BarChart3 size={20} />
|
||||
Analytics
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Job Management Tab */}
|
||||
{activeTab === "jobs" && (
|
||||
<div className="space-y-4">
|
||||
<div className="flex justify-between items-center mb-6">
|
||||
<h2 className="text-2xl font-bold text-slate-900">Job Listings</h2>
|
||||
<button className="px-6 py-2 bg-blue-600 text-white rounded-lg font-semibold hover:bg-blue-700 transition">
|
||||
+ New Job
|
||||
</button>
|
||||
</div>
|
||||
<div className="bg-white rounded-lg shadow overflow-hidden">
|
||||
<table className="w-full">
|
||||
<thead className="bg-slate-100 border-b border-slate-200">
|
||||
<tr>
|
||||
<th className="px-6 py-3 text-left text-sm font-semibold text-slate-900">Job Title</th>
|
||||
<th className="px-6 py-3 text-left text-sm font-semibold text-slate-900">Company</th>
|
||||
<th className="px-6 py-3 text-left text-sm font-semibold text-slate-900">Status</th>
|
||||
<th className="px-6 py-3 text-left text-sm font-semibold text-slate-900">Applications</th>
|
||||
<th className="px-6 py-3 text-left text-sm font-semibold text-slate-900">Posted</th>
|
||||
<th className="px-6 py-3 text-left text-sm font-semibold text-slate-900">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{jobs.map((job) => (
|
||||
<tr key={job.id} className="border-b border-slate-200 hover:bg-slate-50">
|
||||
<td className="px-6 py-4 text-sm text-slate-900 font-medium">{job.title}</td>
|
||||
<td className="px-6 py-4 text-sm text-slate-600">{job.company}</td>
|
||||
<td className="px-6 py-4 text-sm">
|
||||
<span className={`px-3 py-1 rounded-full text-xs font-semibold ${
|
||||
job.status === "Active"
|
||||
? "bg-green-100 text-green-700"
|
||||
: "bg-gray-100 text-gray-700"
|
||||
}`}>
|
||||
{job.status}
|
||||
</span>
|
||||
</td>
|
||||
<td className="px-6 py-4 text-sm text-slate-600">{job.applications}</td>
|
||||
<td className="px-6 py-4 text-sm text-slate-600">{job.posted}</td>
|
||||
<td className="px-6 py-4 text-sm space-x-2">
|
||||
<button className="px-3 py-1 text-blue-600 hover:bg-blue-50 rounded transition">Edit</button>
|
||||
<button className="px-3 py-1 text-red-600 hover:bg-red-50 rounded transition">Delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Applications Management Tab */}
|
||||
{activeTab === "applications" && (
|
||||
<div className="space-y-4">
|
||||
<h2 className="text-2xl font-bold text-slate-900 mb-6">Application Management</h2>
|
||||
<div className="bg-white rounded-lg shadow overflow-hidden">
|
||||
<table className="w-full">
|
||||
<thead className="bg-slate-100 border-b border-slate-200">
|
||||
<tr>
|
||||
<th className="px-6 py-3 text-left text-sm font-semibold text-slate-900">Candidate</th>
|
||||
<th className="px-6 py-3 text-left text-sm font-semibold text-slate-900">Position</th>
|
||||
<th className="px-6 py-3 text-left text-sm font-semibold text-slate-900">Status</th>
|
||||
<th className="px-6 py-3 text-left text-sm font-semibold text-slate-900">Applied Date</th>
|
||||
<th className="px-6 py-3 text-left text-sm font-semibold text-slate-900">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{applications.map((app) => (
|
||||
<tr key={app.id} className="border-b border-slate-200 hover:bg-slate-50">
|
||||
<td className="px-6 py-4 text-sm text-slate-900 font-medium">{app.candidate}</td>
|
||||
<td className="px-6 py-4 text-sm text-slate-600">{app.position}</td>
|
||||
<td className="px-6 py-4 text-sm">
|
||||
<span className={`px-3 py-1 rounded-full text-xs font-semibold ${
|
||||
app.status === "Interview"
|
||||
? "bg-blue-100 text-blue-700"
|
||||
: app.status === "Under Review"
|
||||
? "bg-yellow-100 text-yellow-700"
|
||||
: "bg-red-100 text-red-700"
|
||||
}`}>
|
||||
{app.status}
|
||||
</span>
|
||||
</td>
|
||||
<td className="px-6 py-4 text-sm text-slate-600">{app.appliedDate}</td>
|
||||
<td className="px-6 py-4 text-sm space-x-2">
|
||||
<button className="px-3 py-1 text-blue-600 hover:bg-blue-50 rounded transition">View</button>
|
||||
<button className="px-3 py-1 text-green-600 hover:bg-green-50 rounded transition">Approve</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* User Management Tab */}
|
||||
{activeTab === "users" && (
|
||||
<div className="space-y-4">
|
||||
<h2 className="text-2xl font-bold text-slate-900 mb-6">User Management</h2>
|
||||
<div className="bg-white rounded-lg shadow overflow-hidden">
|
||||
<table className="w-full">
|
||||
<thead className="bg-slate-100 border-b border-slate-200">
|
||||
<tr>
|
||||
<th className="px-6 py-3 text-left text-sm font-semibold text-slate-900">Name</th>
|
||||
<th className="px-6 py-3 text-left text-sm font-semibold text-slate-900">Email</th>
|
||||
<th className="px-6 py-3 text-left text-sm font-semibold text-slate-900">Role</th>
|
||||
<th className="px-6 py-3 text-left text-sm font-semibold text-slate-900">Joined</th>
|
||||
<th className="px-6 py-3 text-left text-sm font-semibold text-slate-900">Status</th>
|
||||
<th className="px-6 py-3 text-left text-sm font-semibold text-slate-900">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{users.map((user) => (
|
||||
<tr key={user.id} className="border-b border-slate-200 hover:bg-slate-50">
|
||||
<td className="px-6 py-4 text-sm text-slate-900 font-medium">{user.name}</td>
|
||||
<td className="px-6 py-4 text-sm text-slate-600">{user.email}</td>
|
||||
<td className="px-6 py-4 text-sm text-slate-600">{user.role}</td>
|
||||
<td className="px-6 py-4 text-sm text-slate-600">{user.joined}</td>
|
||||
<td className="px-6 py-4 text-sm">
|
||||
<span className={`px-3 py-1 rounded-full text-xs font-semibold ${
|
||||
user.status === "Active"
|
||||
? "bg-green-100 text-green-700"
|
||||
: "bg-gray-100 text-gray-700"
|
||||
}`}>
|
||||
{user.status}
|
||||
</span>
|
||||
</td>
|
||||
<td className="px-6 py-4 text-sm space-x-2">
|
||||
<button className="px-3 py-1 text-blue-600 hover:bg-blue-50 rounded transition">Edit</button>
|
||||
<button className="px-3 py-1 text-red-600 hover:bg-red-50 rounded transition">Disable</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Analytics Tab */}
|
||||
{activeTab === "analytics" && (
|
||||
<div className="space-y-6">
|
||||
<h2 className="text-2xl font-bold text-slate-900 mb-6">Analytics Overview</h2>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
<div className="bg-white rounded-lg shadow p-6 border-l-4 border-blue-600">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<p className="text-slate-600 text-sm font-medium">Total Jobs</p>
|
||||
<p className="text-3xl font-bold text-slate-900 mt-2">{analytics.totalJobs}</p>
|
||||
</div>
|
||||
<Briefcase className="text-blue-600" size={40} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-white rounded-lg shadow p-6 border-l-4 border-green-600">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<p className="text-slate-600 text-sm font-medium">Active Applications</p>
|
||||
<p className="text-3xl font-bold text-slate-900 mt-2">{analytics.activeApplications}</p>
|
||||
</div>
|
||||
<FileText className="text-green-600" size={40} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-white rounded-lg shadow p-6 border-l-4 border-purple-600">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<p className="text-slate-600 text-sm font-medium">Total Users</p>
|
||||
<p className="text-3xl font-bold text-slate-900 mt-2">{analytics.totalUsers}</p>
|
||||
</div>
|
||||
<Users className="text-purple-600" size={40} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-white rounded-lg shadow p-6 border-l-4 border-yellow-600">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<p className="text-slate-600 text-sm font-medium">Avg Time to Hire</p>
|
||||
<p className="text-3xl font-bold text-slate-900 mt-2">{analytics.avgTimeToHire}</p>
|
||||
</div>
|
||||
<TrendingUp className="text-yellow-600" size={40} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-white rounded-lg shadow p-6 border-l-4 border-red-600">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<p className="text-slate-600 text-sm font-medium">Monthly Growth</p>
|
||||
<p className="text-3xl font-bold text-slate-900 mt-2">{analytics.monthlyGrowth}</p>
|
||||
</div>
|
||||
<BarChart3 className="text-red-600" size={40} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-white rounded-lg shadow p-6 border-l-4 border-indigo-600">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<p className="text-slate-600 text-sm font-medium">Conversion Rate</p>
|
||||
<p className="text-3xl font-bold text-slate-900 mt-2">{analytics.conversionRate}</p>
|
||||
</div>
|
||||
<BarChart3 className="text-indigo-600" size={40} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user