Files
Hyperia/ui/site/components/Home.js
2025-11-12 19:34:35 -06:00

93 lines
3.0 KiB
JavaScript

import "./AppWindow.js"
import "./AppMenu.js"
import "./ProfileButton.js"
import "./InputBox.js"
import "./Sidebar.js"
class Home extends Shadow {
render() {
ZStack(() => {
img("/_/icons/logo.svg", "2.5em")
.position("fixed")
.left("3em")
.top("3vh")
.zIndex(3)
.onClick(() => {
window.navigateTo("/")
})
div()
.width(100, vw)
.height(100, vh)
.margin("0px")
.backgroundImage("/_/images/the_return.webp")
.backgroundSize("cover")
.backgroundPosition("48% 65%")
.backgroundRepeat("no-repeat")
switch(window.location.pathname) {
case "/":
AppWindow()
AppMenu()
break
case "/app/jobs":
AppWindow("Jobs")
AppMenu("Jobs")
break;
case "/app/messages":
AppWindow("Messages")
AppMenu("Messages")
break;
case "/app/market":
AppWindow("Market")
AppMenu("Market")
break;
case "/app/tasks":
AppWindow("Tasks")
AppMenu("Tasks")
break;
case "/app/forum":
AppWindow("Forum")
AppMenu("Forum")
break;
default:
throw new Error("Unknown route!")
}
ProfileButton()
.zIndex(1)
.cursor("default")
.position("fixed")
.top("5.5vh")
.right("4.5vw")
a("/signout", "Sign Out")
.position("fixed")
.top("5vh")
.right("2em")
.background("transparent")
.border(window.location.pathname === "/" ? "1px solid var(--tan)" : "1px solid var(--accent2)")
.color(window.location.pathname === "/" ? "var(--tan)" : "var(--accent)")
.borderRadius(5, px)
.onHover(function (hovering) {
if(hovering) {
this.style.background = "var(--green)"
} else {
this.style.background = ""
}
})
.onNavigate(function () {
if(window.location.pathname === "/") {
this.style.border = "1px solid var(--tan)"
this.style.color = "var(--tan)"
} else {
this.style.border = "1px solid var(--accent2)"
this.style.color = "var(--accent)"
}
})
})
}
}
register(Home)