import { motion } from "framer-motion";
import { Link, useLocation } from "wouter";
import { useQuery } from "@tanstack/react-query";
import { useAuth } from "@/lib/auth";
import {
Users, FileCode, Shield, Activity, LogOut,
BarChart3, User, ExternalLink
} from "lucide-react";
export default function AdminProjects() {
const { user, logout } = useAuth();
const [, setLocation] = useLocation();
const { data: projects, isLoading } = useQuery({
queryKey: ["projects"],
queryFn: async () => {
const res = await fetch("/api/projects");
return res.json();
},
});
const handleLogout = async () => {
await logout();
setLocation("/");
};
return (
{/* Sidebar */}
{user?.username}
{user?.isAdmin ? "Administrator" : "Member"}
{/* Main Content */}
Projects
{projects?.length || 0} active projects
{/* Projects Grid */}
{isLoading ? (
Loading projects...
) : projects?.length === 0 ? (
No projects found
) : (
projects?.map((project: any) => (
{project.title}
{project.engine}
{project.status}
{project.description || 'No description'}
{/* Progress Bar */}
Progress
{project.progress}%
{project.priority}
{project.github_url && (
GitHub
)}
))
)}
);
}
function NavItem({ icon, label, href, active = false }: {
icon: React.ReactNode;
label: string;
href: string;
active?: boolean;
}) {
return (
{icon}
{label}
);
}