Ability to post in Forum
This commit is contained in:
@@ -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 = ""
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user