Added logout

This commit is contained in:
Magnus Åhall 2023-06-20 08:13:32 +02:00
parent 38c8c5c519
commit ef4a6b0ba3
4 changed files with 22 additions and 6 deletions

View File

@ -15,7 +15,7 @@ import (
_ "embed"
)
const VERSION = "v0.1.1";
const VERSION = "v0.1.2";
const LISTEN_HOST = "0.0.0.0";
const DB_SCHEMA = 2

View File

@ -55,8 +55,12 @@ h1 {
padding: 16px;
border-bottom: 1px solid #aaa;
user-select: none;
font-size: 0.85em;
-webkit-tap-highlight-color: transparent;
}
#menu .item.separator {
border-bottom: 3px solid #000;
}
#menu .item:hover {
background: #ddd;
}

View File

@ -53,13 +53,14 @@ export class NodeUI extends Component {
<div id="menu-blackout" class="${this.menu.value ? 'show' : ''}" onclick=${()=>this.menu.value = false}></div>
<div id="menu" class="${this.menu.value ? 'show' : ''}">
<div class="item" onclick=${()=>this.renameNode()}>Rename</div>
<div class="item" onclick=${()=>this.deleteNode()}>Delete</div>
<div class="item separator" onclick=${()=>this.deleteNode()}>Delete</div>
<div class="item" onclick=${()=>this.logout()}>Log out</div>
</div>
<header class="${modified}" onclick=${()=>this.saveNode()}>
<div class="name">Notes</div>
<div class="add" onclick=${()=>this.createNode()}>+</div>
<div class="menu" onclick=${()=>this.showMenu()}></div>
<div class="add" onclick=${evt=>this.createNode(evt)}>+</div>
<div class="menu" onclick=${evt=>this.showMenu(evt)}></div>
</header>
<div class="crumbs">${crumbs}</crumbs>
@ -110,9 +111,14 @@ export class NodeUI extends Component {
evt.stopPropagation()
}
}//}}}
showMenu() {//{{{
showMenu(evt) {//{{{
evt.stopPropagation()
this.menu.value = true
}//}}}
logout() {//{{{
window.localStorage.removeItem('session.UUID')
location.href = '/'
}//}}}
goToNode(nodeID, dontPush) {//{{{
if(this.props.app.nodeModified.value) {
@ -128,7 +134,8 @@ export class NodeUI extends Component {
this.node.value = node
})
}//}}}
createNode() {//{{{
createNode(evt) {//{{{
evt.stopPropagation()
let name = prompt("Name")
if(!name)
return

View File

@ -64,8 +64,13 @@ h1 {
padding: 16px;
border-bottom: 1px solid #aaa;
user-select: none;
font-size: 0.85em;
-webkit-tap-highlight-color: transparent;
&.separator {
border-bottom: 3px solid #000;
}
&:hover {
background: #ddd;
}