open-navigator / debug-dropdown.html
jcbowyer's picture
Deploy: Consolidated gold tables, fixed nginx docs routing
896453f verified
<!DOCTYPE html>
<html>
<head>
<title>Dropdown Debug Tool</title>
<style>
body { font-family: Arial; padding: 20px; }
.success { color: green; }
.error { color: red; }
.info { color: blue; }
button { padding: 10px 20px; margin: 10px; font-size: 16px; }
pre { background: #f4f4f4; padding: 10px; border-radius: 5px; overflow-x: auto; }
</style>
</head>
<body>
<h1>πŸ” CareQuest Dropdown Debug Tool</h1>
<h2>Step 1: Clear Browser Cache</h2>
<button onclick="clearCache()">Clear All Cache & Reload</button>
<div id="cache-status"></div>
<h2>Step 2: Test API Direct</h2>
<button onclick="testAPI()">Test API Endpoint</button>
<div id="api-status"></div>
<pre id="api-results"></pre>
<h2>Step 3: Check Location Context</h2>
<p>Open browser console (F12) and check localStorage:</p>
<pre>localStorage.getItem('user_location')</pre>
<p class="info">Should contain: {"state":"MA","city":"Boston",...}</p>
<h2>Step 4: Instructions</h2>
<ol>
<li>Click "Clear All Cache & Reload" button above</li>
<li>Go to http://localhost:5173</li>
<li>Click the "Find My Community" tab</li>
<li>Enter "Boston, MA" in the address lookup</li>
<li>Click "Search Topics" tab</li>
<li>Type "Care" in the search box</li>
<li>Open browser console (F12) and look for logs starting with πŸ” [HomeModern]</li>
</ol>
<script>
async function clearCache() {
const status = document.getElementById('cache-status');
try {
// Clear localStorage
localStorage.clear();
sessionStorage.clear();
// Clear caches
if ('caches' in window) {
const cacheNames = await caches.keys();
await Promise.all(cacheNames.map(name => caches.delete(name)));
}
status.innerHTML = '<p class="success">βœ… Cache cleared! Reloading page in 2 seconds...</p>';
setTimeout(() => {
window.location.href = 'http://localhost:5173';
}, 2000);
} catch (error) {
status.innerHTML = '<p class="error">❌ Error clearing cache: ' + error.message + '</p>';
}
}
async function testAPI() {
const status = document.getElementById('api-status');
const results = document.getElementById('api-results');
status.innerHTML = '<p class="info">⏳ Testing API...</p>';
try {
const response = await fetch('/api/search/?q=Care&types=organizations&limit=5&state=MA');
const data = await response.json();
const orgs = data.results.organizations;
const carequest = orgs.find(org => org.title.includes('CAREQUEST'));
if (carequest) {
status.innerHTML = '<p class="success">βœ… API is returning CareQuest correctly!</p>';
results.textContent = JSON.stringify(carequest, null, 2);
} else {
status.innerHTML = '<p class="error">❌ CareQuest NOT in API results!</p>';
results.textContent = JSON.stringify(data, null, 2);
}
} catch (error) {
status.innerHTML = '<p class="error">❌ API Error: ' + error.message + '</p>';
results.textContent = error.stack;
}
}
</script>
</body>
</html>