diff --git a/public/js/components/navbar.js b/public/js/components/navbar.js
index 84d6a13c..4d686478 100644
--- a/public/js/components/navbar.js
+++ b/public/js/components/navbar.js
@@ -22,10 +22,18 @@ class TractatusNavbar {
@@ -75,9 +83,6 @@ class TractatusNavbar {
📚 Documentation
-
- 🔌 API Reference
-
📝 Blog
@@ -87,9 +92,6 @@ class TractatusNavbar {
ℹ️ About
-
- 🎯 Interactive Demo
-
diff --git a/public/js/docs-app.js b/public/js/docs-app.js
index a28dc71d..826e42d3 100644
--- a/public/js/docs-app.js
+++ b/public/js/docs-app.js
@@ -308,21 +308,45 @@ async function loadDocuments() {
}
});
- // Auto-load first document in "Getting Started" category (order: 1)
- const gettingStartedDocs = grouped['getting-started'] || [];
- if (gettingStartedDocs.length > 0) {
- // Load the first document (order: 1) if available
- const firstDoc = gettingStartedDocs.find(d => d.order === 1);
+ // Check for URL parameter to auto-expand category
+ const urlParams = new URLSearchParams(window.location.search);
+ const categoryParam = urlParams.get('category');
+
+ // Auto-expand and navigate to category from URL parameter
+ if (categoryParam && grouped[categoryParam] && grouped[categoryParam].length > 0) {
+ // Expand the specified category
+ const categoryDocsEl = listEl.querySelector(`.category-docs[data-category="${categoryParam}"]`);
+ const categoryArrowEl = listEl.querySelector(`.category-toggle[data-category="${categoryParam}"] .category-arrow`);
+
+ if (categoryDocsEl) {
+ categoryDocsEl.style.display = 'block';
+ if (categoryArrowEl) {
+ categoryArrowEl.style.transform = 'rotate(0deg)';
+ }
+ }
+
+ // Load first document in the category
+ const firstDoc = grouped[categoryParam][0];
if (firstDoc) {
loadDocument(firstDoc.slug);
- } else {
- loadDocument(gettingStartedDocs[0].slug);
}
- } else if (documents.length > 0) {
- // Fallback to first available document in any category
- const firstCategory = sortedCategories.find(([catId]) => grouped[catId] && grouped[catId].length > 0);
- if (firstCategory) {
- loadDocument(grouped[firstCategory[0]][0].slug);
+ } else {
+ // Default: Auto-load first document in "Getting Started" category (order: 1)
+ const gettingStartedDocs = grouped['getting-started'] || [];
+ if (gettingStartedDocs.length > 0) {
+ // Load the first document (order: 1) if available
+ const firstDoc = gettingStartedDocs.find(d => d.order === 1);
+ if (firstDoc) {
+ loadDocument(firstDoc.slug);
+ } else {
+ loadDocument(gettingStartedDocs[0].slug);
+ }
+ } else if (documents.length > 0) {
+ // Fallback to first available document in any category
+ const firstCategory = sortedCategories.find(([catId]) => grouped[catId] && grouped[catId].length > 0);
+ if (firstCategory) {
+ loadDocument(grouped[firstCategory[0]][0].slug);
+ }
}
}
} catch (error) {
diff --git a/public/js/docs-search-enhanced.js b/public/js/docs-search-enhanced.js
index cb9defcf..d00740bb 100644
--- a/public/js/docs-search-enhanced.js
+++ b/public/js/docs-search-enhanced.js
@@ -43,7 +43,12 @@
searchResultsSummary: null,
searchResultsCount: null,
searchHistoryContainer: null,
- searchHistory: null
+ searchHistory: null,
+ searchModal: null,
+ openSearchModalBtn: null,
+ searchModalCloseBtn: null,
+ searchResultsModal: null,
+ searchResultsListModal: null
};
/**
@@ -66,10 +71,15 @@
elements.searchResultsCount = document.getElementById('search-results-count');
elements.searchHistoryContainer = document.getElementById('search-history-container');
elements.searchHistory = document.getElementById('search-history');
+ elements.searchModal = document.getElementById('search-modal');
+ elements.openSearchModalBtn = document.getElementById('open-search-modal-btn');
+ elements.searchModalCloseBtn = document.getElementById('search-modal-close-btn');
+ elements.searchResultsModal = document.getElementById('search-results-modal');
+ elements.searchResultsListModal = document.getElementById('search-results-list-modal');
- // Check if elements exist
- if (!elements.searchInput) {
- console.warn('Search input not found - search enhancement disabled');
+ // Check if essential elements exist
+ if (!elements.searchInput || !elements.searchModal) {
+ console.warn('Search elements not found - search enhancement disabled');
return;
}
@@ -87,6 +97,21 @@
* Attach event listeners (CSP compliant - no inline handlers)
*/
function attachEventListeners() {
+ // Search modal open/close
+ if (elements.openSearchModalBtn) {
+ elements.openSearchModalBtn.addEventListener('click', openSearchModal);
+ }
+ if (elements.searchModalCloseBtn) {
+ elements.searchModalCloseBtn.addEventListener('click', closeSearchModal);
+ }
+ if (elements.searchModal) {
+ elements.searchModal.addEventListener('click', function(e) {
+ if (e.target === elements.searchModal) {
+ closeSearchModal();
+ }
+ });
+ }
+
// Search input - debounced
if (elements.searchInput) {
elements.searchInput.addEventListener('input', handleSearchInput);
@@ -132,10 +157,11 @@
// Global keyboard shortcuts
document.addEventListener('keydown', handleGlobalKeydown);
- // Escape key to close modal
+ // Escape key to close modals
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
closeSearchTipsModal();
+ closeSearchModal();
}
});
}
@@ -171,6 +197,7 @@
}
} else if (e.key === 'Escape') {
closeSearchResultsPanel();
+ closeSearchModal();
e.target.blur();
} else if (e.key === 'ArrowDown') {
e.preventDefault();
@@ -259,12 +286,18 @@
* Render search results
*/
function renderSearchResults(data, duration) {
- if (!elements.searchResultsList || !elements.searchResultsPanel) return;
+ // Use modal list if available, otherwise fall back to panel list
+ const targetList = elements.searchResultsListModal || elements.searchResultsList;
+ const targetContainer = elements.searchResultsModal || elements.searchResultsPanel;
+
+ if (!targetList) return;
const { documents, count, total, filters } = data;
- // Show results panel
- elements.searchResultsPanel.classList.remove('hidden');
+ // Show results container
+ if (targetContainer) {
+ targetContainer.classList.remove('hidden');
+ }
// Update summary
if (elements.searchResultsSummary && elements.searchResultsCount) {
@@ -289,7 +322,7 @@
// Render results
if (documents.length === 0) {
- elements.searchResultsList.innerHTML = `
+ targetList.innerHTML = `