(() => { const { SidebarNav, TopBar, Card, NotificationItem, Button, Badge, Icon } = window.TaskFlowDesignSystem_dd53c2; function NotificationPanel({ open, onClose, items = NOTIFS, onMarkRead }) { if (!open) return null; return ( <>
Notifikasi {items.filter((n) => n.unread).length} baru
{items.slice(0, 30).map((n, i) => )}
); } function AppShell({ role, meId = 0, page, onNavigate, title, breadcrumb, actions, children, onSignOut, notifs = NOTIFS, onMarkRead, verifyCount = 0, taskCount, onFab }) { const [bell, setBell] = React.useState(false); const bp = useBreakpoint(); const compact = bp !== "desktop"; const showFab = bp === "mobile" && !!onFab; // tablet+ already exposes Create Task in the top bar const [drawer, setDrawer] = React.useState(false); React.useEffect(() => { if (!compact) setDrawer(false); }, [compact]); // Setiap ganti halaman, area konten kembali ke atas (tanpa scrollIntoView). const scrollRef = React.useRef(null); React.useEffect(() => { const el = scrollRef.current; if (!el) return; el.scrollTop = 0; const id = requestAnimationFrame(() => { el.scrollTop = 0; }); const late = setTimeout(() => { el.scrollTop = 0; }, 180); return () => { cancelAnimationFrame(id); clearTimeout(late); }; }, [page]); const adminMenu = [ { label: "Menu", items: [ { id: "dashboard", label: "Dashboard", icon: "layout-dashboard" }, { id: "tasks", label: "Task List", icon: "clipboard-list", badge: taskCount != null ? taskCount : TASKS.length }, { id: "verify", label: "Task Verification", icon: "shield-check", badge: verifyCount || undefined }, { id: "add", label: "Add New Task", icon: "circle-plus" }, { id: "report", label: "Report", icon: "chart-pie" }, { id: "audit", label: "Log Activity", icon: "history" }, { id: "calendar", label: "Calendar", icon: "calendar-days" }, { id: "document", label: "Document", icon: "folder-open" }, { id: "absen", label: "Absen Marketing", icon: "map-pin-check" }, ]}, { label: "Account", items: [ { id: "users", label: "Manajemen User", icon: "users" }, { id: "profile", label: "Profile", icon: "user" }, { id: "signout", label: "Sign Out", icon: "log-out" }, ]}, ]; const userMenu = [ { label: "Menu", items: [ { id: "dashboard", label: "Dashboard", icon: "layout-dashboard" }, { id: "tasks", label: "Task List", icon: "clipboard-list", badge: taskCount != null ? undefined : 3 }, { id: "calendar", label: "Calendar", icon: "calendar-days" }, { id: "document", label: "Document", icon: "folder-open" }, ]}, { label: "Account", items: [ { id: "profile", label: "Profile", icon: "user" }, { id: "signout", label: "Sign Out", icon: "log-out" }, ]}, ]; const marketingMenu = [ { label: "Menu", items: [ { id: "dashboard", label: "Dashboard", icon: "layout-dashboard" }, { id: "tasks", label: "Task List", icon: "clipboard-list", badge: taskCount != null ? undefined : 2 }, { id: "absen", label: "Absen", icon: "map-pin-check" }, { id: "calendar", label: "Calendar", icon: "calendar-days" }, { id: "document", label: "Document", icon: "folder-open" }, ]}, { label: "Account", items: [ { id: "profile", label: "Profile", icon: "user" }, { id: "signout", label: "Sign Out", icon: "log-out" }, ]}, ]; const me = { name: nameOf(meId), role: roleOf(meId), src: avatarOf(meId) }; const sidebar = ( { setDrawer(false); return id === "signout" ? onSignOut() : onNavigate(id); }} footer={ {avatarOf(meId) ? {me.name} : {String(me.name || "?").split(" ").map((w) => w[0]).slice(0, 2).join("")} } {me.name} {me.role} } /> ); return (
{!compact && sidebar} {compact && drawer && ( <>
setDrawer(false)} style={{ position: "absolute", inset: 0, background: "rgba(20,32,27,.42)", zIndex: 60 }} />
{sidebar}
)}
n.unread).length} user={me} actions={actions} compact={compact} onMenu={compact ? () => setDrawer(true) : undefined} onBellClick={() => setBell((b) => !b)} />
{children}
{showFab && ( )} setBell(false)} items={notifs} onMarkRead={onMarkRead} />
); } Object.assign(window, { AppShell, NotificationPanel }); })();