-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug-navigation.html
More file actions
250 lines (222 loc) Β· 9.73 KB
/
debug-navigation.html
File metadata and controls
250 lines (222 loc) Β· 9.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Navigation Debug Tool</title>
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/navigation.css">
<style>
.debug-panel {
position: fixed;
top: 10px;
right: 10px;
width: 350px;
background: var(--glass-surface);
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 15px;
z-index: 10000;
font-family: monospace;
font-size: 12px;
max-height: 90vh;
overflow-y: auto;
}
.debug-item {
margin: 5px 0;
padding: 5px;
border-radius: 4px;
background: var(--darker-background);
}
.debug-item.success { border-left: 3px solid #10B981; }
.debug-item.error { border-left: 3px solid #EF4444; }
.debug-item.warning { border-left: 3px solid #F59E0B; }
.debug-item.info { border-left: 3px solid #3B82F6; }
.test-button {
background: var(--primary-purple);
color: white;
border: none;
padding: 8px 12px;
margin: 5px 2px;
border-radius: 4px;
cursor: pointer;
font-size: 11px;
}
.test-button:hover {
background: var(--secondary-purple);
}
</style>
</head>
<body class="theme-dark">
<div id="debug-panel" class="debug-panel">
<h3>π Navigation Debug Tool</h3>
<div class="debug-controls">
<button class="test-button" onclick="runFullDiagnostic()">π§ͺ Full Diagnostic</button>
<button class="test-button" onclick="testNavInit()">π Test Nav Init</button>
<button class="test-button" onclick="checkElements()">π Check Elements</button>
<button class="test-button" onclick="clearLog()">ποΈ Clear</button>
</div>
<div id="debug-log"></div>
</div>
<!-- Loading Screen -->
<div id="loading-screen" class="loading-screen">
<div class="loading-spinner"></div>
<h2>Debug Loading...</h2>
</div>
<!-- Main Application -->
<div id="app" class="app-container" style="display: none;">
<header class="app-header">
<div class="header-content">
<h1 class="app-title">Navigation Debug</h1>
<div class="header-controls">
<button id="theme-toggle" class="btn-icon">π</button>
</div>
</div>
</header>
<div class="app-content-wrapper">
<main class="main-content">
<div id="characters-tab" class="tab-content active">
<h2>Debug Mode Active</h2>
<p>Use the debug panel to test navigation visibility.</p>
<div id="debug-results">
<h3>Expected Elements:</h3>
<ul>
<li>β
app-sidebar (should be visible after init)</li>
<li>β
nav-toggle button (in header)</li>
<li>β
Navigation groups (Build Tools, Team Management, etc.)</li>
<li>β
Navigation items with proper links</li>
</ul>
</div>
</div>
</main>
</div>
</div>
<script type="module">
let debugLog = [];
function log(message, type = 'info') {
const timestamp = new Date().toLocaleTimeString();
debugLog.push({ timestamp, message, type });
updateDebugPanel();
console.log(`[${type.toUpperCase()}] ${message}`);
}
function updateDebugPanel() {
const debugPanel = document.getElementById('debug-log');
debugPanel.innerHTML = debugLog.map(entry =>
`<div class="debug-item ${entry.type}">
<span style="opacity: 0.7">${entry.timestamp}</span><br>
${entry.message}
</div>`
).join('');
debugPanel.scrollTop = debugPanel.scrollHeight;
}
function clearLog() {
debugLog = [];
updateDebugPanel();
}
async function checkElements() {
log('π Checking DOM elements...');
const checks = [
{ selector: '#app', name: 'App Container' },
{ selector: '.app-content-wrapper', name: 'Content Wrapper' },
{ selector: '.main-content', name: 'Main Content' },
{ selector: '.app-header', name: 'Header' },
{ selector: '.header-content', name: 'Header Content' },
{ selector: '.app-sidebar', name: 'Sidebar (Navigation)' },
{ selector: '.nav-toggle', name: 'Navigation Toggle' },
{ selector: '.nav-group', name: 'Navigation Groups' },
{ selector: '.nav-item', name: 'Navigation Items' }
];
checks.forEach(check => {
const element = document.querySelector(check.selector);
if (element) {
const count = document.querySelectorAll(check.selector).length;
log(`β
${check.name}: Found (${count} element${count !== 1 ? 's' : ''})`, 'success');
} else {
log(`β ${check.name}: Missing`, 'error');
}
});
// Check CSS loading
const navStyles = getComputedStyle(document.documentElement);
log(`π¨ CSS Variables loaded: ${!!navStyles.getPropertyValue('--primary-purple')}`,
navStyles.getPropertyValue('--primary-purple') ? 'success' : 'warning');
}
async function testNavInit() {
log('π Testing navigation initialization...');
try {
// Import navigation module
const { navigation } = await import('./js/components/navigation.js');
log('β
Navigation module imported successfully', 'success');
// Check if already initialized
const existingSidebar = document.querySelector('.app-sidebar');
if (existingSidebar) {
log('β οΈ Sidebar already exists, removing first...', 'warning');
existingSidebar.remove();
}
// Initialize
navigation.init();
log('π§ Navigation.init() called', 'info');
// Check results after short delay
setTimeout(() => {
const sidebar = document.querySelector('.app-sidebar');
const toggle = document.querySelector('.nav-toggle');
const groups = document.querySelectorAll('.nav-group');
const items = document.querySelectorAll('.nav-item');
if (sidebar) {
log(`β
Sidebar created successfully! (${sidebar.className})`, 'success');
log(`π Sidebar position: ${getComputedStyle(sidebar).transform}`, 'info');
} else {
log('β Sidebar not found after init!', 'error');
}
if (toggle) {
log(`β
Navigation toggle created! (${toggle.className})`, 'success');
} else {
log('β Navigation toggle not found!', 'error');
}
log(`π Navigation groups: ${groups.length}`, groups.length > 0 ? 'success' : 'error');
log(`π Navigation items: ${items.length}`, items.length > 0 ? 'success' : 'error');
if (sidebar && groups.length > 0 && items.length > 0) {
log('π Navigation fully functional!', 'success');
} else {
log('β οΈ Navigation partially working or failed', 'warning');
}
}, 300);
} catch (error) {
log(`β Navigation init failed: ${error.message}`, 'error');
log(`π Stack: ${error.stack}`, 'error');
}
}
async function runFullDiagnostic() {
log('π§ͺ Starting full diagnostic...', 'info');
clearLog();
// 1. Check initial state
log('1οΈβ£ Checking initial DOM state...', 'info');
await checkElements();
// 2. Show app (simulate real flow)
log('2οΈβ£ Showing app container...', 'info');
document.getElementById('loading-screen').style.display = 'none';
document.getElementById('app').style.display = 'block';
log('β
App container visible', 'success');
// 3. Wait and test navigation
setTimeout(async () => {
log('3οΈβ£ Testing navigation after delay...', 'info');
await testNavInit();
// 4. Final check
setTimeout(() => {
log('4οΈβ£ Final element check...', 'info');
checkElements();
log('π Diagnostic complete!', 'success');
}, 500);
}, 200);
}
// Make functions global
window.runFullDiagnostic = runFullDiagnostic;
window.testNavInit = testNavInit;
window.checkElements = checkElements;
window.clearLog = clearLog;
// Auto-start diagnostic
window.addEventListener('load', () => {
setTimeout(runFullDiagnostic, 1000);
});
</script>
</body>
</html>