Implement vertical toolbar

This commit is contained in:
Jonas Herzig 2018-09-23 15:38:11 +02:00
parent 5eefeeb721
commit 1f82d981a3
3 changed files with 160 additions and 19 deletions

View file

@ -19,7 +19,8 @@
<div class="loading-container" data-bind="css: { loaded: true }"> <div class="loading-container" data-bind="css: { loaded: true }">
<div class="loading-circle" data-bind="css: { loaded: true }"></div> <div class="loading-circle" data-bind="css: { loaded: true }"></div>
</div> </div>
<div id="container" style="display: none" data-bind="visible: true"> <div id="container" style="display: none" data-bind="visible: true,
css: { minimal: minimalView }">
<!-- ko with: connectDialog --> <!-- ko with: connectDialog -->
<div class="connect-dialog dialog" data-bind="visible: visible() && !joinOnly()"> <div class="connect-dialog dialog" data-bind="visible: visible() && !joinOnly()">
<div class="dialog-header"> <div class="dialog-header">
@ -171,9 +172,12 @@
<script type="text/html" id="channel-tag"> <script type="text/html" id="channel-tag">
<span class="channel-tag" data-bind="text: name"></span> <span class="channel-tag" data-bind="text: name"></span>
</script> </script>
<div class="toolbar"> <div class="toolbar" data-bind="css: { 'toolbar-horizontal': toolbarHorizontal(),
<img class="handle-horizontal" src="/svg/handle_horizontal.svg"> 'toolbar-vertical': !toolbarHorizontal() }">
<img class="handle-vertical" src="/svg/handle_horizontal.svg"> <img class="handle-horizontal" src="/svg/handle_horizontal.svg"
data-bind="click: toggleToolbarOrientation">
<img class="handle-vertical" src="/svg/handle_vertical.svg"
data-bind="click: toggleToolbarOrientation">
<img class="tb-connect" data-bind="visible: !connectDialog.joinOnly(), <img class="tb-connect" data-bind="visible: !connectDialog.joinOnly(),
click: connectDialog.show" click: connectDialog.show"
rel="connect" src="/svg/applications-internet.svg"> rel="connect" src="/svg/applications-internet.svg">
@ -326,9 +330,12 @@
<!-- /ko --> <!-- /ko -->
<!-- /ko --> <!-- /ko -->
</script> </script>
<div class="channel-root-container" data-bind="if: root"> <div class="channel-root-container" data-bind="if: root, visible: !minimalView()">
<div class="channel-root" data-bind="template: {name: 'channel', data: root}"></div> <div class="channel-root" data-bind="template: {name: 'channel', data: root}"></div>
</div> </div>
<div class="channel-root-container" data-bind="if: thisUser, visible: minimalView()">
<div class="channel-root" data-bind="template: {name: 'channel', data: thisUser().channel}"></div>
</div>
</div> </div>
</body> </body>
<link rel="stylesheet" type="text/css" href="/main.css"> <link rel="stylesheet" type="text/css" href="/main.css">

View file

@ -132,6 +132,7 @@ class Settings {
this.voiceMode = load('voiceMode') || 'vad' this.voiceMode = load('voiceMode') || 'vad'
this.pttKey = load('pttKey') || 'ctrl + shift' this.pttKey = load('pttKey') || 'ctrl + shift'
this.vadLevel = load('vadLevel') || 0.3 this.vadLevel = load('vadLevel') || 0.3
this.toolbarVertical = load('toolbarVertical') || false
} }
save () { save () {
@ -139,6 +140,7 @@ class Settings {
save('voiceMode', this.voiceMode) save('voiceMode', this.voiceMode)
save('pttKey', this.pttKey) save('pttKey', this.pttKey)
save('vadLevel', this.vadLevel) save('vadLevel', this.vadLevel)
save('toolbarVertical', this.toolbarVertical)
} }
} }
@ -151,10 +153,12 @@ class GlobalBindings {
this.connectionInfo = new ConnectionInfo() this.connectionInfo = new ConnectionInfo()
this.commentDialog = new CommentDialog() this.commentDialog = new CommentDialog()
this.settingsDialog = ko.observable() this.settingsDialog = ko.observable()
this.minimalView = ko.observable(false)
this.log = ko.observableArray() this.log = ko.observableArray()
this.thisUser = ko.observable() this.thisUser = ko.observable()
this.root = ko.observable() this.root = ko.observable()
this.messageBox = ko.observable('') this.messageBox = ko.observable('')
this.toolbarHorizontal = ko.observable(!this.settings.toolbarVertical)
this.selected = ko.observable() this.selected = ko.observable()
this.selfMute = ko.observable() this.selfMute = ko.observable()
this.selfDeaf = ko.observable() this.selfDeaf = ko.observable()
@ -165,6 +169,12 @@ class GlobalBindings {
} }
}) })
this.toggleToolbarOrientation = () => {
this.toolbarHorizontal(!this.toolbarHorizontal())
this.settings.toolbarVertical = !this.toolbarHorizontal()
this.settings.save()
}
this.select = element => { this.select = element => {
this.selected(element) this.selected(element)
} }
@ -591,6 +601,15 @@ class GlobalBindings {
var homepage = require('../package.json').homepage var homepage = require('../package.json').homepage
window.open(homepage, '_blank').focus() window.open(homepage, '_blank').focus()
} }
this.updateSize = () => {
this.minimalView(window.innerWidth < 320)
if (this.minimalView()) {
this.toolbarHorizontal(window.innerWidth < window.innerHeight)
} else {
this.toolbarHorizontal(!this.settings.toolbarVertical)
}
}
} }
} }
var ui = new GlobalBindings() var ui = new GlobalBindings()
@ -626,6 +645,9 @@ window.onload = function () {
ko.applyBindings(ui) ko.applyBindings(ui)
} }
window.onresize = () => ui.updateSize()
ui.updateSize()
function log () { function log () {
console.log.apply(console, arguments) console.log.apply(console, arguments)
var args = [] var args = []

View file

@ -5,13 +5,7 @@ html, body {
height: 100% height: 100%
} }
#container { #container {
height: 98%; height: 100%;
margin: 0 1% 0 1%;
}
#container::before {
display: block;
content: "";
height: 1%;
} }
.channel-root-container { .channel-root-container {
text-size: 16px; text-size: 16px;
@ -19,17 +13,35 @@ html, body {
background-color: white; background-color: white;
border: 1px solid lightgray; border: 1px solid lightgray;
float: left; float: left;
width: calc(60% - 6px);
height: calc(100% - 38px);
border-radius: 3px; border-radius: 3px;
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
} }
.toolbar-horizontal ~ .channel-root-container {
margin-top: 2px;
width: calc(59% - 6px);
height: calc(98% - 38px);
}
.toolbar-vertical ~ .channel-root-container {
margin-top: 1%;
width: calc(59% - 6px);
height: calc(98% - 6px);
}
.chat { .chat {
margin-right: 2px; margin-right: 2px;
float: left; float: left;
width: 40%; }
height: calc(100% - 38px); .toolbar-horizontal ~ .chat {
margin-top: 2px;
margin-left: 1%;
width: 39%;
height: calc(98% - 38px);
}
.toolbar-vertical ~ .chat {
margin-top: 1%;
margin-left: 2px;
width: calc(39% - 36px);
height: calc(98% - 4px);
} }
.log { .log {
background-color: white; background-color: white;
@ -139,7 +151,8 @@ html, body {
z-index: 100; z-index: 100;
} }
.toolbar { .toolbar {
height: 36px; display: flex;
align-items: center;
} }
.toolbar img { .toolbar img {
height: 28px; height: 28px;
@ -156,17 +169,52 @@ html, body {
border: 1px solid #bbb; border: 1px solid #bbb;
background-color: white; background-color: white;
} }
.toolbar-horizontal {
flex-direction: row;
height: 36px;
margin-top: 4px;
margin-left: 1%;
padding-left: 5px;
}
.toolbar-vertical {
flex-direction: column;
width: 36px;
margin-top: 1%;
margin-left: 4px;
padding-top: 5px;
float: left;
}
.toolbar-horizontal > * {
margin-right: 5px;
}
.toolbar-vertical > * {
margin-bottom: 5px;
}
.divider { .divider {
display: inline-block; display: inline-block;
}
.toolbar-horizontal .divider {
height: 32px; height: 32px;
border-left: 1px lightgray solid; border-left: 1px lightgray solid;
} }
.handle-horizontal { .toolbar-vertical .divider {
width: 32px;
border-top: 1px lightgray solid;
}
.toolbar-horizontal .handle-horizontal {
width: auto !important; width: auto !important;
border: none !important; border: none !important;
background-color: #eee !important; background-color: #eee !important;
} }
.handle-vertical { .toolbar-horizontal .handle-vertical {
display: none;
}
.toolbar-vertical .handle-vertical {
height: auto !important;
border: none !important;
background-color: #eee !important;
}
.toolbar-vertical .handle-horizontal {
display: none; display: none;
} }
.channel-icon .channel-icon-active { .channel-icon .channel-icon-active {
@ -307,3 +355,67 @@ form {
width: 400px; width: 400px;
left: calc(50% - 200px); left: calc(50% - 200px);
} }
/****************/
/* Minimal view */
/****************/
.minimal .toolbar-horizontal ~ .channel-root-container {
width: calc(98% - 6px);
}
.minimal .toolbar-vertical ~ .channel-root-container {
width: calc(98% - 42px);
}
.minimal .handle-horizontal {
display: none;
}
.minimal .handle-vertical {
display: none;
}
.minimal .divider {
display: none;
}
.minimal .tb-connect {
display: none;
}
.minimal .tb-information {
display: none;
}
.minimal .tb-record {
display: none;
}
.minimal .tb-comment {
display: none;
}
.minimal .tb-settings {
display: none;
}
.minimal .tb-sourcecode {
display: none;
}
.minimal .chat {
display: none;
}
.minimal .channel-wrapper {
display: none;
}
.minimal .channel {
display: none;
}
.minimal .user-tree {
display: none;
}
.minimal .user-wrapper {
margin-left: 0px;
}
.minimal .user {
margin-left: 0px;
padding-top: 0px;
padding-bottom: 0px;
border: none;
height: 19px;
}
.minimal .user-status {
height: 19px;
}