diff --git a/core/client.js b/core/client.js index 5d522992..1d7b31e0 100644 --- a/core/client.js +++ b/core/client.js @@ -1,7 +1,6 @@ -import {LitElement, html} from '/static/lit/lit-all.min.js'; +import {LitElement, html, css} from '/static/lit/lit-all.min.js'; let gSocket; -let gCredentials; let gPermissions; let gCurrentFile; @@ -28,6 +27,106 @@ const k_api = { setHash: {args: ['hash'], func: api_setHash}, }; +const k_global_style = css` + a:link { + color: #268bd2; + } + + a:visited { + color: #6c71c4; + } + + a:hover { + color: #859900; + } + + a:active { + color: #2aa198; + } +`; + +class TfNavigationElement extends LitElement { + static get properties() { + return { + credentials: {type: Object}, + permissions: {type: Object}, + show_permissions: {type: Boolean}, + status: {type: Object}, + }; + } + + constructor() { + super(); + this.permissions = {}; + this.show_permissions = false; + this.status = {}; + } + + toggle_edit(event) { + event.preventDefault(); + if (editing()) { + closeEditor(); + } else { + edit(); + } + } + + reset_permission(key) { + send({action: "resetPermission", permission: key}); + } + + render_login() { + if (this?.credentials?.session?.name) { + return html`logout ${this.credentials.session.name}`; + } else { + return html`login`; + } + } + + render_permissions() { + if (this.show_permissions) { + return html` +