1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-19 04:49:37 +02:00

Refactor adventure category handling: update type definitions, enhance category management in UI components, and implement user-specific category deletion logic in the backend

This commit is contained in:
Sean Morley 2024-11-23 13:42:41 -05:00
parent 736ede2417
commit 8e5a20ec62
12 changed files with 324 additions and 93 deletions

View file

@ -292,3 +292,16 @@ export function getRandomBackground() {
const randomIndex = Math.floor(Math.random() * randomBackgrounds.backgrounds.length);
return randomBackgrounds.backgrounds[randomIndex] as Background;
}
export function findFirstValue(obj: any): any {
for (const key in obj) {
if (typeof obj[key] === 'object' && obj[key] !== null) {
const value = findFirstValue(obj[key]);
if (value !== undefined) {
return value;
}
} else {
return obj[key];
}
}
}