frontend tweaks

This commit is contained in:
metacryst
2026-01-09 04:35:21 -06:00
parent 4a5823e8ea
commit 463dd183f5
8 changed files with 68 additions and 62 deletions

View File

@@ -1,39 +1,46 @@
css(`
side-bar {
position: fixed;
top: 0;
left: 0;
height: 100vh;
width: 16vw;
border-right: 0.5px solid var(--accent2);
display: flex;
flex-direction: column;
padding-top: 13vh;
}
side-bar button {
color: var(--darkbrown);
margin: 1.5em;
background-color: color-mix(in srgb, var(--accent2) 35%, var(--orange) 65%);
border: 1px solid var(--orange);
border-radius: 12px;
padding: 0.5em;
font-weight: bold;
}
`)
class Sidebar extends HTMLElement {
connectedCallback() {
this.render()
}
class Sidebar extends Shadow {
render() {
this.innerHTML = /* html */ `
<span id="title" style="position: absolute; left: 50%; transform: translateX(-50%) " class="link" onclick='window.location.href="/"'>hyperia</span>
<button>Main</button>
`
VStack(() => {
img(document.documentElement.classList.contains("red") ? "/_/icons/quillblack.svg" : "/_/icons/quill.svg", "2.25em")
.paddingLeft(3, em)
.paddingTop(5, vh)
.onClick(() => {
window.navigateTo("/")
})
})
.paddingRight(2, em)
.position("fixed")
.x(0).y(0)
.height(100, vh)
.borderRight("0.5px solid var(--accent)")
.zIndex(3)
.onAppear(async () => {
if(!window.profile) {
window.profile = await this.fetchProfile()
this.rerender()
}
})
}
async fetchProfile() {
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);
}
}
}
customElements.define("side-bar", Sidebar)
register(Sidebar)