Loading portal/static/js/components/pieces/Nav.mjs +13 −0 Changes for portal/static/js/components/pieces/Nav.mjs: 13 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -23,6 +23,19 @@ export const Nav = { ), ]), ), m( "section.right", m("ul", [ m( "li", m(NavPageLink, { href: `/login?next=${m.route.get() || "/"}`, label: " Anmelden", icon: "fa-regular fa-user", }), ), ]), ), ]) }, } portal/static/js/components/pieces/NavPageLink.mjs +10 −7 Changes for portal/static/js/components/pieces/NavPageLink.mjs: 10 added lines, 7 removed lines. Original line number Diff line number Diff line export const NavPageLink = { view(vnode) { const href = vnode.attrs.href const currentRoute = m.route.get() const isCurrent = currentRoute === href || (currentRoute === "" && href === "/") // See https://mithril.js.org/parsePathname.html const currentPath = m.parsePathname(m.route.get()).path const isCurrent = currentPath === m.parsePathname(href).path return m( m.route.Link, { href, class: isCurrent ? "current" : "" }, return m(m.route.Link, { href, class: isCurrent ? "current" : null }, [ vnode.attrs.icon ? m("i", { class: vnode.attrs.icon, }) : null, vnode.attrs.label, ) ]) }, } Loading
portal/static/js/components/pieces/Nav.mjs +13 −0 Changes for portal/static/js/components/pieces/Nav.mjs: 13 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -23,6 +23,19 @@ export const Nav = { ), ]), ), m( "section.right", m("ul", [ m( "li", m(NavPageLink, { href: `/login?next=${m.route.get() || "/"}`, label: " Anmelden", icon: "fa-regular fa-user", }), ), ]), ), ]) }, }
portal/static/js/components/pieces/NavPageLink.mjs +10 −7 Changes for portal/static/js/components/pieces/NavPageLink.mjs: 10 added lines, 7 removed lines. Original line number Diff line number Diff line export const NavPageLink = { view(vnode) { const href = vnode.attrs.href const currentRoute = m.route.get() const isCurrent = currentRoute === href || (currentRoute === "" && href === "/") // See https://mithril.js.org/parsePathname.html const currentPath = m.parsePathname(m.route.get()).path const isCurrent = currentPath === m.parsePathname(href).path return m( m.route.Link, { href, class: isCurrent ? "current" : "" }, return m(m.route.Link, { href, class: isCurrent ? "current" : null }, [ vnode.attrs.icon ? m("i", { class: vnode.attrs.icon, }) : null, vnode.attrs.label, ) ]) }, }