rename rightpanel to right-panel

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-06-30 14:22:39 +05:30
parent 3bb82e55bf
commit ab0a48ab31
5 changed files with 15 additions and 15 deletions

View File

@ -37,8 +37,8 @@ function allowsChild(parent, child) {
// downside of the approach: both of these will control which tile is selected
return type === "room" || type === "empty-grid-tile";
case "room":
return type === "lightbox" || type === "rightpanel";
case "rightpanel":
return type === "lightbox" || type === "right-panel";
case "right-panel":
return type === "details"|| type === "members";
default:
return false;
@ -116,7 +116,7 @@ export function parseUrlPath(urlPath, currentNavPath, defaultSessionId) {
}
segments.push(new Segment("room", roomId));
if (currentNavPath.get("details")?.value) {
segments.push(new Segment("rightpanel"));
segments.push(new Segment("right-panel"));
segments.push(new Segment("details"));
}
} else if (type === "last-session") {
@ -128,11 +128,11 @@ export function parseUrlPath(urlPath, currentNavPath, defaultSessionId) {
segments.push(sessionSegment);
}
} else if (type === "details") {
segments.push(new Segment("rightpanel"));
segments.push(new Segment("right-panel"));
segments.push(new Segment("details"));
} else if (type === "members") {
//TODO: Fix duplication here.
segments.push(new Segment("rightpanel"));
segments.push(new Segment("right-panel"));
segments.push(new Segment("members"));
} else {
// might be undefined, which will be turned into true by Segment
@ -162,7 +162,7 @@ export function stringifyPath(path) {
urlPath += `/${segment.type}/${segment.value}`;
}
break;
case "rightpanel":
case "right-panel":
continue;
default:
urlPath += `/${segment.type}`;
@ -197,13 +197,13 @@ export function tests() {
const urlPath = stringifyPath(path);
assert.equal(urlPath, "/session/1/rooms/a,b,c/1");
},
"stringify url with rightpanel and details segment": assert => {
"stringify url with right-panel and details segment": assert => {
const nav = new Navigation(allowsChild);
const path = nav.pathFrom([
new Segment("session", 1),
new Segment("rooms", ["a", "b", "c"]),
new Segment("room", "b"),
new Segment("rightpanel"),
new Segment("right-panel"),
new Segment("details")
]);
const urlPath = stringifyPath(path);
@ -287,7 +287,7 @@ export function tests() {
new Segment("session", 1),
new Segment("rooms", ["a", "b", "c"]),
new Segment("room", "b"),
new Segment("rightpanel", true),
new Segment("right-panel", true),
new Segment("details", true)
]);
const segments = parseUrlPath("/session/1/open-room/a", path);
@ -298,7 +298,7 @@ export function tests() {
assert.deepEqual(segments[1].value, ["a", "b", "c"]);
assert.equal(segments[2].type, "room");
assert.equal(segments[2].value, "a");
assert.equal(segments[3].type, "rightpanel");
assert.equal(segments[3].type, "right-panel");
assert.equal(segments[3].value, true);
assert.equal(segments[4].type, "details");
assert.equal(segments[4].value, true);

View File

@ -83,7 +83,7 @@ export class RoomGridViewModel extends ViewModel {
let path = this.navigation.path.until("rooms");
path = path.with(this.navigation.segment("room", roomId));
if (detailsShown) {
path = path.with(this.navigation.segment("rightpanel", true));
path = path.with(this.navigation.segment("right-panel", true));
path = path.with(this.navigation.segment("details", true));
}
this.navigation.applyPath(path);

View File

@ -82,7 +82,7 @@ export class SessionViewModel extends ViewModel {
this._updateLightbox(lightbox.get());
const rightpanel = this.navigation.observe("rightpanel");
const rightpanel = this.navigation.observe("right-panel");
this.track(rightpanel.subscribe(() => this._updateRightPanel()));
this._updateRightPanel();
}
@ -260,7 +260,7 @@ export class SessionViewModel extends ViewModel {
_updateRightPanel() {
this._rightPanelViewModel = this.disposeTracked(this._rightPanelViewModel);
const enable = !!this.navigation.path.get("rightpanel")?.value;
const enable = !!this.navigation.path.get("right-panel")?.value;
if (enable) {
const room = this._roomFromNavigation();
this._rightPanelViewModel = this.track(new RightPanelViewModel(this.childOptions({room})));

View File

@ -96,7 +96,7 @@ export class LeftPanelViewModel extends ViewModel {
let _path = path;
const details = this.navigation.path.get("details");
if (details?.value) {
_path = _path.with(this.navigation.segment("rightpanel"));
_path = _path.with(this.navigation.segment("right-panel"));
_path = _path.with(details)
}
return _path;

View File

@ -290,7 +290,7 @@ export class RoomViewModel extends ViewModel {
openDetailsPanel() {
let path = this.navigation.path.until("room");
path = path.with(this.navigation.segment("rightpanel", true));
path = path.with(this.navigation.segment("right-panel", true));
path = path.with(this.navigation.segment("details", true));
this.navigation.applyPath(path);
}