diff --git a/src/platform/web/ui/session/RoomGridView.js b/src/platform/web/ui/session/RoomGridView.js index 685dcb99..043137fb 100644 --- a/src/platform/web/ui/session/RoomGridView.js +++ b/src/platform/web/ui/session/RoomGridView.js @@ -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`), diff --git a/src/platform/web/ui/session/SessionView.js b/src/platform/web/ui/session/SessionView.js index e05d97ad..c7abd4db 100644 --- a/src/platform/web/ui/session/SessionView.js +++ b/src/platform/web/ui/session/SessionView.js @@ -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.`))); } diff --git a/src/platform/web/ui/session/room/InviteView.js b/src/platform/web/ui/session/room/InviteView.js new file mode 100644 index 00000000..8fdf6cf7 --- /dev/null +++ b/src/platform/web/ui/session/room/InviteView.js @@ -0,0 +1,40 @@ +/* +Copyright 2020 Bruno Windels +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!`) + ]) + ]); + } +}