import React, { useState } from "react"; import { useNavigate } from "react-router-dom"; import { Button } from "@/components/ui/button"; import { CheckSquare, Grid3x3, X, Plus, FileText, LayoutDashboard, Settings, Bell, ChevronLeft, Bug } from "lucide-react"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; import { motion, AnimatePresence } from "framer-motion"; import { useAuth } from "@/lib/auth-context"; const QuickAccess: React.FC = () => { const [isOpen, setIsOpen] = useState(false); const [activeIndex, setActiveIndex] = useState(null); const navigate = useNavigate(); const { userData } = useAuth(); // Don't render if userData is null or user is client role if (!userData || userData?.roleName?.toLowerCase() === "client") { return null; } const handleNavigate = (path: string, index: number) => { setActiveIndex(index); setTimeout(() => { navigate(path); setIsOpen(false); setActiveIndex(null); }, 300); }; const tools = [ { name: "Tasks", icon: , path: "/tasks", shortcut: "Alt+T", color: "from-blue-400 to-indigo-500" }, { name: "Features", icon: , path: "/issues", shortcut: "Alt+F", color: "from-emerald-400 to-teal-500" }, { name: "Bugs", icon: , path: "/bugs", shortcut: "Alt+B", color: "from-red-400 to-rose-500" }, { name: "Dashboard", icon: , path: "/", shortcut: "Alt+D", color: "from-purple-400 to-violet-500" }, // { // name: "Files", // icon: , // path: "/files", // shortcut: "Alt+L", // color: "from-amber-400 to-orange-500" // }, // { // name: "Notifications", // icon: , // path: "/notifications", // shortcut: "Alt+N", // color: "from-pink-400 to-rose-500" // }, { name: "Settings", icon: , path: "/settings", shortcut: "Alt+S", color: "from-gray-400 to-gray-500" } ]; const slideVariants = { hidden: { opacity: 0, x: 100 }, visible: { opacity: 1, x: 0 }, exit: { opacity: 0, x: 100 } }; return (
{isOpen && (
Quick Access
{tools.map((tool, index) => ( handleNavigate(tool.path, index)} > {activeIndex === index && ( )}
{tool.icon}
{tool.name} {tool.shortcut}
{activeIndex === index && (
{tool.icon}
)}
))}
)}
{!isOpen && (

Open Quick Access

)}
); }; export default QuickAccess; // Add this CSS to your global styles /* .custom-scrollbar::-webkit-scrollbar { width: 5px; } .custom-scrollbar::-webkit-scrollbar-track { background: transparent; } .custom-scrollbar::-webkit-scrollbar-thumb { background-color: rgba(156, 163, 175, 0.3); border-radius: 20px; } .custom-scrollbar { scrollbar-width: thin; scrollbar-color: rgba(156, 163, 175, 0.3) transparent; } */