Keep RoomInfoView open across room/grid changes

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-05-31 22:14:43 +05:30
parent 02d79b52a4
commit 426d0779ee
4 changed files with 17 additions and 8 deletions

View file

@ -113,6 +113,9 @@ export function parseUrlPath(urlPath, currentNavPath, defaultSessionId) {
segments.push(roomsSegmentWithRoom(rooms, roomId, currentNavPath)); segments.push(roomsSegmentWithRoom(rooms, roomId, currentNavPath));
} }
segments.push(new Segment("room", roomId)); segments.push(new Segment("room", roomId));
if (currentNavPath.get("details")?.value) {
segments.push(new Segment("details"));
}
} else if (type === "last-session") { } else if (type === "last-session") {
let sessionSegment = currentNavPath.get("session"); let sessionSegment = currentNavPath.get("session");
if (typeof sessionSegment?.value !== "string" && defaultSessionId) { if (typeof sessionSegment?.value !== "string" && defaultSessionId) {

View file

@ -84,7 +84,11 @@ export class RoomGridViewModel extends ViewModel {
} }
const vmo = this._viewModelsObservables[index]; const vmo = this._viewModelsObservables[index];
if (vmo) { if (vmo) {
const detailsShown = !!this.navigation.path.get("details");
this.navigation.push("room", vmo.id); this.navigation.push("room", vmo.id);
if (detailsShown) {
this.navigation.push("details", true);
}
} else { } else {
this.navigation.push("empty-grid-tile", index); this.navigation.push("empty-grid-tile", index);
} }

View file

@ -63,6 +63,7 @@ export class SessionViewModel extends ViewModel {
if (!this._gridViewModel) { if (!this._gridViewModel) {
this._updateRoom(roomId); this._updateRoom(roomId);
} }
this._toggleRoomInformationPanel();
})); }));
if (!this._gridViewModel) { if (!this._gridViewModel) {
this._updateRoom(currentRoomId.get()); this._updateRoom(currentRoomId.get());
@ -125,8 +126,6 @@ export class SessionViewModel extends ViewModel {
_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");
// Close right-panel if needed
this._toggleRoomInformationPanel();
if (roomIds) { if (roomIds) {
if (!this._gridViewModel) { if (!this._gridViewModel) {
this._gridViewModel = this.track(new RoomGridViewModel(this.childOptions({ this._gridViewModel = this.track(new RoomGridViewModel(this.childOptions({

View file

@ -93,11 +93,13 @@ export class LeftPanelViewModel extends ViewModel {
} }
toggleGrid() { toggleGrid() {
const details = this.navigation.path.get("details");
if (this.gridEnabled) { if (this.gridEnabled) {
let path = this.navigation.path.until("session"); let path = this.navigation.path.until("session");
const room = this.navigation.path.get("room"); const room = this.navigation.path.get("room");
if (room) { if (room) {
path = path.with(room); path = path.with(room);
path = path.with(details);
} }
this.navigation.applyPath(path); this.navigation.applyPath(path);
} else { } else {
@ -106,6 +108,7 @@ export class LeftPanelViewModel extends ViewModel {
if (room) { if (room) {
path = path.with(this.navigation.segment("rooms", [room.value])); path = path.with(this.navigation.segment("rooms", [room.value]));
path = path.with(room); path = path.with(room);
path = path.with(details);
} else { } else {
path = path.with(this.navigation.segment("rooms", [])); path = path.with(this.navigation.segment("rooms", []));
path = path.with(this.navigation.segment("empty-grid-tile", 0)); path = path.with(this.navigation.segment("empty-grid-tile", 0));