From 40488a3d7c44e287ff2cb140be3fd978d8a1d4f3 Mon Sep 17 00:00:00 2001 From: TheFlow Date: Sat, 1 Nov 2025 11:41:18 +1300 Subject: [PATCH] fix: handle undefined technicalLevel in cards and set glossary category MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added null check for section.technicalLevel (defaults to 'basic') - Prevents "Cannot read properties of undefined (reading 'charAt')" error - Updated fix-glossary-structure.js to set category: 'getting-started' - Moves glossary back to Getting Started section where it belongs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- public/js/components/document-cards.js | 5 +++-- scripts/fix-glossary-structure.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/public/js/components/document-cards.js b/public/js/components/document-cards.js index 30ae6659..7983a219 100644 --- a/public/js/components/document-cards.js +++ b/public/js/components/document-cards.js @@ -234,8 +234,9 @@ class DocumentCards { advanced: '●' }; - const levelIcon = levelIcons[section.technicalLevel] || '○'; - const levelLabel = section.technicalLevel.charAt(0).toUpperCase() + section.technicalLevel.slice(1); + const technicalLevel = section.technicalLevel || 'basic'; + const levelIcon = levelIcons[technicalLevel] || '○'; + const levelLabel = technicalLevel.charAt(0).toUpperCase() + technicalLevel.slice(1); // Add soft hyphens to long titles for better wrapping const titleWithHyphens = this.insertSoftHyphens(section.title); diff --git a/scripts/fix-glossary-structure.js b/scripts/fix-glossary-structure.js index 76f436f5..68144bb4 100644 --- a/scripts/fix-glossary-structure.js +++ b/scripts/fix-glossary-structure.js @@ -160,6 +160,7 @@ async function run() { { $set: { slug: 'glossary', // Normalize to lowercase + category: 'getting-started', // Move to Getting Started section sections: sections, translations: translations, content_html: markdownToHtml(en.content),