Verified Commit 1bf57cc5 authored by Jakob Moser's avatar Jakob Moser
Browse files

Make logout link less prominent

parent cb9d36fe
Loading
Loading
Loading
Loading
+20 −0
Changes for portal/static/js/components/pages/Me.mjs: 20 added lines, 0 removed lines.
Original line number Diff line number Diff line
import { logout } from "../../account.mjs"
import { Base } from "./Base.mjs"

export const Me = {
    oncreate() {
        document.title = "Mein Account · FS Coli Portal"
    },
    view() {
        return m(
            Base,
            m("article.box", [
                m("h1", "Mein Account"),
                m("input[type='button']", {
                    onclick: logout,
                    value: "Abmelden",
                }),
            ]),
        )
    },
}
+6 −14
Changes for portal/static/js/components/pieces/Nav.mjs: 6 added lines, 14 removed lines.
Original line number Diff line number Diff line
@@ -37,20 +37,12 @@ export const Nav = {
                    m(
                        "li",
                        isLoggedIn()
                            ? m(
                                  "a",
                                  {
                                      href: "#",
                                      onclick: function (event) {
                                          logout()
                                          event.preventDefault()
                                      },
                                  },
                                  [
                                      m("i.fa-solid.fa-right-from-bracket"),
                                      " Abmelden",
                                  ],
                              )
                            ? m(NavPageLink, {
                                  href: `/me`,
                                  label: "Mein Account",
                                  icon: "fa-regular fa-user",
                                  iconOnly: true,
                              })
                            : m(NavPageLink, {
                                  href: `/login?next=${m.route.get() || "/"}`,
                                  label: " Anmelden",
+11 −3
Changes for portal/static/js/components/pieces/NavPageLink.mjs: 11 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -5,13 +5,21 @@ export const NavPageLink = {
        const currentPath = m.parsePathname(m.route.get()).path
        const isCurrent = currentPath === m.parsePathname(href).path

        return m(m.route.Link, { href, class: isCurrent ? "current" : null }, [
        return m(
            m.route.Link,
            {
                href,
                class: isCurrent ? "current" : null,
                title: vnode.attrs.iconOnly ? vnode.attrs.label : null,
            },
            [
                vnode.attrs.icon
                    ? m("i", {
                          class: vnode.attrs.icon,
                      })
                    : null,
            vnode.attrs.label,
        ])
                vnode.attrs.iconOnly ? null : vnode.attrs.label,
            ],
        )
    },
}
+2 −0
Changes for portal/static/js/portal.mjs: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ import { Start } from "./components/pages/Start.mjs"
import { Unlock } from "./components/pages/Unlock.mjs"
import { Fachschaftssitzung } from "./components/pages/Fachschaftssitzung.mjs"
import { Login } from "./components/pages/Login.mjs"
import { Me } from "./components/pages/Me.mjs"
import "/static/lib/mithril/mithril.min.js"

// See https://mithril.js.org/route.html#routing-strategies
@@ -13,4 +14,5 @@ m.route(document.body, "/", {
    "/unlock": Unlock,
    "/fachschaftssitzung": Fachschaftssitzung,
    "/login": Login,
    "/me": Me,
})