import { useContext, useState } from "react"; import { NavLink, Outlet, useNavigate } from "react-router-dom"; import { SessionContext } from "../session.js"; const WORK = [ { to: "/", end: true, label: "Übersicht", icon: "home" }, { to: "/matters", label: "Vorgänge", icon: "layers" }, { to: "/cases", label: "Akten", icon: "folder" }, { to: "/work", label: "Aufgaben", icon: "check" }, ]; const ADMIN = [ { to: "/settings", label: "Verwaltung", icon: "rooms" }, ]; export function Shell() { const { session, logout } = useContext(SessionContext); const navigate = useNavigate(); const [query, setQuery] = useState(""); const items = [...WORK, ...ADMIN]; function onSearch(event) { event.preventDefault(); const term = query.trim(); if (term.length < 2) return; navigate(`/search?q=${encodeURIComponent(term)}`); } return (
Tsumugu
setQuery(event.target.value)} placeholder="Suchen" aria-label="Suchen" />
); } function NavIcon({ name }) { const common = { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true }; if (name === "home") { return ; } if (name === "folder") { return ; } if (name === "layers") { return ; } if (name === "sources") { return ; } if (name === "users") { return ; } if (name === "check") { return ; } if (name === "logout") { return ; } return ; }