'use client'; import React, { useState } from 'react'; import { MagnifyingGlassIcon, BellIcon, Bars3Icon, ChevronDownIcon } from '@heroicons/react/24/outline'; import { cn } from '@/utils/cn'; import { useAuth } from '@/contexts/AuthContext'; import Link from 'next/link'; interface TopBarProps { onMenuClick: () => void; sidebarCollapsed: boolean; } export function TopBar({ onMenuClick, sidebarCollapsed }: TopBarProps) { const { user, logout } = useAuth(); const [searchQuery, setSearchQuery] = useState(''); const [showNotifications, setShowNotifications] = useState(false); const [showUserMenu, setShowUserMenu] = useState(false); const getUserInitials = (name: string) => { return name.split(' ').map(n => n[0]).join('').toUpperCase(); }; const notifications = [ { id: 1, title: 'Tugas Baru Tersedia', message: 'HACCP - Hazard Analysis Critical Control Point', time: '5 menit yang lalu', isRead: false }, { id: 2, title: 'Ujian Akan Dimulai', message: 'SLHS - Sanitasi Lingkungan Hidup Sehat dalam 30 menit', time: '25 menit yang lalu', isRead: false }, { id: 3, title: 'Sertifikat Siap Diunduh', message: 'Sertifikat Halal - Sistem Jaminan Halal telah tersedia', time: '2 jam yang lalu', isRead: true } ]; const unreadCount = notifications.filter(n => !n.isRead).length; return (
{/* Left side */}
{/* Mobile menu button */} {/* Search bar */}
setSearchQuery(e.target.value)} className="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-lg leading-5 bg-white placeholder-gray-500 focus:outline-none focus:placeholder-gray-400 focus:ring-1 focus:ring-primary-500 focus:border-primary-500 sm:text-sm" placeholder="Cari kursus, materi, atau instruktur..." />
{/* Right side */}
{/* Notifications */}
{/* Notifications dropdown */} {showNotifications && (

Notifikasi

{notifications.map((notification) => (

{notification.title}

{notification.message}

{notification.time}

{!notification.isRead && (
)}
))}
)}
{/* User menu */}
{/* User dropdown */} {showUserMenu && (
setShowUserMenu(false)} > Profil Saya setShowUserMenu(false)} > Pengaturan setShowUserMenu(false)} > Bantuan
)}
); } export default TopBar;