feat: Adds logout route and switches user navbar item to dropdown menu.
This commit is contained in:
@@ -14,7 +14,8 @@ struct HomeView: HTML, Sendable {
|
||||
.class("btn btn-ghost btn-secondary text-lg"),
|
||||
.hx.get(route: .login(.index())),
|
||||
.hx.target("body"),
|
||||
.hx.swap(.outerHTML)
|
||||
.hx.swap(.outerHTML),
|
||||
.hx.pushURL(true)
|
||||
) {
|
||||
"Login"
|
||||
}
|
||||
|
||||
@@ -49,14 +49,21 @@ struct Navbar: HTML, Sendable {
|
||||
}
|
||||
if userProfile {
|
||||
// TODO: Make dropdown
|
||||
div(.class("flex-none")) {
|
||||
a(
|
||||
.href(route: .user(.profile(.index))),
|
||||
) {
|
||||
div(.class("flex-none dropdown dropdown-end dropdown-hover")) {
|
||||
div(.class("btn m-1"), .tabindex(0), .role("button")) {
|
||||
SVG(.circleUser)
|
||||
}
|
||||
.navButton()
|
||||
.tooltip("Profile")
|
||||
ul(
|
||||
.tabindex(-1),
|
||||
.class("dropdown-content menu bg-base-200 rounded-box z-1 w-52 py-2 shadow-sm")
|
||||
) {
|
||||
li {
|
||||
a(.href(route: .user(.profile(.index)))) { "Profile" }
|
||||
}
|
||||
li {
|
||||
a(.href(route: .user(.logout))) { "Logout" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user