Reduce duplication in code
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
04933acbfb
commit
7f922afe79
1 changed files with 3 additions and 6 deletions
|
@ -93,20 +93,17 @@ export class LeftPanelViewModel extends ViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleGrid() {
|
toggleGrid() {
|
||||||
|
const room = this.navigation.path.get("room");
|
||||||
const details = this.navigation.path.get("details");
|
const details = this.navigation.path.get("details");
|
||||||
|
let path = this.navigation.path.until("session");
|
||||||
if (this.gridEnabled) {
|
if (this.gridEnabled) {
|
||||||
let path = this.navigation.path.until("session");
|
|
||||||
const room = this.navigation.path.get("room");
|
|
||||||
if (room) {
|
if (room) {
|
||||||
path = path.with(room);
|
path = path.with(room);
|
||||||
if (details) {
|
if (details) {
|
||||||
path = path.with(details);
|
path = path.with(details);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.navigation.applyPath(path);
|
|
||||||
} else {
|
} else {
|
||||||
let path = this.navigation.path.until("session");
|
|
||||||
const room = this.navigation.path.get("room");
|
|
||||||
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);
|
||||||
|
@ -117,8 +114,8 @@ export class LeftPanelViewModel extends ViewModel {
|
||||||
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));
|
||||||
}
|
}
|
||||||
this.navigation.applyPath(path);
|
|
||||||
}
|
}
|
||||||
|
this.navigation.applyPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
get tileViewModels() {
|
get tileViewModels() {
|
||||||
|
|
Reference in a new issue