From ce5dfdf7adb973dc59e5e43a2db7fee50664362d Mon Sep 17 00:00:00 2001 From: TheFlow Date: Sun, 26 Oct 2025 11:03:23 +1300 Subject: [PATCH] fix(docs): card overflow, sequencing, colour legend, and category fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed multiple issues with the docs page card-based document view: **Card Overflow Fixed:** - Added overflow-x-hidden to #document-content container - Added w-full max-w-full to card-grid-container - Added w-full to grid itself - Added max-w-full overflow-hidden to individual cards - Cards now stay within container boundaries at all viewport sizes **Long Title Wrapping:** - Added insertSoftHyphens() method to break CamelCase words - Inserts soft hyphens (­) before capitals in compound words - Examples: "InstructionPersistenceClassifier" → "Instruction­Persistence­Classifier" - Titles now wrap intelligently without being cut off **Colour Legend (Option C):** - Added toggle button (ℹ️) next to ToC and PDF buttons - Popup shows all 5 colour codes with descriptions - Translated to EN ("Colour Guide"), DE ("Farbcode"), FR ("Guide des couleurs") - Fixed colour square visibility (bg-500 with borders instead of bg-400) - Click outside to close functionality **Card Sequencing:** - Cards now display in original markdown document order - Removed groupByCategory() grouping logic - Removed category header sections - Color coding preserved based on section category **Category Fallback Bug:** - Fixed invalid fallback category 'downloads-resources' → 'resources' - Ensures uncategorized documents go to valid category **Database Migration:** - Added scripts/move-guides-to-resources.js - Moved 3 implementation guides from getting-started to resources - Getting Started now contains only: Introduction, Core Concepts - Resources now contains: Implementation guides **Result:** ✅ Cards respect container width (no overflow) ✅ Long titles wrap with hyphens (no cutoff) ✅ Colour legend accessible and translated ✅ Cards in logical reading order from markdown ✅ Implementation guides in correct category 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- public/docs.html | 2 +- public/js/components/document-cards.js | 180 ++++++++++++++++++------- public/js/docs-app.js | 8 +- scripts/move-guides-to-resources.js | 75 +++++++++++ 4 files changed, 213 insertions(+), 52 deletions(-) create mode 100644 scripts/move-guides-to-resources.js diff --git a/public/docs.html b/public/docs.html index 7d95ef7c..a17bc7ad 100644 --- a/public/docs.html +++ b/public/docs.html @@ -587,7 +587,7 @@ Back to Documents -
+
diff --git a/public/js/components/document-cards.js b/public/js/components/document-cards.js index 4a5bdf8a..30ae6659 100644 --- a/public/js/components/document-cards.js +++ b/public/js/components/document-cards.js @@ -8,6 +8,43 @@ class DocumentCards { this.container = document.getElementById(containerId); this.currentDocument = null; this.modalViewer = new ModalViewer(); + this.legendVisible = false; + } + + /** + * Get translations for color legend + */ + getLegendTranslations() { + const lang = (window.I18n && window.I18n.currentLang) || 'en'; + + const translations = { + en: { + title: 'Colour Guide', + critical: 'Critical sections', + conceptual: 'Conceptual explanations', + practical: 'Practical guides', + technical: 'Technical details', + reference: 'Reference documentation' + }, + de: { + title: 'Farbcode', + critical: 'Kritische Abschnitte', + conceptual: 'Konzeptionelle Erklärungen', + practical: 'Praktische Anleitungen', + technical: 'Technische Details', + reference: 'Referenzdokumentation' + }, + fr: { + title: 'Guide des couleurs', + critical: 'Sections critiques', + conceptual: 'Explications conceptuelles', + practical: 'Guides pratiques', + technical: 'Détails techniques', + reference: 'Documentation de référence' + } + }; + + return translations[lang] || translations.en; } /** @@ -24,11 +61,8 @@ class DocumentCards { // Create document header const headerHtml = this.renderHeader(document); - // Group sections by category - const sectionsByCategory = this.groupByCategory(document.sections); - - // Render card grid - const cardsHtml = this.renderCardGrid(sectionsByCategory); + // Render cards in original markdown order (no grouping) + const cardsHtml = this.renderCardGrid(document.sections); this.container.innerHTML = ` ${headerHtml} @@ -59,6 +93,7 @@ class DocumentCards { .join(' | '); const hasToC = document.toc && document.toc.length > 0; + const t = this.getLegendTranslations(); return `
@@ -67,7 +102,42 @@ class DocumentCards { ${metaText ? `

${metaText}

` : ''} ${document.sections ? `

${document.sections.length} sections

` : ''}
-
+
+ ${document.sections && document.sections.length > 0 ? ` + + + ` : ''} ${hasToC ? `