Files
imphnen-frontend-service/libs/ui/src/organisms/backoffice-sidebar/backoffice-sidebar.tsx
T

98 lines
3.3 KiB
TypeScript
Raw Normal View History

2025-03-27 13:18:14 +07:00
import {
AppstoreOutlined,
AuditOutlined,
2025-03-28 22:41:55 +07:00
InboxOutlined,
2025-03-27 13:18:14 +07:00
LogoutOutlined,
UserOutlined,
} from '@ant-design/icons';
import { Button } from '../../atoms';
2025-03-27 07:46:15 +07:00
import { FC, ReactElement } from 'react';
2025-03-27 22:28:40 +07:00
import { Link, useLocation, useNavigate } from 'react-router-dom';
2025-03-27 07:46:15 +07:00
export const BackofficeSidebar: FC = (): ReactElement => {
const location = useLocation();
2025-03-27 22:28:40 +07:00
const navigate = useNavigate();
2025-03-27 07:46:15 +07:00
const isActive = (path: string) => location.pathname.includes(path);
const handleLogout = () => {
sessionStorage.removeItem('access_token');
localStorage.removeItem('refresh_token');
navigate('/');
};
2025-03-27 07:46:15 +07:00
return (
<aside className="sticky top-0 left-0 w-[280px] bg-white min-h-screen py-[60px] px-[28px] shadow-xl flex flex-col justify-between">
2025-03-27 13:18:14 +07:00
<div className="flex flex-col gap-20 justify-between items-center">
2025-03-27 07:46:15 +07:00
{/* Logo */}
2025-03-27 13:18:14 +07:00
<img src="/logos/simple.svg" alt="IMPHNEN Logo" className="w-[150px]" />
2025-03-27 07:46:15 +07:00
{/* Navigation Menu */}
2025-03-27 13:18:14 +07:00
<nav className="flex flex-col gap-4 w-full">
2025-03-27 07:46:15 +07:00
<Link
to="/dashboard"
2025-03-27 13:18:14 +07:00
className={`flex items-center justify-items-start gap-3 px-[8px] py-[10px] ${
2025-03-27 07:46:15 +07:00
isActive('/dashboard')
2025-03-27 13:18:14 +07:00
? 'bg-primary-500 text-white rounded-md'
2025-03-27 07:46:15 +07:00
: 'text-gray-700 hover:bg-gray-100'
}`}
>
2025-03-27 13:18:14 +07:00
<AppstoreOutlined className="text-[20px]" />
<span className="text-p3 font-medium">Dashboard & Set Gacha</span>
2025-03-27 07:46:15 +07:00
</Link>
<Link
2025-03-27 15:06:30 +07:00
to="/accounts"
2025-03-27 13:18:14 +07:00
className={`flex items-center justify-items-start gap-3 px-[8px] py-[10px] ${
isActive('/accounts')
? 'bg-primary-500 text-white rounded-md'
2025-03-27 07:46:15 +07:00
: 'text-gray-700 hover:bg-gray-100'
}`}
>
2025-03-27 13:18:14 +07:00
<UserOutlined className="text-[20px]" />
<span className="text-p3 font-medium">Data Akun</span>
2025-03-27 07:46:15 +07:00
</Link>
<Link
to="/transactions"
2025-03-27 13:18:14 +07:00
className={`flex items-center justify-items-start gap-3 px-[8px] py-[10px] ${
2025-03-27 07:46:15 +07:00
isActive('/transactions')
2025-03-27 13:18:14 +07:00
? 'bg-primary-500 text-white rounded-md'
2025-03-27 07:46:15 +07:00
: 'text-gray-700 hover:bg-gray-100'
}`}
>
2025-03-27 13:18:14 +07:00
<AuditOutlined className="text-[20px]" />
<span className="text-p3 font-medium">Validasi Transaksi</span>
2025-03-27 07:46:15 +07:00
</Link>
2025-03-28 22:41:55 +07:00
<Link
to="/prizes"
className={`flex items-center justify-items-start gap-3 px-[8px] py-[10px] ${
isActive('/prizes')
? 'bg-primary-500 text-white rounded-md'
: 'text-gray-700 hover:bg-gray-100'
}`}
>
<InboxOutlined className="text-[20px]" />
<span className="text-p3 font-medium">Data Pengiriman Hadiah</span>
</Link>
2025-03-27 07:46:15 +07:00
</nav>
</div>
{/* Log Out Button */}
2025-03-27 13:18:14 +07:00
<div className="w-full">
<hr className="mb-5 border-primary-200" />
2025-03-27 22:28:40 +07:00
2025-03-27 13:18:14 +07:00
<Button
onClick={handleLogout}
2025-03-27 13:18:14 +07:00
variant="text"
className="items-start justify-start gap-3 px-[8px] py-[10px] text-gray-700 hover:text-red-500 transition-colors w-full"
>
<LogoutOutlined className="text-[20px]" />
<span className="text-p3 font-medium">Log Out</span>
</Button>
2025-03-27 07:46:15 +07:00
</div>
</aside>
);
};