stream settings: Include section for right panel in the URL.

Fixes #21017.
This commit is contained in:
evykassirer
2023-11-09 11:28:32 -08:00
committed by Tim Abbott
parent 87e824d43e
commit aa9d69c728
9 changed files with 72 additions and 26 deletions

View File

@@ -15,6 +15,18 @@ export function get_hash_section(hash?: string): string {
return parts[1] || "";
}
export function get_current_nth_hash_section(n: number): string {
const hash = window.location.hash;
// given "#settings/profile" and n=2, returns "profile"
// given '#streams/5/social" and n=3, returns "social"
const parts = hash.replace(/\/$/, "").split(/\//);
if (parts.length < n) {
return "";
}
return parts[n - 1] || "";
}
export function get_current_hash_category(): string {
return get_hash_category(window.location.hash);
}