fix: orgs page — read o.name/role/domains directly from API response, not data_text

This commit is contained in:
James 2026-03-12 02:49:16 -04:00
parent 35f6279d56
commit bbce4cf36a
1 changed files with 8 additions and 6 deletions

View File

@ -56,16 +56,18 @@
const grid = document.getElementById('orgGrid');
if (!orgs || orgs.length === 0) { grid.classList.add('hidden'); document.getElementById('emptyState').classList.remove('hidden'); return; }
grid.innerHTML = orgs.map(o => {
const d = parseData(o.data_text);
const rc = roleColors[d.role] || 'bg-gray-500/20 text-gray-300';
const domains = Array.isArray(d.domains) ? d.domains : (d.domains ? [d.domains] : []);
// API returns flat fields: o.name, o.role, o.domains, o.website
const name = o.name || o.summary || 'Untitled';
const role = o.role || '';
const rc = roleColors[role] || 'bg-gray-500/20 text-gray-300';
const domains = Array.isArray(o.domains) ? o.domains : (o.domains ? [o.domains] : []);
return `<div class="card bg-[#0d1f3c] border border-white/[0.08] rounded-xl p-6 transition">
<div class="flex items-start justify-between mb-3">
<h3 class="text-white font-semibold text-lg leading-tight">${escHtml(d.name || o.summary || 'Untitled')}</h3>
<span class="ml-2 shrink-0 px-2 py-0.5 rounded-full text-xs font-medium capitalize ${rc}">${d.role || '?'}</span>
<h3 class="text-white font-semibold text-lg leading-tight">${escHtml(name)}</h3>
<span class="ml-2 shrink-0 px-2 py-0.5 rounded-full text-xs font-medium capitalize ${rc}">${role || '?'}</span>
</div>
<div class="flex gap-1.5 flex-wrap mb-3">${domains.map(dm => `<span class="text-xs font-mono text-[#94a3b8] bg-white/[0.05] px-2 py-0.5 rounded">@${escHtml(dm)}</span>`).join('')}</div>
${d.website ? `<a href="${escHtml(d.website)}" target="_blank" class="text-xs text-[#c9a84c] hover:underline">${escHtml(d.website)}</a>` : ''}
${o.website ? `<a href="${escHtml(o.website)}" target="_blank" class="text-xs text-[#c9a84c] hover:underline">${escHtml(o.website)}</a>` : ''}
</div>`;
}).join('');
} catch(e) { document.getElementById('orgGrid').innerHTML = '<div class="text-red-400 text-sm col-span-2">Failed to load.</div>'; }