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

View file

@ -83,7 +83,7 @@ export class RoomGridViewModel extends ViewModel {
let path = this.navigation.path.until("rooms"); let path = this.navigation.path.until("rooms");
path = path.with(this.navigation.segment("room", roomId)); path = path.with(this.navigation.segment("room", roomId));
if (detailsShown) { 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)); path = path.with(this.navigation.segment("details", true));
} }
this.navigation.applyPath(path); this.navigation.applyPath(path);

View file

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

View file

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

View file

@ -290,7 +290,7 @@ export class RoomViewModel extends ViewModel {
openDetailsPanel() { openDetailsPanel() {
let path = this.navigation.path.until("room"); 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)); path = path.with(this.navigation.segment("details", true));
this.navigation.applyPath(path); this.navigation.applyPath(path);
} }