mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-10 18:14:40 +00:00
feat: Support direct clan detail links (#3928)
## Description: Add support for opening clan details directly with `clan=<tag>` ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: aotumuri
This commit is contained in:
@@ -123,6 +123,24 @@ class ModalRouter {
|
||||
this.replaceHash("#" + params.toString());
|
||||
}
|
||||
|
||||
/** Called when a router-managed modal changes non-tab route state. */
|
||||
syncArgs(name: string, args: Record<string, unknown>): void {
|
||||
if (this.routingFromUrl) return;
|
||||
if (this.currentName !== name) return;
|
||||
const params = this.currentHashParams();
|
||||
params.set("modal", name);
|
||||
for (const [key, value] of Object.entries(args)) {
|
||||
if (key === "modal") continue;
|
||||
if (value === undefined || value === null || value === "") {
|
||||
params.delete(key);
|
||||
continue;
|
||||
}
|
||||
if (typeof value === "object") continue;
|
||||
params.set(key, String(value));
|
||||
}
|
||||
this.replaceHash("#" + params.toString());
|
||||
}
|
||||
|
||||
/** True if the current hash is `#modal=...`. */
|
||||
isHashRouted(): boolean {
|
||||
const hash = window.location.hash;
|
||||
@@ -142,7 +160,7 @@ class ModalRouter {
|
||||
if (args) {
|
||||
for (const [key, value] of Object.entries(args)) {
|
||||
if (key === "modal") continue;
|
||||
if (value === undefined || value === null) continue;
|
||||
if (value === undefined || value === null || value === "") continue;
|
||||
if (typeof value === "object") continue;
|
||||
params.set(key, String(value));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user