This repository was archived by the owner on Feb 26, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-settings-navigation-fixed.html
More file actions
207 lines (191 loc) · 7.53 KB
/
test-settings-navigation-fixed.html
File metadata and controls
207 lines (191 loc) · 7.53 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Settings Navigation Test - Fixed</title>
<style>
body {
font-family: 'Inter', system-ui, -apple-system, sans-serif;
max-width: 1000px;
margin: 0 auto;
padding: 20px;
background: #0a0a0a;
color: #e5e5e5;
}
.test-section {
background: #1a1a1a;
border: 1px solid #333;
border-radius: 8px;
padding: 20px;
margin-bottom: 20px;
}
h1 {
color: #fff;
margin-bottom: 30px;
}
h2 {
color: #a0a0a0;
margin-bottom: 15px;
font-size: 1.2rem;
}
.status {
padding: 8px 12px;
border-radius: 4px;
margin: 10px 0;
font-family: monospace;
}
.success {
background: #10b98133;
color: #10b981;
border: 1px solid #10b981;
}
.error {
background: #ef444433;
color: #ef4444;
border: 1px solid #ef4444;
}
.info {
background: #3b82f633;
color: #3b82f6;
border: 1px solid #3b82f6;
}
button {
background: #3b82f6;
color: white;
border: none;
padding: 10px 20px;
border-radius: 6px;
cursor: pointer;
margin: 5px;
}
button:hover {
background: #2563eb;
}
.test-results {
margin-top: 20px;
}
pre {
background: #0a0a0a;
padding: 10px;
border-radius: 4px;
overflow-x: auto;
white-space: pre-wrap;
}
</style>
</head>
<body>
<h1>🔧 Settings Navigation Test - After Fix</h1>
<div class="test-section">
<h2>Fix Applied</h2>
<div class="status success">✅ Removed circular redirect routes: /settings/ai and /settings/$</div>
<div class="status success">✅ Route tree regenerated without child routes</div>
<div class="status info">ℹ️ Settings page now uses simple search params for tab navigation</div>
</div>
<div class="test-section">
<h2>Test Navigation</h2>
<p>Click the buttons below to test navigation to the settings page:</p>
<button onclick="navigateToSettings()">Navigate to Settings (default tab)</button>
<button onclick="navigateToSettings('ai')">Navigate to AI Settings</button>
<button onclick="navigateToSettings('audio')">Navigate to Audio Settings</button>
<button onclick="navigateToSettings('agents')">Navigate to Agents Settings</button>
<div id="navigation-results" class="test-results"></div>
</div>
<div class="test-section">
<h2>Console Monitor</h2>
<p>Check the browser console for any errors while navigating:</p>
<pre id="console-output">No console errors detected</pre>
</div>
<script>
// Store original console methods
const originalError = console.error;
const originalWarn = console.warn;
const consoleOutput = document.getElementById('console-output');
let errorCount = 0;
// Override console.error to capture errors
console.error = function(...args) {
originalError.apply(console, args);
errorCount++;
const errorMsg = args.map(arg =>
typeof arg === 'object' ? JSON.stringify(arg, null, 2) : String(arg)
).join(' ');
consoleOutput.innerHTML = `<span style="color: #ef4444">ERROR ${errorCount}: ${errorMsg}</span>\n${consoleOutput.innerHTML}`;
// Check for stack overflow
if (errorMsg.includes('Maximum call stack size exceeded')) {
document.getElementById('navigation-results').innerHTML =
'<div class="status error">❌ Stack overflow detected! The circular redirect issue persists.</div>';
}
};
// Override console.warn
console.warn = function(...args) {
originalWarn.apply(console, args);
const warnMsg = args.map(arg =>
typeof arg === 'object' ? JSON.stringify(arg, null, 2) : String(arg)
).join(' ');
consoleOutput.innerHTML = `<span style="color: #eab308">WARN: ${warnMsg}</span>\n${consoleOutput.innerHTML}`;
};
function navigateToSettings(tab = null) {
const resultsDiv = document.getElementById('navigation-results');
try {
let url = 'http://localhost:3000/settings';
if (tab) {
url += `?tab=${tab}`;
}
url += '&test-mode=true';
resultsDiv.innerHTML = `
<div class="status info">🔄 Attempting to navigate to: ${url}</div>
`;
// Open in a new window to test navigation
const testWindow = window.open(url, '_blank', 'width=1200,height=800');
if (testWindow) {
resultsDiv.innerHTML += `
<div class="status success">✅ Navigation initiated successfully</div>
<div class="status info">ℹ️ Check the new window for the settings page</div>
`;
// Check if the window loads successfully
setTimeout(() => {
try {
// This will throw if blocked by CORS, which is expected
const title = testWindow.document.title;
resultsDiv.innerHTML += `
<div class="status success">✅ Page loaded: ${title}</div>
`;
} catch (e) {
// This is normal due to same-origin policy
resultsDiv.innerHTML += `
<div class="status info">ℹ️ Page opened (cross-origin check blocked - this is normal)</div>
`;
}
}, 2000);
} else {
resultsDiv.innerHTML += `
<div class="status error">❌ Failed to open window - popup may be blocked</div>
`;
}
} catch (error) {
resultsDiv.innerHTML = `
<div class="status error">❌ Navigation error: ${error.message}</div>
`;
console.error('Navigation error:', error);
}
}
// Test route structure
async function checkRoutes() {
try {
const response = await fetch('http://localhost:3000/settings?test-mode=true', {
method: 'HEAD'
});
if (response.ok || response.status === 200) {
console.log('Settings route is accessible');
} else {
console.warn('Settings route returned status:', response.status);
}
} catch (error) {
console.error('Failed to check routes:', error);
}
}
// Run initial check
checkRoutes();
</script>
</body>
</html>