Ability to post in Forum

This commit is contained in:
metacryst
2025-11-25 10:17:01 -06:00
parent 7f4a9a8b18
commit 89702efa3a
27 changed files with 494 additions and 254 deletions

View File

@@ -10,16 +10,45 @@ class ProfileButton extends Shadow {
.borderRadius(5, px)
ProfileMenu()
.x(0, vw).y(4, em)
.center()
})
.display("block")
.onHover((hovering) => {
.onAppear(async () => {
try {
const res = await fetch("/profile", {
method: "GET",
credentials: "include",
headers: {
"Content-Type": "application/json"
}
});
if (!res.ok) throw new Error("Failed to fetch profile");
const profile = await res.json();
console.log(profile);
return profile;
} catch (err) {
console.error(err);
}
})
.onHover((hovering, e) => {
console.log(hovering)
if(hovering) {
console.log(e.target)
if(hovering && !e.target.matches("profile-menu")) {
this.$("img").backgroundColor("var(--accent)")
this.$("img").border("1px solid black")
} else {
this.$("img").style.outline = "1px solid black"
} else if(!e.target.matches("profile-menu")) {
this.$("img").backgroundColor("")
this.$("img").border("")
this.$("img").style.outline = ""
}
})
.onClick((done) => {
console.log(done)
if(done) {
this.$("profile-menu").style.display = ""
}
})