diff --git a/frontend/src/components/Layout.tsx b/frontend/src/components/Layout.tsx index 968c377..f4863b5 100644 --- a/frontend/src/components/Layout.tsx +++ b/frontend/src/components/Layout.tsx @@ -153,7 +153,7 @@ export default function Layout({ children }: { children: React.ReactNode }) { {/* Main Content */} -
+
{children}
diff --git a/frontend/src/pages/Discover.tsx b/frontend/src/pages/Discover.tsx index 667487a..b1489e5 100644 --- a/frontend/src/pages/Discover.tsx +++ b/frontend/src/pages/Discover.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from 'react' +import { useState, useEffect, useRef } from 'react' import { useSearchParams } from 'react-router-dom' import { Compass, Sparkles, Loader2, ListMusic, Search, Users, Clock, Disc3, TrendingUp } from 'lucide-react' import { useAuth } from '../lib/auth' @@ -39,6 +39,7 @@ export default function Discover() { const [adventurousness, setAdventurousness] = useState(3) const [excludeGenres, setExcludeGenres] = useState('') const [count, setCount] = useState(5) + const resultsRef = useRef(null) useEffect(() => { const load = async () => { @@ -74,9 +75,13 @@ export default function Discover() { excludeGenres.trim() || undefined, count, ) - console.log('Discover response:', response) - setResults(response.recommendations || []) + const recs = response.recommendations || [] + setResults(recs) setRemaining(response.remaining_this_week ?? null) + // Scroll to results after render + if (recs.length > 0) { + setTimeout(() => resultsRef.current?.scrollIntoView({ behavior: 'smooth' }), 100) + } } catch (err: any) { setError( err.response?.data?.detail || 'Failed to generate recommendations. Please try again.' @@ -135,7 +140,7 @@ export default function Discover() { return (
-

+

Discover

@@ -150,7 +155,7 @@ export default function Discover() {
{/* Discovery Form */} -
+
{/* Playlist Selector */}