feat: enhance sidebar functionality and styling
- Updated sidebar component to support dynamic width based on collapsed state. - Improved sidebar icon rendering and added user account management features. - Introduced new trend chart settings component for better user interaction. - Added utility functions for engineering units and trend chart settings. - Implemented color assignment logic for trend series to enhance visual representation. - Enhanced CSS styles for better responsiveness and usability across different screen sizes. - Introduced new configuration for Vite server to allow shared directory access. - Added .dockerignore file to optimize Docker build context.
This commit is contained in:
1 parent
2f5f86452f
commit
3203577a9d
28 files changed
+1508
-758
No files matched your search
@@ -0,0 +1,83 @@
|
||||
const icons = {
|
||||
dashboard: "M3 3h7v7H3z M14 3h7v7h-7z M3 14h7v7H3z M14 14h7v7h-7z",
|
||||
trends: "M3 4v16h18 M6 15l5-5 4 3 6-7",
|
||||
admin: "M12 22s7-3 7-10V5l-7-3-7 3v7c0 7 7 10 7 10Z M9 12l2 2 4-4",
|
||||
settings: "M4 6h6m4 0h6 M4 12h10m4 0h2 M4 18h2m4 0h10 M10 4v4m4 2v4m-8 2v4",
|
||||
expand: "M3 5h18v14H3z M9 5v14 M13 9l3 3-3 3",
|
||||
collapse: "M3 5h18v14H3z M9 5v14 M16 9l-3 3 3 3",
|
||||
login: "M14 4h6v16h-6 M4 12h12 M12 8l4 4-4 4",
|
||||
logout: "M10 4H4v16h6 M8 12h12 M16 8l4 4-4 4",
|
||||
};
|
||||
|
||||
function SidebarIcon({ name }) {
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round">
|
||||
<path d={icons[name]} />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
export function SmallFootnote() {
|
||||
return <div className="tiny-note">by J.H. | SE Inno GmbH</div>;
|
||||
}
|
||||
|
||||
export default function Sidebar({ collapsed, onToggle, views, activeView, onNavigate, user, userLabel, onLogout }) {
|
||||
const toggleLabel = collapsed ? "Seitenleiste ausklappen" : "Seitenleiste einklappen";
|
||||
const accountLabel = user ? "Abmelden" : "Anmelden";
|
||||
|
||||
return (
|
||||
<aside className={collapsed ? "sidebar collapsed" : "sidebar"}>
|
||||
<div className="sidebar-top">
|
||||
<div className="sidebar-brand-row">
|
||||
<div className="logo-lockup">
|
||||
<img src="/logo.png" alt="SE Logo" />
|
||||
{collapsed ? null : (
|
||||
<div>
|
||||
<div className="eyebrow">SE</div>
|
||||
<div className="logo-title">SE Local Trenddata.</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<button type="button" className="icon-button sidebar-toggle" title={toggleLabel} aria-label={toggleLabel} aria-expanded={!collapsed} onClick={onToggle}>
|
||||
<SidebarIcon name={collapsed ? "expand" : "collapse"} />
|
||||
</button>
|
||||
</div>
|
||||
<nav className="nav-list" aria-label="Hauptnavigation">
|
||||
{views.map((view) => (
|
||||
<button
|
||||
key={view.id}
|
||||
type="button"
|
||||
className={activeView === view.id ? "nav-button active" : "nav-button"}
|
||||
title={collapsed ? view.label : undefined}
|
||||
aria-label={view.label}
|
||||
aria-current={activeView === view.id ? "page" : undefined}
|
||||
onClick={() => onNavigate(view.id)}
|
||||
>
|
||||
<SidebarIcon name={view.id} />
|
||||
{collapsed ? null : <span>{view.label}</span>}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
</div>
|
||||
<div className="sidebar-footer">
|
||||
{user && !collapsed ? (
|
||||
<div className="user-card">
|
||||
<strong>{userLabel}</strong>
|
||||
<span>{user.role === "admin" ? "Systemzugang" : user.role === "technician" ? "Technikzugang" : "Benutzerzugang"}</span>
|
||||
</div>
|
||||
) : null}
|
||||
<button
|
||||
className={collapsed ? "icon-button sidebar-account" : "ghost-button compact-button sidebar-account"}
|
||||
type="button"
|
||||
title={collapsed ? accountLabel : undefined}
|
||||
aria-label={accountLabel}
|
||||
onClick={user ? onLogout : () => onNavigate("settings")}
|
||||
>
|
||||
<SidebarIcon name={user ? "logout" : "login"} />
|
||||
{collapsed ? null : <span>{accountLabel}</span>}
|
||||
</button>
|
||||
{collapsed ? null : <SmallFootnote />}
|
||||
</div>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user