import React, { useState } from 'react'; import { Filter, Video, FileText, DollarSign, BarChart3 } from 'lucide-react'; /** * TopicNavigation Component * Primary and secondary filters for browsing decisions */ export default function TopicNavigation({ selectedTopics = [], selectedPatterns = [], selectedResources = [], startDate, endDate, onTopicToggle, onPatternToggle, onResourceToggle, onStartDateChange, onEndDateChange, onClearAll }) { const [showFilters, setShowFilters] = useState(true); const topics = [ { id: 'public-health', label: 'Public Health', sublabel: 'Dental, Water, Mental Health', color: '#1D9E75' }, { id: 'education', label: 'Education & Youth', sublabel: 'School Board, Pre-K', color: '#185FA5' }, { id: 'infrastructure', label: 'Infrastructure', sublabel: 'Roads, Utilities, Construction', color: '#BA7517' }, { id: 'public-safety', label: 'Public Safety', sublabel: 'Police, Fire, EMS', color: '#E24B4A' } ]; const patterns = [ { id: 'technocratic-veto', label: 'Technocratic Veto', description: 'Legal/risk managers blocking decisions' }, { id: 'sequential-deferral', label: 'Sequential Deferral', description: 'Repeated "tabling for study"' }, { id: 'performance-rationale', label: 'Performance Rationale', description: 'Rhetoric not matching funding' } ]; const resources = [ { id: 'video', label: 'Video Recap', icon: Video }, { id: 'budget', label: 'Budget PDF', icon: DollarSign }, { id: 'dashboard', label: 'Impact Dashboard', icon: BarChart3 }, { id: 'summary', label: 'Summary Notes', icon: FileText } ]; const hasActiveFilters = selectedTopics.length > 0 || selectedPatterns.length > 0 || selectedResources.length > 0 || startDate !== null || endDate !== null; return (
{/* Header */}
{hasActiveFilters && ( )}
{/* Filter Panel */} {showFilters && (
{/* Primary Navigation: Topics */}
Primary Topic / Domain
{topics.map(topic => { const isSelected = selectedTopics.includes(topic.id); return ( ); })}
{/* Secondary Filter: Patterns */}
Filter by Pattern
{patterns.map(pattern => { const isSelected = selectedPatterns.includes(pattern.id); return ( ); })}
{/* Tertiary Filter: Resources */}
Filter by Resource
{resources.map(resource => { const isSelected = selectedResources.includes(resource.id); const Icon = resource.icon; return ( ); })}
{/* Time Window Filter */}
Time Window
onStartDateChange(e.target.value || null)} style={{ width: '100%', padding: '6px 8px', borderRadius: 6, border: '1px solid', borderColor: startDate ? '#D85A30' : '#ddd', fontSize: 12, background: 'white' }} />
onEndDateChange(e.target.value || null)} style={{ width: '100%', padding: '6px 8px', borderRadius: 6, border: '1px solid', borderColor: endDate ? '#D85A30' : '#ddd', fontSize: 12, background: 'white' }} />
)} {/* Active Filters Display */} {hasActiveFilters && (
Active filters: {selectedTopics.map(topicId => { const topic = topics.find(t => t.id === topicId); return ( {topic.label} ); })} {selectedPatterns.map(patternId => { const pattern = patterns.find(p => p.id === patternId); return ( {pattern.label} ); })} {selectedResources.map(resourceId => { const resource = resources.find(r => r.id === resourceId); return ( {resource.label} ); })} {startDate && ( From: {new Date(startDate).toLocaleDateString()} )} {endDate && ( To: {new Date(endDate).toLocaleDateString()} )}
)}
); }