57 lines
2.0 KiB
TypeScript
57 lines
2.0 KiB
TypeScript
import { useNavigate } from 'react-router-dom';
|
|
import { useAppStore } from '../store/appStore';
|
|
import { SearchForm } from '../components/forms/SearchForm';
|
|
|
|
export function Home() {
|
|
const navigate = useNavigate();
|
|
const { searchQuery, selectLegislator } = useAppStore();
|
|
|
|
const handleSearch = async () => {
|
|
if (!searchQuery.trim()) return;
|
|
await useAppStore.getState().searchLegislators(searchQuery);
|
|
const results = useAppStore.getState().searchResults;
|
|
if (results.length > 0) {
|
|
await selectLegislator(results[0].id);
|
|
navigate(`/legislator/${results[0].id}`);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<div className="flex flex-col items-center justify-center min-h-[60vh]">
|
|
<div className="text-center mb-8">
|
|
<h2 className="text-3xl font-bold text-gray-900 mb-2">Track Legislative Voting Records</h2>
|
|
<p className="text-gray-600">
|
|
Search for any U.S. Congress legislator to view their complete voting history
|
|
with AI-generated bill summaries.
|
|
</p>
|
|
</div>
|
|
|
|
<div className="w-full max-w-xl">
|
|
<div className="flex gap-2">
|
|
<SearchForm />
|
|
<button
|
|
onClick={handleSearch}
|
|
className="px-6 py-3 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors font-medium whitespace-nowrap"
|
|
>
|
|
Search
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="mt-12 grid grid-cols-3 gap-8 text-center w-full max-w-lg">
|
|
<div>
|
|
<div className="text-2xl font-bold text-primary-600">Search</div>
|
|
<p className="text-sm text-gray-500 mt-1">Find any legislator</p>
|
|
</div>
|
|
<div>
|
|
<div className="text-2xl font-bold text-primary-600">Explore</div>
|
|
<p className="text-sm text-gray-500 mt-1">View voting history</p>
|
|
</div>
|
|
<div>
|
|
<div className="text-2xl font-bold text-primary-600">Understand</div>
|
|
<p className="text-sm text-gray-500 mt-1">AI bill summaries</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
} |