2020-08-05 22:08:55 +05:30
|
|
|
/*
|
|
|
|
Copyright 2020 Bruno Windels <bruno@windels.cloud>
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2020-10-06 15:53:17 +05:30
|
|
|
import {LeftPanelView} from "./leftpanel/LeftPanelView.js";
|
2020-04-21 00:56:39 +05:30
|
|
|
import {RoomView} from "./room/RoomView.js";
|
2020-10-06 15:53:17 +05:30
|
|
|
import {TemplateView} from "../general/TemplateView.js";
|
2020-10-08 19:44:59 +05:30
|
|
|
import {StaticView} from "../general/StaticView.js";
|
2020-05-06 02:46:51 +05:30
|
|
|
import {SessionStatusView} from "./SessionStatusView.js";
|
2020-10-07 16:01:24 +05:30
|
|
|
import {RoomGridView} from "./RoomGridView.js";
|
2019-02-28 03:20:08 +05:30
|
|
|
|
2020-10-06 15:53:17 +05:30
|
|
|
export class SessionView extends TemplateView {
|
|
|
|
render(t, vm) {
|
|
|
|
return t.div({
|
2020-10-06 17:01:23 +05:30
|
|
|
className: {
|
|
|
|
"SessionView": true,
|
2020-10-14 17:50:53 +05:30
|
|
|
"room-shown": vm => vm.activeSection !== "placeholder"
|
2020-10-06 17:01:23 +05:30
|
|
|
},
|
2020-10-06 15:53:17 +05:30
|
|
|
}, [
|
|
|
|
t.view(new SessionStatusView(vm.sessionStatusViewModel)),
|
|
|
|
t.div({className: "main"}, [
|
|
|
|
t.view(new LeftPanelView(vm.leftPanelViewModel)),
|
2020-10-09 23:13:11 +05:30
|
|
|
t.mapView(vm => vm.activeSection, activeSection => {
|
|
|
|
switch (activeSection) {
|
2020-10-07 16:01:24 +05:30
|
|
|
case "roomgrid":
|
|
|
|
return new RoomGridView(vm.roomGridViewModel);
|
|
|
|
case "placeholder":
|
2020-10-08 19:44:59 +05:30
|
|
|
return new StaticView(t => t.div({className: "room-placeholder"}, t.h2(vm.i18n`Choose a room on the left side.`)));
|
2020-10-16 21:36:20 +05:30
|
|
|
case "settings":
|
|
|
|
return new SettingsView(vm.settingsViewModel);
|
2020-10-07 18:02:57 +05:30
|
|
|
default: //room id
|
2020-10-09 23:13:11 +05:30
|
|
|
return new RoomView(vm.currentRoomViewModel);
|
2020-10-06 15:53:17 +05:30
|
|
|
}
|
|
|
|
})
|
2019-06-16 14:22:02 +05:30
|
|
|
])
|
|
|
|
]);
|
2019-02-28 03:20:08 +05:30
|
|
|
}
|
|
|
|
}
|
2020-10-16 21:36:20 +05:30
|
|
|
|
|
|
|
class SettingsView extends TemplateView {
|
|
|
|
render(t, vm) {
|
|
|
|
let version = vm.version;
|
|
|
|
if (vm.showUpdateButton) {
|
|
|
|
version = t.span([
|
|
|
|
vm.version,
|
|
|
|
t.button({onClick: () => vm.checkForUpdate()}, vm.i18n`Check for updates`)
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
const row = (label, content, extraClass = "") => {
|
|
|
|
return t.div({className: `row ${extraClass}`}, [
|
|
|
|
t.div({className: "label"}, label),
|
|
|
|
t.div({className: "content"}, content),
|
|
|
|
]);
|
|
|
|
};
|
|
|
|
|
|
|
|
return t.div({className: "Settings"}, [
|
|
|
|
t.div({className: "header"}, [
|
|
|
|
t.a({className: "button-utility close-room", href: vm.closeUrl, title: vm.i18n`Close room`}),
|
|
|
|
t.h2("Settings")
|
|
|
|
]),
|
|
|
|
t.div([
|
|
|
|
row(vm.i18n`User ID`, vm.userId),
|
|
|
|
row(vm.i18n`Session ID`, vm.deviceId),
|
|
|
|
row(vm.i18n`Session key`, vm.fingerprintKey, "key"),
|
|
|
|
row(vm.i18n`Version`, version),
|
|
|
|
])
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|