import React, { useState } from 'react'; import { Link, useLocation } from 'react-router-dom'; import NavLink from './NavLink'; import SendForSign from './SendForSign'; import { HiTemplate } from "react-icons/hi"; import { BsLayoutSidebarInsetReverse, BsLayoutSidebarInset } from "react-icons/bs"; import { FaHome } from "react-icons/fa"; import { RiLogoutBoxLine } from 'react-icons/ri'; import { IoSettingsOutline } from "react-icons/io5"; import axios from 'axios'; import { MdManageAccounts } from 'react-icons/md'; import { GrContactInfo, GrTransaction } from 'react-icons/gr'; import logoSME from '../../assets/SMELogo.png' type SideBarProps = { showSideBar: boolean; setShowSideBar: React.Dispatch>; }; type MenuPathMap = { [key: string]: string; } const menuPathMap: MenuPathMap = { '/': 'Home', '/templates': 'Templates', // '/accounts': 'Accounts', '/transactions': 'Transactions', '/contacts': 'Contacts' }; const SideBar: React.FC = ({ showSideBar, setShowSideBar }) => { const location = useLocation(); const [showLogoutModal, setShowLogoutModal] = useState(false); const handleLogoutConfirm = async () => { try { await axios.post(`${import.meta.env.VITE_BASE_URI}/api/auth/logout`, {}, { withCredentials: true, headers: { "ngrok-skip-browser-warning": "69420" } } ); sessionStorage.clear(); // Redirect to login or refresh the page after logout window.location.href = '/login'; } catch (err) { console.error('Logout failed:', err); } }; return ( <> {/* Side Bar */}
{/* Menu */}

{showSideBar ? :

SME

}

{/* SideBar Toggle Button */}
setShowSideBar(!showSideBar)} className='absolute top-[100%] translate-y-[-100%] right-0 bg-[var(--dashBoardBg)] p-2 rounded-tl-sm rounded-bl-sm cursor-pointer transition-colors' >
{showSideBar ? ( ) : ( )}
{/* Bottom Action Buttons */}
{/* {showSideBar && Settings} */}
{/* Logout Confirmation Modal */} {showLogoutModal && (

Confirm Logout

Are you sure you want to log out?

)} ); }; export default SideBar;