Move details handling to separate function
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
7f922afe79
commit
a4bcb21a85
1 changed files with 7 additions and 7 deletions
|
@ -92,24 +92,24 @@ export class LeftPanelViewModel extends ViewModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_pathForDetails(path) {
|
||||||
|
const details = this.navigation.path.get("details");
|
||||||
|
return details ? path.with(details) : path;
|
||||||
|
}
|
||||||
|
|
||||||
toggleGrid() {
|
toggleGrid() {
|
||||||
const room = this.navigation.path.get("room");
|
const room = this.navigation.path.get("room");
|
||||||
const details = this.navigation.path.get("details");
|
|
||||||
let path = this.navigation.path.until("session");
|
let path = this.navigation.path.until("session");
|
||||||
if (this.gridEnabled) {
|
if (this.gridEnabled) {
|
||||||
if (room) {
|
if (room) {
|
||||||
path = path.with(room);
|
path = path.with(room);
|
||||||
if (details) {
|
path = this._pathForDetails(path);
|
||||||
path = path.with(details);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
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);
|
||||||
if (details) {
|
path = this._pathForDetails(path);
|
||||||
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