mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 19:45:05 +01:00
Remove duplication
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
ab0a48ab31
commit
41806b5e82
@ -87,6 +87,11 @@ function roomsSegmentWithRoom(rooms, roomId, path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pushRightPanelSegment(array, segment) {
|
||||||
|
array.push(new Segment("right-panel"));
|
||||||
|
array.push(new Segment(segment));
|
||||||
|
}
|
||||||
|
|
||||||
export function parseUrlPath(urlPath, currentNavPath, defaultSessionId) {
|
export function parseUrlPath(urlPath, currentNavPath, defaultSessionId) {
|
||||||
// substr(1) to take of initial /
|
// substr(1) to take of initial /
|
||||||
const parts = urlPath.substr(1).split("/");
|
const parts = urlPath.substr(1).split("/");
|
||||||
@ -116,8 +121,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("right-panel"));
|
pushRightPanelSegment(segments, "details");
|
||||||
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");
|
||||||
@ -127,13 +131,8 @@ export function parseUrlPath(urlPath, currentNavPath, defaultSessionId) {
|
|||||||
if (sessionSegment) {
|
if (sessionSegment) {
|
||||||
segments.push(sessionSegment);
|
segments.push(sessionSegment);
|
||||||
}
|
}
|
||||||
} else if (type === "details") {
|
} else if (type === "details" || type === "members") {
|
||||||
segments.push(new Segment("right-panel"));
|
pushRightPanelSegment(segments, type);
|
||||||
segments.push(new Segment("details"));
|
|
||||||
} else if (type === "members") {
|
|
||||||
//TODO: Fix duplication here.
|
|
||||||
segments.push(new Segment("right-panel"));
|
|
||||||
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
|
||||||
const value = iterator.next().value;
|
const value = iterator.next().value;
|
||||||
|
Loading…
Reference in New Issue
Block a user