From 13e0a6edb530a86acc56441980f6ed4d9fbf2022 Mon Sep 17 00:00:00 2001 From: ivar Date: Sun, 7 Dec 2025 22:42:14 +0100 Subject: Save --- code/api/wwwroot/scripts/components/profile-modal.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'code/api/wwwroot/scripts/components/profile-modal.js') diff --git a/code/api/wwwroot/scripts/components/profile-modal.js b/code/api/wwwroot/scripts/components/profile-modal.js index acc666b..6d7ad27 100644 --- a/code/api/wwwroot/scripts/components/profile-modal.js +++ b/code/api/wwwroot/scripts/components/profile-modal.js @@ -1,16 +1,28 @@ class ProfileModal extends HTMLElement { + static observedAttributes = ["target-id"]; + #attributes = []; + constructor() { super(); + this.#attributes.push({name: "target-id", value: this.getAttribute("target-id")}); const _session = session.get_sync(); - const root = create_element("div", {}, [ + const root = create_element("template", {}, [ create_element("h4", {innerText: _session.username, style: {margin: 0}}), create_element("p", {innerText: _session.role}), create_element("button", {innerText: "Log out", classList: ["do-logout"]}), - create_element("pre", {innerText: Temporal.Now.instant().toString()}) ]); this.style.padding = "5px"; this.innerHTML = root.innerHTML; } + + attributeChangedCallback(name, oldValue, newValue) { + } } -customElements.define("profile-modal", ProfileModal); +customElements.define("profile-modal", ProfileModal, {extends: "dialog"}); + +class ElementBase extends HTMLElement { + constructor() { + super(); + } +} -- cgit v1.3