{/* Left filter sidebar — type list with counts (lg+ only).
Counts come straight from tabCounts (type_totals); no
fabricated numbers. */}
{availableTabs.length > 0 && (
)}
{/* Right column — active type's results + pagination. */}
{/* Result-type Tabs — one per type that returned hits, Decisions
first. Shown below lg only; the sidebar replaces this on lg+. */}
{availableTabs.length > 1 && (
)}
{/* Results by Type */}
{effectiveTab === 'leaders' &&
searchResults.results?.leaders &&
searchResults.results.leaders.length > 0 && (
Leaders ({searchResults.type_totals?.leaders?.toLocaleString() || searchResults.results.leaders.length})
{searchResults.results.leaders.map((result, idx) => (
))}
)}
{effectiveTab === 'persons' &&
searchResults.results?.persons &&
searchResults.results.persons.length > 0 && (
Nonprofit Leaders ({searchResults.type_totals?.persons?.toLocaleString() || searchResults.results.persons.length})
{(() => {
const persons = searchResults.results.persons
// Max revenue across the currently-rendered list, for bar widths.
const maxRevenue = persons.reduce((max, r) => {
const v = Number(r.metadata?.total_revenue)
return Number.isFinite(v) && v > max ? v : max
}, 0)
return (
|
Leader |
Organization |
Cause |
Total Revenue |
Assets |
Jurisdiction |
File |
{persons.map((result, idx) => {
const m = result.metadata ?? {}
const revenue = Number(m.total_revenue)
const hasRevenue = Number.isFinite(revenue) && m.total_revenue != null
const assets = Number(m.total_assets)
const hasAssets = Number.isFinite(assets) && m.total_assets != null
const barWidth = hasRevenue && maxRevenue > 0
? Math.max(2, Math.round((revenue / maxRevenue) * 100))
: 0
const cause = m.cause ?? null
const dotColor = cause
? causeDotColor(String(m.ntee_code ?? m.cause))
: null
return (
{/* Avatar */}
|
{result.title?.charAt(0) ?? '?'}
|
{/* Leader */}
openResult(result.url)}
className={`font-semibold text-gray-900 ${
result.url ? 'cursor-pointer hover:text-blue-600' : ''
}`}
>
{result.title}
{m.title ?? 'Leader'}
|
{/* Organization */}
{m.organization ?? '—'}
{m.ein && (
EIN {formatEin(String(m.ein))}
)}
|
{/* Cause */}
{cause ? (
{cause}
) : null}
|
{/* Total Revenue */}
{hasRevenue ? (
{formatCurrency(revenue)}
) : null}
|
{/* Assets */}
{hasAssets ? formatCurrency(assets) : null}
|
{/* Jurisdiction */}
{m.city && {titleCaseCity(m.city)} }
{m.state && {expandStateName(m.state)} }
|
{/* File */}
{m.filing_url ? (
) : null}
|
)
})}
)
})()}
)}
{effectiveTab === 'meetings' && searchResults.results?.meetings && searchResults.results.meetings.length > 0 && (
Meetings ({searchResults.type_totals?.meetings?.toLocaleString() || searchResults.results.meetings.length})
)}
{effectiveTab === 'documents' && searchResults.results?.documents && searchResults.results.documents.length > 0 && (
Transcripts ({searchResults.type_totals?.documents?.toLocaleString() || searchResults.results.documents.length})
Passages from meeting transcripts that mention your search term — the discussion itself, even when it never became a titled agenda item or a recorded decision.
)}
{effectiveTab === 'meeting_documents' && searchResults.results?.meeting_documents && searchResults.results.meeting_documents.length > 0 && (
Meeting Documents ({searchResults.type_totals?.meeting_documents?.toLocaleString() || searchResults.results.meeting_documents.length})
Official meeting PDFs — agendas, notes (minutes), and attachments. Click any document to open it in the PDF viewer.
{searchResults.results.meeting_documents.map((result, idx) => {
const md = (result.metadata ?? {}) as Record
// PDF link: prefer the explicit metadata.document_url, fall
// back to result.url (both are the same direct PDF link).
const pdfUrl = (md.document_url as string) || result.url || ''
// Type badge label from metadata.document_type.
const dt = String(md.document_type ?? '').toLowerCase()
const badgeLabel =
dt === 'minutes' ? 'Notes'
: dt === 'attachment' ? 'Attachment'
: dt === 'agenda' ? 'Agenda'
: (md.document_type as string) || 'Document'
const badgeColor =
dt === 'minutes' ? 'bg-amber-100 text-amber-700 border-amber-200'
: dt === 'attachment' ? 'bg-gray-100 text-gray-700 border-gray-200'
: 'bg-cyan-100 text-cyan-700 border-cyan-200'
return (
{badgeLabel}
{md.body_name && (
{md.body_name}
)}
{pdfUrl ? (
docViewer ? (
) : (
{result.title}
↗
)
) : (
{result.title}
)}
{result.subtitle && (
{result.subtitle}
)}
{md.date && {md.date}}
{md.jurisdiction && {md.jurisdiction}}
{/* ts_headline snippet: matched passage wrapped in
literal
… markers. Reuse the shared
highlightSnippet helper so segments are React-
escaped (no dangerouslySetInnerHTML). */}
{result.description && (
{highlightSnippet(result.description)}
)}
)
})}
)}
{effectiveTab === 'organizations' && searchResults.results?.organizations && searchResults.results.organizations.length > 0 && (
Organizations ({searchResults.type_totals?.organizations?.toLocaleString() || searchResults.results.organizations.length})
{searchResults.results.organizations.map((result, idx) => (
))}
)}
{effectiveTab === 'causes' && searchResults.results?.causes && searchResults.results.causes.length > 0 && (
Causes ({searchResults.type_totals?.causes?.toLocaleString() || searchResults.results.causes.length})
{searchResults.results.causes.map((result, idx) => (
))}
)}
{effectiveTab === 'bills' && searchResults.results?.bills && searchResults.results.bills.length > 0 && (
Bills ({searchResults.type_totals?.bills?.toLocaleString() || searchResults.results.bills.length})
{searchResults.results.bills.map((result, idx) => (
))}
)}
{effectiveTab === 'topics' && searchResults.results?.topics && searchResults.results.topics.length > 0 && (
Topics ({searchResults.type_totals?.topics?.toLocaleString() || searchResults.results.topics.length})
{searchResults.results.topics.map((result, idx) => (
))}
)}
{/* Questions — cross-jurisdiction policy questions. Generic
ResultCard handles the title/subtitle/description; result.url
routes to /policy-question/{id} via openResult(). */}
{effectiveTab === 'questions' && searchResults.results?.questions && searchResults.results.questions.length > 0 && (
Questions ({searchResults.type_totals?.questions?.toLocaleString() || searchResults.results.questions.length})
{searchResults.results.questions.map((result, idx) => (
))}
)}
{effectiveTab === 'decisions' && searchResults.results?.decisions && searchResults.results.decisions.length > 0 && (
Decisions ({searchResults.type_totals?.decisions?.toLocaleString() || searchResults.results.decisions.length})
)}
{effectiveTab === 'jurisdictions' && searchResults.results?.jurisdictions && searchResults.results.jurisdictions.length > 0 && (
Jurisdictions ({searchResults.type_totals?.jurisdictions?.toLocaleString() || searchResults.results.jurisdictions.length})
{searchResults.results.jurisdictions.map((result, idx) => (
))}
)}
{effectiveTab === 'grants' && searchResults.results?.grants && searchResults.results.grants.length > 0 && (
Grants ({searchResults.type_totals?.grants?.toLocaleString() || searchResults.results.grants.length})
{searchResults.results.grants.map((result, idx) => (
))}
)}
{/* Grant Opportunities — open federal funding (Grants.gov).
Distinct from historical 990 grantmaking ("Grants") above. */}
{effectiveTab === 'grant_opportunities' && searchResults.results?.grant_opportunities && searchResults.results.grant_opportunities.length > 0 && (
Grant Opportunities ({searchResults.type_totals?.grant_opportunities?.toLocaleString() || searchResults.results.grant_opportunities.length})
{searchResults.results.grant_opportunities.map((result, idx) => (
))}
)}
{/* No Results */}
{searchResults.total_results === 0 && (
No results found
Try different keywords or adjust your filters
)}
{/* Pagination Controls */}
{searchResults.total_results > 0 && searchResults.pagination.total_pages > 1 && (
Page {searchResults.pagination.page} of {searchResults.pagination.total_pages}
•
{searchResults.total_results} total results
{/* Page numbers */}
{Array.from({ length: Math.min(5, searchResults.pagination.total_pages) }, (_, i) => {
const pageNum = Math.max(
1,
Math.min(
searchResults.pagination.page - 2 + i,
searchResults.pagination.total_pages - 4
)
) + Math.min(i, 4)
if (pageNum > searchResults.pagination.total_pages) return null
return (
)
})}
)}