forked from mystiq/hydrogen-web
Add view and vm for RoomInformation
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
e4a1c99615
commit
c7ba472042
2 changed files with 38 additions and 0 deletions
25
src/domain/session/rightpanel/RoomInfoViewModel.js
Normal file
25
src/domain/session/rightpanel/RoomInfoViewModel.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { ViewModel } from "../../ViewModel.js";
|
||||
|
||||
export class RoomInfoViewModel extends ViewModel {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
this._room = options.room;
|
||||
this._roomSummary = this._room._summary._data;
|
||||
}
|
||||
|
||||
get roomId() {
|
||||
return this._room.id;
|
||||
}
|
||||
|
||||
get name() {
|
||||
return this._roomSummary.name || this._room._heroes._roomName;
|
||||
}
|
||||
|
||||
get isEncrypted() {
|
||||
return !!this._roomSummary.encryption;
|
||||
}
|
||||
|
||||
get memberCount() {
|
||||
return this._roomSummary.joinCount;
|
||||
}
|
||||
}
|
13
src/platform/web/ui/session/rightpanel/RoomInfoView.js
Normal file
13
src/platform/web/ui/session/rightpanel/RoomInfoView.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { TemplateView } from "../../general/TemplateView.js";
|
||||
import { text } from "../../general/html.js";
|
||||
|
||||
export class RoomInfoView extends TemplateView {
|
||||
render(t, vm) {
|
||||
return t.div({ className: "RoomInfo" }, [
|
||||
t.div({ className: "RoomName" }, [text(vm.name)]),
|
||||
t.div({ className: "RoomId" }, [text(vm.roomId)]),
|
||||
t.div({ className: "RoomMemberCount" }, [text(vm.memberCount)]),
|
||||
t.div({ className: "RoomEncryption" }, [vm.isEncrypted ? "Encrypted" : "Not Encrypted"])
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue