add very basic invite view

This commit is contained in:
Bruno Windels 2021-04-21 17:25:59 +02:00
parent f596b34cac
commit bfb7f58a3d
3 changed files with 51 additions and 1 deletions

View file

@ -15,6 +15,7 @@ limitations under the License.
*/
import {RoomView} from "./room/RoomView.js";
import {InviteView} from "./room/InviteView.js";
import {TemplateView} from "../general/TemplateView.js";
import {StaticView} from "../general/StaticView.js";
@ -32,7 +33,11 @@ export class RoomGridView extends TemplateView {
},
}, t.mapView(vm => vm.roomViewModelAt(i), roomVM => {
if (roomVM) {
return new RoomView(roomVM);
if (roomVM.kind === "invite") {
return new InviteView(roomVM);
} else {
return new RoomView(roomVM);
}
} else {
return new StaticView(t => t.div({className: "room-placeholder"}, [
t.h2({className: "focused"}, vm.i18n`Select a room on the left`),

View file

@ -17,6 +17,7 @@ limitations under the License.
import {LeftPanelView} from "./leftpanel/LeftPanelView.js";
import {RoomView} from "./room/RoomView.js";
import {InviteView} from "./room/InviteView.js";
import {LightboxView} from "./room/LightboxView.js";
import {TemplateView} from "../general/TemplateView.js";
import {StaticView} from "../general/StaticView.js";
@ -40,7 +41,11 @@ export class SessionView extends TemplateView {
} else if (vm.settingsViewModel) {
return new SettingsView(vm.settingsViewModel);
} else if (vm.currentRoomViewModel) {
if (vm.currentRoomViewModel.kind === "invite") {
return new InviteView(vm.currentRoomViewModel);
} else {
return new RoomView(vm.currentRoomViewModel);
}
} else {
return new StaticView(t => t.div({className: "room-placeholder"}, t.h2(vm.i18n`Choose a room on the left side.`)));
}

View file

@ -0,0 +1,40 @@
/*
Copyright 2020 Bruno Windels <bruno@windels.cloud>
Copyright 2020 The Matrix.org Foundation C.I.C.
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.
*/
import {TemplateView} from "../../general/TemplateView.js";
// import {TimelineList} from "./TimelineList.js";
// import {TimelineLoadingView} from "./TimelineLoadingView.js";
// import {MessageComposer} from "./MessageComposer.js";
import {renderStaticAvatar} from "../../avatar.js";
export class InviteView extends TemplateView {
render(t, vm) {
return t.main({className: "InviteView middle"}, [
t.div({className: "TimelinePanel"}, [
t.div({className: "RoomHeader middle-header"}, [
t.a({className: "button-utility close-middle", href: vm.closeUrl, title: vm.i18n`Close invite`}),
renderStaticAvatar(vm, 32),
t.div({className: "room-description"}, [
t.h2(vm => vm.name),
]),
]),
t.div({className: "RoomView_error"}, vm => vm.error),
t.div(`You were invited into this room!`)
])
]);
}
}