diff --git a/src/app/page.tsx b/src/app/page.tsx index 104678c..525c3e1 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,6 +1,6 @@ "use client"; -import { useState, useEffect, Suspense } from "react"; +import { useState, useEffect, useRef, Suspense } from "react"; import CopyButton from "@/components/CopyButton"; import Link from "next/link"; import { useSearchParams } from "next/navigation"; @@ -60,6 +60,7 @@ function SearchInterface() { const [stats, setStats] = useState(null); const [error, setError] = useState(null); const [statsDate, setStatsDate] = useState(null); + const searchInputRef = useRef(null); // Update URL with search query const updateURL = (searchQuery: string) => { @@ -248,6 +249,8 @@ function SearchInterface() { performSearch(urlQuery); } fetchStats(); + // Focus the search input on load so the user can type immediately + searchInputRef.current?.focus(); }, []); // Empty dependency array - only run on mount return ( @@ -348,6 +351,7 @@ function SearchInterface() { >