2020-08-05 22:08:55 +05:30
|
|
|
/*
|
|
|
|
Copyright 2020 Bruno Windels <bruno@windels.cloud>
|
2020-10-19 18:25:01 +05:30
|
|
|
Copyright 2020 The Matrix.org Foundation C.I.C.
|
2020-08-05 22:08:55 +05:30
|
|
|
|
|
|
|
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";
|
2021-05-18 14:37:19 +05:30
|
|
|
import {UnknownRoomView} from "./room/UnknownRoomView.js";
|
2021-04-21 20:55:59 +05:30
|
|
|
import {InviteView} from "./room/InviteView.js";
|
2020-10-28 22:12:18 +05:30
|
|
|
import {LightboxView} from "./room/LightboxView.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";
|
2020-10-19 21:59:13 +05:30
|
|
|
import {SettingsView} from "./settings/SettingsView.js";
|
2021-06-14 20:33:32 +05:30
|
|
|
import {RoomDetailsView} from "./rightpanel/RoomDetailsView.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,
|
2021-05-24 22:19:05 +05:30
|
|
|
"middle-shown": vm => !!vm.activeMiddleViewModel,
|
2021-06-07 00:19:31 +05:30
|
|
|
"right-shown": vm => !!vm.roomDetailsViewModel
|
2020-10-06 17:01:23 +05:30
|
|
|
},
|
2020-10-06 15:53:17 +05:30
|
|
|
}, [
|
|
|
|
t.view(new SessionStatusView(vm.sessionStatusViewModel)),
|
2020-10-28 21:26:20 +05:30
|
|
|
t.view(new LeftPanelView(vm.leftPanelViewModel)),
|
2021-04-21 19:17:39 +05:30
|
|
|
t.mapView(vm => vm.activeMiddleViewModel, () => {
|
|
|
|
if (vm.roomGridViewModel) {
|
|
|
|
return new RoomGridView(vm.roomGridViewModel);
|
|
|
|
} else if (vm.settingsViewModel) {
|
|
|
|
return new SettingsView(vm.settingsViewModel);
|
|
|
|
} else if (vm.currentRoomViewModel) {
|
2021-04-21 20:55:59 +05:30
|
|
|
if (vm.currentRoomViewModel.kind === "invite") {
|
|
|
|
return new InviteView(vm.currentRoomViewModel);
|
2021-05-18 14:37:19 +05:30
|
|
|
} else if (vm.currentRoomViewModel.kind === "room") {
|
2020-10-28 21:26:20 +05:30
|
|
|
return new RoomView(vm.currentRoomViewModel);
|
2021-05-18 14:37:19 +05:30
|
|
|
} else {
|
|
|
|
return new UnknownRoomView(vm.currentRoomViewModel);
|
2021-04-21 20:55:59 +05:30
|
|
|
}
|
2021-04-21 19:17:39 +05:30
|
|
|
} else {
|
|
|
|
return new StaticView(t => t.div({className: "room-placeholder"}, t.h2(vm.i18n`Choose a room on the left side.`)));
|
2020-10-28 21:26:20 +05:30
|
|
|
}
|
|
|
|
}),
|
2021-06-07 00:19:31 +05:30
|
|
|
t.mapView(vm => vm.roomDetailsViewModel, roomDetailsViewModel => roomDetailsViewModel ? new RoomDetailsView(roomDetailsViewModel) : null),
|
2020-10-28 22:12:18 +05:30
|
|
|
t.mapView(vm => vm.lightboxViewModel, lightboxViewModel => lightboxViewModel ? new LightboxView(lightboxViewModel) : null)
|
2019-06-16 14:22:02 +05:30
|
|
|
]);
|
2019-02-28 03:20:08 +05:30
|
|
|
}
|
|
|
|
}
|