Profile + Edit Bio + Logout + styling
- Added handler for editing bio to handlers.js - Added openProfile() and closeProfile() buttons in AppWindowContainer (Profile page is global) - Added Logout and Profile functionality to Sidebar.js - SidebarItem(text).onClick() fires twice, unable to resolve - Adjust Login page styling - Added onLogout() to index.js (removes auth_token) - Added Profile.js, displays user's profile picture (placeholder), name, and bio. User can edit bio. - Added removeAuthToken() to util.js - Added /signout to vite config
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import "./AppWindow.js"
|
||||
import "../Profile/Profile.js"
|
||||
|
||||
class AppWindowContainer extends Shadow {
|
||||
isProfileOpen = false
|
||||
|
||||
render() {
|
||||
ZStack(() => {
|
||||
|
||||
@@ -11,12 +14,26 @@ class AppWindowContainer extends Shadow {
|
||||
})
|
||||
.width(100, pct)
|
||||
.gap(0)
|
||||
|
||||
if (this.isProfileOpen) {
|
||||
Profile()
|
||||
}
|
||||
})
|
||||
.height(100, pct)
|
||||
.overflowY("hidden")
|
||||
.display("flex")
|
||||
.position("relative")
|
||||
}
|
||||
|
||||
openProfile() {
|
||||
this.isProfileOpen = true
|
||||
this.rerender()
|
||||
}
|
||||
|
||||
closeProfile() {
|
||||
this.isProfileOpen = false
|
||||
this.rerender()
|
||||
}
|
||||
}
|
||||
|
||||
register(AppWindowContainer)
|
||||
@@ -1,3 +1,5 @@
|
||||
import util from "../util"
|
||||
|
||||
class Sidebar extends Shadow {
|
||||
|
||||
SidebarItem(text) {
|
||||
@@ -7,10 +9,18 @@ class Sidebar extends Shadow {
|
||||
.fontFamily("Sedan SC")
|
||||
.marginLeft(2, em)
|
||||
.fontStyle("italic")
|
||||
.onClick(function () {
|
||||
.onClick(function () { // BUG -- Fires twice every time
|
||||
if(this.innerText === "Home") {
|
||||
window.navigateTo("/")
|
||||
return
|
||||
} else if (this.innerText === "Logout") {
|
||||
$("sidebar-").close()
|
||||
global.onLogout()
|
||||
return
|
||||
} else if (this.innerText === "Profile") {
|
||||
$("appwindowcontainer-").openProfile()
|
||||
$("sidebar-").close()
|
||||
return
|
||||
}
|
||||
window.navigateTo(this.innerText.toLowerCase().replace(/\s+/g, ""))
|
||||
})
|
||||
@@ -18,6 +28,7 @@ class Sidebar extends Shadow {
|
||||
|
||||
render() {
|
||||
VStack(() => {
|
||||
this.SidebarItem("Profile")
|
||||
this.SidebarItem("Home")
|
||||
this.SidebarItem("Map")
|
||||
this.SidebarItem("Logout")
|
||||
@@ -35,6 +46,12 @@ class Sidebar extends Shadow {
|
||||
.zIndex(3)
|
||||
}
|
||||
|
||||
close() {
|
||||
if(this.style.right !== "-71vw") {
|
||||
this.style.right = "-71vw"
|
||||
}
|
||||
}
|
||||
|
||||
toggle() {
|
||||
if(this.style.right === "-71vw") {
|
||||
this.style.right = "0vw"
|
||||
|
||||
Reference in New Issue
Block a user