/** * @file Erzeugt den gemeinsamen HTML-Seitenkopf mit Navigation und Kontosteuerung. */ const escapeHtml = (value) => String(value).replace(/[&<>"']/g, (character) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[character]); export function renderSiteHeader({user, pathname}) { const destinations = user ? [["/app", "Home"], ["/app/chats", "Chats"], ["/app/personas", "My personas"], ["/market", "Discover"], ["/app/settings", "Settings"]] : [["/market", "Discover"]]; const navigation = destinations.map(([href, label]) => { const active = pathname === href || (href === "/app/chats" && pathname.startsWith("/app/chats/")); return `${label}`; }).join(""); const account = user ? `${escapeHtml(user)}` : `Sign inCreate account`; return `
elsewhere
${account}
`; }