feat: add global sidebar links management and settings UI

This commit is contained in:
jhartworks committed 2026-11-25 09:38:54 +01:00
1 parent 3203577a9d
commit f6f3c402cc
10 files changed
+463 -40

No files matched your search

+23 -1
View File
@@ -7,8 +7,16 @@ const icons = {
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",
external: "M13 4h7v7 M20 4l-9 9 M10 4H4v16h16v-6",
};
function linkMonogram(label) {
const words = label.split(/\s+/);
return words.length > 1
? words.slice(0, 2).map((word) => Array.from(word)[0]).join("")
: Array.from(label).slice(0, 2).join("");
}
function SidebarIcon({ name }) {
return (
<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round">
@@ -21,7 +29,7 @@ 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 }) {
export default function Sidebar({ collapsed, onToggle, views, activeView, onNavigate, links, user, userLabel, onLogout }) {
const toggleLabel = collapsed ? "Seitenleiste ausklappen" : "Seitenleiste einklappen";
const accountLabel = user ? "Abmelden" : "Anmelden";
@@ -58,6 +66,20 @@ export default function Sidebar({ collapsed, onToggle, views, activeView, onNavi
</button>
))}
</nav>
{links.length ? (
<nav className="nav-list sidebar-links" aria-label="Eigene Links">
{links.map((link, index) => (
<a key={index} className="sidebar-link nav-button" href={link.url} title={link.label} aria-label={link.label}>
{collapsed ? <span className="sidebar-link-monogram" aria-hidden="true">{linkMonogram(link.label)}</span> : (
<>
<SidebarIcon name="external" />
<span className="sidebar-link-label">{link.label}</span>
</>
)}
</a>
))}
</nav>
) : null}
</div>
<div className="sidebar-footer">
{user && !collapsed ? (