diff --git a/backend/data/status.json b/backend/data/status.json index 9e977a3..c4a47f8 100644 --- a/backend/data/status.json +++ b/backend/data/status.json @@ -1,5 +1,5 @@ { "isDownloading": false, "title": "", - "timestamp": 1741836072302 + "timestamp": 1741836609758 } \ No newline at end of file diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 01b43a9..23a87a4 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -363,6 +363,7 @@ function App() { error: 'Failed to search. Please try again.' }; } + return { success: false, error: 'Search was cancelled' }; } finally { // Only update loading state if the request wasn't aborted if (searchAbortController.current && !searchAbortController.current.signal.aborted) { @@ -652,6 +653,12 @@ function App() { error={error} onDeleteVideo={handleDeleteVideo} collections={collections} + isSearchMode={isSearchMode} + searchTerm={searchTerm} + localSearchResults={localSearchResults} + youtubeLoading={youtubeLoading} + searchResults={searchResults} + onDownload={handleDownloadFromSearch} /> } /> diff --git a/frontend/src/components/Header.jsx b/frontend/src/components/Header.jsx index a400ddf..2009457 100644 --- a/frontend/src/components/Header.jsx +++ b/frontend/src/components/Header.jsx @@ -42,7 +42,7 @@ const Header = ({ onSubmit, onSearch, downloadingTitle, isDownloading }) => { const searchResult = await onSearch(videoUrl); if (searchResult.success) { setVideoUrl(''); - navigate('/'); // Navigate to home which will show search results + navigate('/'); // Stay on homepage to show search results } else { setError(searchResult.error); } @@ -55,7 +55,7 @@ const Header = ({ onSubmit, onSearch, downloadingTitle, isDownloading }) => { if (result.success) { setVideoUrl(''); - // Stay on home page which will show search results + // Stay on homepage to show search results navigate('/'); } else { setError(result.error); diff --git a/frontend/src/pages/Home.jsx b/frontend/src/pages/Home.jsx index 01e9f21..07eaa5b 100644 --- a/frontend/src/pages/Home.jsx +++ b/frontend/src/pages/Home.jsx @@ -2,15 +2,27 @@ import AuthorsList from '../components/AuthorsList'; import Collections from '../components/Collections'; import VideoCard from '../components/VideoCard'; -const Home = ({ videos = [], loading, error, onDeleteVideo, collections = [] }) => { +const Home = ({ + videos = [], + loading, + error, + onDeleteVideo, + collections = [], + isSearchMode = false, + searchTerm = '', + localSearchResults = [], + youtubeLoading = false, + searchResults = [], + onDownload +}) => { // Add default empty array to ensure videos is always an array const videoArray = Array.isArray(videos) ? videos : []; - if (loading && videoArray.length === 0) { + if (loading && videoArray.length === 0 && !isSearchMode) { return
No matching videos in your library.
+ )} +Loading YouTube results...
+{result.author}
+No YouTube results found.
+ )} +