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(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) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {ViewModel} from "../ViewModel.js";
|
import { ViewModel } from "../ViewModel.js";
|
||||||
|
|
||||||
function dedupeSparse(roomIds) {
|
function dedupeSparse(roomIds) {
|
||||||
return roomIds.map((id, idx) => {
|
return roomIds.map((id, idx) => {
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -146,7 +150,7 @@ export class RoomGridViewModel extends ViewModel {
|
||||||
this.emitChange();
|
this.emitChange();
|
||||||
viewModel?.focus();
|
viewModel?.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** called from SessionViewModel */
|
/** called from SessionViewModel */
|
||||||
releaseRoomViewModel(roomId) {
|
releaseRoomViewModel(roomId) {
|
||||||
const index = this._viewModelsObservables.findIndex(vmo => vmo && vmo.id === roomId);
|
const index = this._viewModelsObservables.findIndex(vmo => vmo && vmo.id === roomId);
|
||||||
|
@ -177,10 +181,10 @@ export class RoomGridViewModel extends ViewModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
import {createNavigation} from "../navigation/index.js";
|
import { createNavigation } from "../navigation/index.js";
|
||||||
import {ObservableValue} from "../../observable/ObservableValue.js";
|
import { ObservableValue } from "../../observable/ObservableValue.js";
|
||||||
|
|
||||||
export function tests() {
|
export function tests() {
|
||||||
class RoomVMMock {
|
class RoomVMMock {
|
||||||
constructor(id) {
|
constructor(id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
@ -196,7 +200,7 @@ export function tests() {
|
||||||
}
|
}
|
||||||
|
|
||||||
class RoomViewModelObservableMock extends ObservableValue {
|
class RoomViewModelObservableMock extends ObservableValue {
|
||||||
async initialize() {}
|
async initialize() { }
|
||||||
dispose() { this.get()?.dispose(); }
|
dispose() { this.get()?.dispose(); }
|
||||||
get id() { return this.get()?.id; }
|
get id() { return this.get()?.id; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -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({
|
||||||
|
|
|
@ -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));
|
||||||
|
|
Reference in a new issue