aboutsummaryrefslogtreecommitdiffstats
path: root/code/api/wwwroot/scripts/components/profile-modal.js
diff options
context:
space:
mode:
authorivar <i@oiee.no>2025-12-07 22:42:14 +0100
committerivar <i@oiee.no>2025-12-07 22:42:14 +0100
commit13e0a6edb530a86acc56441980f6ed4d9fbf2022 (patch)
treeeead1100cb714341ef1527f3b3e7b8909dcfbe3b /code/api/wwwroot/scripts/components/profile-modal.js
parent681192e93d96c34928d1d8a8b62bff3a0c860992 (diff)
downloadstorage-master.tar.xz
storage-master.zip
Diffstat (limited to 'code/api/wwwroot/scripts/components/profile-modal.js')
-rw-r--r--code/api/wwwroot/scripts/components/profile-modal.js18
1 files changed, 15 insertions, 3 deletions
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();
+ }
+}