fix the matrix
This commit is contained in:
@@ -356,6 +356,8 @@ if (aiAuthRequired) {
|
||||
}
|
||||
|
||||
function switchToView(view) {
|
||||
console.log('[VIEW] Switching to view:', view);
|
||||
|
||||
const toolsGrid = document.getElementById('tools-grid');
|
||||
const matrixContainer = document.getElementById('matrix-container');
|
||||
const aiInterface = document.getElementById('ai-interface');
|
||||
@@ -365,8 +367,12 @@ if (aiAuthRequired) {
|
||||
const methodologySection = document.getElementById('methodology-section');
|
||||
const targetedSection = document.getElementById('targeted-section');
|
||||
|
||||
// Hide all views
|
||||
if (toolsGrid) toolsGrid.style.display = 'none';
|
||||
if (matrixContainer) matrixContainer.style.display = 'none';
|
||||
if (matrixContainer) {
|
||||
matrixContainer.style.display = 'none';
|
||||
matrixContainer.classList.add('hidden');
|
||||
}
|
||||
if (aiInterface) aiInterface.style.display = 'none';
|
||||
if (noResults) noResults.style.display = 'none';
|
||||
|
||||
@@ -375,14 +381,22 @@ if (aiAuthRequired) {
|
||||
|
||||
switch (view) {
|
||||
case 'grid':
|
||||
console.log('[VIEW] Showing grid view');
|
||||
if (toolsGrid) toolsGrid.style.display = 'block';
|
||||
if (filtersSection) filtersSection.style.display = 'block';
|
||||
break;
|
||||
|
||||
case 'matrix':
|
||||
if (matrixContainer) matrixContainer.style.display = 'block';
|
||||
console.log('[VIEW] Showing matrix view');
|
||||
if (matrixContainer) {
|
||||
matrixContainer.style.display = 'block';
|
||||
matrixContainer.classList.remove('hidden');
|
||||
}
|
||||
if (filtersSection) filtersSection.style.display = 'block';
|
||||
break;
|
||||
|
||||
case 'ai':
|
||||
console.log('[VIEW] Showing AI view');
|
||||
if (aiAuthRequired && !aiAuthenticated) {
|
||||
console.log('[AUTH] AI access denied, redirecting to login');
|
||||
const currentUrl = encodeURIComponent(window.location.href);
|
||||
@@ -405,8 +419,12 @@ if (aiAuthRequired) {
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
console.warn('[VIEW] Unknown view:', view);
|
||||
}
|
||||
|
||||
// Restore all filter sections for non-AI views
|
||||
if (view !== 'ai' && filtersSection) {
|
||||
const filterSections = filtersSection.querySelectorAll('.filter-section');
|
||||
filterSections.forEach(section => {
|
||||
@@ -415,7 +433,6 @@ if (aiAuthRequired) {
|
||||
}
|
||||
}
|
||||
|
||||
// Rest of the existing code remains the same...
|
||||
window.navigateToGrid = function(toolName) {
|
||||
console.log('Navigating to grid for tool:', toolName);
|
||||
|
||||
@@ -655,10 +672,13 @@ if (aiAuthRequired) {
|
||||
|
||||
window.addEventListener('viewChanged', (event) => {
|
||||
const view = event.detail;
|
||||
switchToView(view);
|
||||
if (!event.triggeredByButton) {
|
||||
switchToView(view);
|
||||
}
|
||||
});
|
||||
|
||||
window.switchToAIView = () => switchToView('ai');
|
||||
window.switchToView = switchToView;
|
||||
|
||||
handleSharedURL();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user