handle user menu, finish server settings, add tmporary WIP page for undone pages

This commit is contained in:
Stef-00012 2025-01-29 21:04:09 +01:00
parent 8d295153bc
commit c05a29c21d
No known key found for this signature in database
GPG key ID: 28BE9A9E4EF0E6BF
14 changed files with 1686 additions and 1109 deletions

View file

@ -96,38 +96,4 @@ export function colorHash(str: string) {
}
return color;
}
// biome-ignore lint/suspicious/noExplicitAny: can't know the type of the key
export function getObjectValue<T extends Record<string, any> = Record<string, any>>(obj: T, path: string): T[keyof T] | undefined {
const keys = path.split(".");
let result = obj;
for (const key of keys) {
if (result[key] === undefined) {
return undefined;
}
result = result[key];
}
return result as T[keyof T];
}
// biome-ignore lint/suspicious/noExplicitAny: can't know the type of the key
export function setObjectValue<T extends Record<string, any> = Record<string, any>>(obj: T, path: string, value: any): T {
const keys = path.split(".");
let result = obj;
for (let i = 0; i < keys.length - 1; i++) {
if (result[keys[i]] === undefined) {
(result as Record<string, unknown>)[keys[i]] = {};
}
result = result[keys[i]];
}
(result as Record<string, unknown>)[keys[keys.length - 1]] = value;
return result;
}