Files
wehub-resource-sync c889a57b6b
Test Suites / Build CI Environment (push) Has been cancelled
Test Suites / Basic Tests (push) Has been cancelled
Test Suites / End-to-End Tests (push) Has been cancelled
Test Suites / CLI Tests (push) Has been cancelled
Test Suites / Slow End-to-End Tests (push) Has been cancelled
Test Suites / Graph Database Tests (push) Has been cancelled
Test Suites / Vector DB Tests (push) Has been cancelled
Test Suites / Temporal Graph Test (push) Has been cancelled
Test Suites / Search Test on Different DBs (push) Has been cancelled
Test Suites / Example Tests (push) Has been cancelled
Test Suites / Notebook Tests (push) Has been cancelled
Test Suites / OS and Python Tests Ubuntu (push) Has been cancelled
Test Suites / OS and Python Tests Extended (push) Has been cancelled
Test Suites / LLM Test Suite (push) Has been cancelled
Test Suites / S3 File Storage Test (push) Has been cancelled
Test Suites / Run Integration Tests (push) Has been cancelled
Test Suites / MCP Tests (push) Has been cancelled
Test Suites / Docker Compose Test (push) Has been cancelled
Test Suites / Docker CI test (push) Has been cancelled
Test Suites / Relational DB Migration Tests (push) Has been cancelled
Test Suites / Distributed Cognee Test (push) Has been cancelled
Test Suites / DB Examples Tests (push) Has been cancelled
Test Suites / Test Completion Status (push) Has been cancelled
Test Suites / Claude Code Review (push) Has been cancelled
Test Suites / basic checks (push) Has been cancelled
build | Build and Push Cognee MCP Docker Image to dockerhub / docker-build-and-push (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
build | Build and Push Docker Image to dockerhub / docker-build-and-push (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Core Functionality (3.11) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Core Functionality (3.12) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges with Different Graph Databases (kuzu, kuzu) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges with Different Graph Databases (neo4j, neo4j) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Examples (push) Has been cancelled
Weighted Edges Tests / Code Quality for Weighted Edges (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:02:24 +08:00

62 lines
3.0 KiB
JavaScript

// Theme toggle
(function(){
const btn = document.getElementById('theme-toggle');
// Apply a theme everywhere it matters: CSS class, JS flag (read by the
// canvas draw loop), button label, tab bar, the canvas itself (which only
// repaints on interaction — without an explicit frame the 95% of the
// screen that is canvas stayed in the old theme until the next pan), and
// the schema SVG when visible.
function applyTheme(isLight) {
window._isLightMode = isLight;
document.documentElement.classList.toggle('light', isLight);
btn.textContent = isLight ? 'Dark mode' : 'Light mode';
const tabBar = document.getElementById('view-tabs');
if (tabBar) tabBar.style.background = isLight ? '#f5f5f5' : '#000000';
if (window._requestGraphRedraw) window._requestGraphRedraw();
if (document.getElementById('schema-view').style.display !== 'none' && window._renderSchemaGraph) {
window._renderSchemaGraph(true); // preserve pan/zoom across the re-render
}
const memoryViewEl = document.getElementById('memory-view');
if (memoryViewEl && memoryViewEl.style.display !== 'none' && window._renderMemoryView) {
window._renderMemoryView(true); // preserve pan/zoom across the re-render
}
}
// Restore the user's last choice (default light). Syncing the CSS class on
// load also fixes the original bug: the page shipped dark :root variables
// while the JS assumed light, so the first toggle was a visual no-op.
let stored = null;
try { stored = localStorage.getItem('cognee-viz-theme'); } catch (e) { /* file:// may block */ }
applyTheme(stored ? stored === 'light' : true);
btn.addEventListener('click', () => {
const isLight = !window._isLightMode;
try { localStorage.setItem('cognee-viz-theme', isLight ? 'light' : 'dark'); } catch (e) { /* best effort */ }
applyTheme(isLight);
});
})();
// Tab switching logic
(function(){
const tabs = document.querySelectorAll('.tab-btn');
const graphView = document.getElementById('graph-view');
const schemaView = document.getElementById('schema-view');
const memoryView = document.getElementById('memory-view');
const semanticView = document.getElementById('semantic-view');
tabs.forEach(btn => {
btn.addEventListener('click', () => {
tabs.forEach(t => { t.style.background='transparent'; t.style.color='var(--text2)'; t.classList.remove('active'); });
btn.style.background='#1F9E6E'; btn.style.color='#fff'; btn.classList.add('active');
const view = btn.dataset.view;
graphView.style.display = view === 'graph' ? '' : 'none';
schemaView.style.display = view === 'schema' ? '' : 'none';
if (memoryView) memoryView.style.display = view === 'memory' ? '' : 'none';
if (semanticView) semanticView.style.display = view === 'semantic' ? '' : 'none';
if (view === 'schema' && window._renderSchemaGraph) window._renderSchemaGraph();
if (view === 'memory' && window._renderMemoryView) window._renderMemoryView();
if (view === 'semantic' && window._renderSemanticView) window._renderSemanticView();
});
});
})();