/* global React, Wordmark, Logo, Ic, VS */
const { useState: useState_nav } = React;
function Sidebar({ screen, setScreen, collapsed }) {
const items = [
{ id: "dashboard", label: "Dashboard", icon: },
{ id: "measurements", label: "Pomiary", icon: },
{ id: "charts", label: "Wykresy", icon: , badge: "WIP" },
{ id: "computers", label: "Komputery", icon: },
{ id: "config", label: "Konfiguracja", icon: },
];
const username = (VS && VS.getUsername && VS.getUsername()) || '';
const role = (VS && VS.getRole && VS.getRole()) || '';
const initials = username ? username.slice(0, 2).toUpperCase() : '??';
return (
);
}
function SidebarItem({ item, active, onClick, collapsed }) {
const [hover, setHover] = useState_nav(false);
return (
setHover(true)}
onMouseLeave={() => setHover(false)}
style={{
display: "flex", alignItems: "center", gap: 10,
padding: collapsed ? "8px 0" : "7px 10px",
justifyContent: collapsed ? "center" : "flex-start",
borderRadius: "var(--r-sm)",
cursor: "pointer",
fontSize: 12.5,
fontWeight: active ? 500 : 400,
background: active ? "var(--surface)" : hover ? "var(--bg-sunken)" : "transparent",
border: active ? "1px solid var(--border-strong)" : "1px solid transparent",
color: active ? "var(--fg)" : "var(--fg-muted)",
position: "relative",
}}
>
{active && !collapsed &&
}
{item.icon}
{!collapsed &&
{item.label}}
{!collapsed && item.badge && (
{item.badge}
)}
);
}
function TopBar({ breadcrumb, right }) {
return (
);
}
Object.assign(window, { Sidebar, TopBar });