Add code to toggle RoomInformation panel
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
c7fd0fac07
commit
986271d02a
1 changed files with 24 additions and 1 deletions
|
@ -16,7 +16,8 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {LeftPanelViewModel} from "./leftpanel/LeftPanelViewModel.js";
|
import {LeftPanelViewModel} from "./leftpanel/LeftPanelViewModel.js";
|
||||||
import {RoomViewModel} from "./room/RoomViewModel.js";
|
import { RoomViewModel } from "./room/RoomViewModel.js";
|
||||||
|
import { RoomInfoViewModel } from "./rightpanel/RoomInfoViewModel.js";
|
||||||
import {UnknownRoomViewModel} from "./room/UnknownRoomViewModel.js";
|
import {UnknownRoomViewModel} from "./room/UnknownRoomViewModel.js";
|
||||||
import {InviteViewModel} from "./room/InviteViewModel.js";
|
import {InviteViewModel} from "./room/InviteViewModel.js";
|
||||||
import {LightboxViewModel} from "./room/LightboxViewModel.js";
|
import {LightboxViewModel} from "./room/LightboxViewModel.js";
|
||||||
|
@ -78,6 +79,10 @@ export class SessionViewModel extends ViewModel {
|
||||||
this._updateLightbox(eventId);
|
this._updateLightbox(eventId);
|
||||||
}));
|
}));
|
||||||
this._updateLightbox(lightbox.get());
|
this._updateLightbox(lightbox.get());
|
||||||
|
|
||||||
|
const details = this.navigation.observe("details");
|
||||||
|
this.track(details.subscribe(() => this._toggleRoomInformationPanel()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get id() {
|
get id() {
|
||||||
|
@ -112,6 +117,10 @@ export class SessionViewModel extends ViewModel {
|
||||||
return this._roomViewModelObservable?.get();
|
return this._roomViewModelObservable?.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get roomInfoViewModel() {
|
||||||
|
return this._roomInfoViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
_updateGrid(roomIds) {
|
_updateGrid(roomIds) {
|
||||||
const changed = !(this._gridViewModel && roomIds);
|
const changed = !(this._gridViewModel && roomIds);
|
||||||
const currentRoomId = this.navigation.path.get("room");
|
const currentRoomId = this.navigation.path.get("room");
|
||||||
|
@ -240,4 +249,18 @@ export class SessionViewModel extends ViewModel {
|
||||||
get lightboxViewModel() {
|
get lightboxViewModel() {
|
||||||
return this._lightboxViewModel;
|
return this._lightboxViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_toggleRoomInformationPanel() {
|
||||||
|
const roomId = this.navigation.path.get("room").value;
|
||||||
|
const room = this._sessionContainer.session.rooms.get(roomId);
|
||||||
|
const enable = !!this.navigation.path.get("details");
|
||||||
|
if (!room) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._roomInfoViewModel = enable ?
|
||||||
|
this.track(new RoomInfoViewModel(this.childOptions({ room }))) :
|
||||||
|
this.disposeTracked(this._roomInfoViewModel);
|
||||||
|
this.emitChange();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue