diff --git a/src/data/characters/TEMPLATE.json b/src/data/characters/TEMPLATE.json index a081c0f..a1100f3 100644 --- a/src/data/characters/TEMPLATE.json +++ b/src/data/characters/TEMPLATE.json @@ -1,5 +1,5 @@ { - "id": "", + "id": "unique-character-id", "name": "", "category": "", "dateAdded": "", diff --git a/src/utils/characters.ts b/src/utils/characters.ts index 7a5d910..cd46e91 100644 --- a/src/utils/characters.ts +++ b/src/utils/characters.ts @@ -13,7 +13,17 @@ export async function getAllCharacters(): Promise { return []; } - const characters = Object.values(characterModules) as Character[]; + const characters = Object.values(characterModules) + .filter((char: any) => { + // Filter out template and invalid characters + if (!char || typeof char !== 'object') return false; + if (!char.id || char.id === '') return false; + + // Get the filename from the module path + const path = Object.keys(characterModules).find(key => characterModules[key] === char) || ''; + return !path.includes('TEMPLATE.json'); + }) as Character[]; + console.log(`Found ${characters.length} characters`); // Sort by date added by default