Keep RoomInfoView open across room/grid changes
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
02d79b52a4
commit
426d0779ee
4 changed files with 17 additions and 8 deletions
|
@ -113,6 +113,9 @@ export function parseUrlPath(urlPath, currentNavPath, defaultSessionId) {
|
|||
segments.push(roomsSegmentWithRoom(rooms, roomId, currentNavPath));
|
||||
}
|
||||
segments.push(new Segment("room", roomId));
|
||||
if (currentNavPath.get("details")?.value) {
|
||||
segments.push(new Segment("details"));
|
||||
}
|
||||
} else if (type === "last-session") {
|
||||
let sessionSegment = currentNavPath.get("session");
|
||||
if (typeof sessionSegment?.value !== "string" && defaultSessionId) {
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {ViewModel} from "../ViewModel.js";
|
||||
import { ViewModel } from "../ViewModel.js";
|
||||
|
||||
function dedupeSparse(roomIds) {
|
||||
return roomIds.map((id, idx) => {
|
||||
|
@ -84,7 +84,11 @@ export class RoomGridViewModel extends ViewModel {
|
|||
}
|
||||
const vmo = this._viewModelsObservables[index];
|
||||
if (vmo) {
|
||||
const detailsShown = !!this.navigation.path.get("details");
|
||||
this.navigation.push("room", vmo.id);
|
||||
if (detailsShown) {
|
||||
this.navigation.push("details", true);
|
||||
}
|
||||
} else {
|
||||
this.navigation.push("empty-grid-tile", index);
|
||||
}
|
||||
|
@ -177,8 +181,8 @@ export class RoomGridViewModel extends ViewModel {
|
|||
}
|
||||
}
|
||||
|
||||
import {createNavigation} from "../navigation/index.js";
|
||||
import {ObservableValue} from "../../observable/ObservableValue.js";
|
||||
import { createNavigation } from "../navigation/index.js";
|
||||
import { ObservableValue } from "../../observable/ObservableValue.js";
|
||||
|
||||
export function tests() {
|
||||
class RoomVMMock {
|
||||
|
@ -196,7 +200,7 @@ export function tests() {
|
|||
}
|
||||
|
||||
class RoomViewModelObservableMock extends ObservableValue {
|
||||
async initialize() {}
|
||||
async initialize() { }
|
||||
dispose() { this.get()?.dispose(); }
|
||||
get id() { return this.get()?.id; }
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ export class SessionViewModel extends ViewModel {
|
|||
if (!this._gridViewModel) {
|
||||
this._updateRoom(roomId);
|
||||
}
|
||||
this._toggleRoomInformationPanel();
|
||||
}));
|
||||
if (!this._gridViewModel) {
|
||||
this._updateRoom(currentRoomId.get());
|
||||
|
@ -125,8 +126,6 @@ export class SessionViewModel extends ViewModel {
|
|||
_updateGrid(roomIds) {
|
||||
const changed = !(this._gridViewModel && roomIds);
|
||||
const currentRoomId = this.navigation.path.get("room");
|
||||
// Close right-panel if needed
|
||||
this._toggleRoomInformationPanel();
|
||||
if (roomIds) {
|
||||
if (!this._gridViewModel) {
|
||||
this._gridViewModel = this.track(new RoomGridViewModel(this.childOptions({
|
||||
|
|
|
@ -93,11 +93,13 @@ export class LeftPanelViewModel extends ViewModel {
|
|||
}
|
||||
|
||||
toggleGrid() {
|
||||
const details = this.navigation.path.get("details");
|
||||
if (this.gridEnabled) {
|
||||
let path = this.navigation.path.until("session");
|
||||
const room = this.navigation.path.get("room");
|
||||
if (room) {
|
||||
path = path.with(room);
|
||||
path = path.with(details);
|
||||
}
|
||||
this.navigation.applyPath(path);
|
||||
} else {
|
||||
|
@ -106,6 +108,7 @@ export class LeftPanelViewModel extends ViewModel {
|
|||
if (room) {
|
||||
path = path.with(this.navigation.segment("rooms", [room.value]));
|
||||
path = path.with(room);
|
||||
path = path.with(details);
|
||||
} else {
|
||||
path = path.with(this.navigation.segment("rooms", []));
|
||||
path = path.with(this.navigation.segment("empty-grid-tile", 0));
|
||||
|
|
Reference in a new issue