Added QueueItemProgress wrapper component that shows a live progress bar (percent, speed, ETA) for items with status 'downloading' when WebSocket progress data is available, falling back to the existing StatusBadge otherwise. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4 KiB
Phase 01: Wire Up WebSocket Download Progress End-to-End
The backend event bus, WebSocket route, progress parser, and frontend context/hook/component all exist but are not connected in the UI. This phase wires everything together so users see real-time download progress in the Queue page and Channel Detail page. By the end, downloading items will show a live progress bar with percentage, speed, and ETA — completing the WIP feature from commit 0541a5f.
Tasks
-
Wrap the app in DownloadProgressProvider:
- Read
src/frontend/src/App.tsxandsrc/frontend/src/contexts/DownloadProgressContext.tsxto understand current structure - In
App.tsx, importDownloadProgressProviderfrom../contexts/DownloadProgressContext - Wrap the
<AuthenticatedLayout />route (or the<Routes>inApp()) with<DownloadProgressProvider>so all pages can access download progress - Ensure the provider is inside the existing
QueryClientProvider(checkmain.tsxfor provider ordering) - Note: Already wired in
main.tsx(lines 25-29) from commit0541a5f. Provider wraps entire app inside QueryClientProvider. No changes needed.
- Read
-
Integrate DownloadProgressBar into the Queue page for actively downloading items:
- Read
src/frontend/src/pages/Queue.tsxandsrc/frontend/src/components/DownloadProgressBar.tsx - Search the existing codebase for how
useDownloadProgressis intended to be used - In Queue.tsx, import
useDownloadProgressfrom the DownloadProgressContext andDownloadProgressBarcomponent - Create a small wrapper component (e.g.,
QueueItemProgress) that callsuseDownloadProgress(contentItemId)and renders<DownloadProgressBar>when progress exists, or falls back to the existing<StatusBadge>when no active progress - Update the
statuscolumn render in the Queue table to use this wrapper for items with statusdownloading
- Read
-
Integrate download progress into the Channel Detail page:
- Read
src/frontend/src/pages/ChannelDetail.tsxto understand how content items are displayed - Search for how content items render their status in this page
- For content items with status
downloading, show theDownloadProgressBaralongside or instead of the static status badge - Use the same
useDownloadProgresshook pattern established in the Queue page
- Read
-
Add a WebSocket connection status indicator to the Sidebar or app header:
- Read
src/frontend/src/components/Sidebar.tsx - Import
useDownloadProgressConnectionfrom the DownloadProgressContext - Add a small visual indicator (e.g., a colored dot) near the bottom of the sidebar that shows green when WebSocket is connected and grey/red when disconnected
- Use existing CSS variables (
--successfor connected,--text-mutedfor disconnected)
- Read
-
Verify the backend emits progress events during streaming downloads:
- Read
src/services/download.tsto confirm thespawnDownloadmethod emitsdownload:progressevents via the event bus - Read
src/server/routes/websocket.tsto confirm the WebSocket route subscribes to the event bus and broadcasts to clients - Read
src/server/index.tsto confirm the event bus is passed to both the WebSocket route plugin and the server builder - If any wiring is missing between
buildServer()and the WebSocket route registration, fix it - Verify the
--newlineand--progressflags are added to yt-dlp args inspawnDownload(they should already be there)
- Read
-
Invalidate relevant queries on WebSocket events for immediate UI freshness:
- Read the
DownloadProgressContext.tsx— it already invalidatescontentandqueuequery keys ondownload:completeanddownload:failed - Read
src/frontend/src/api/hooks/useQueue.tsandsrc/frontend/src/api/hooks/useContent.tsto verify they use matching query keys - Also invalidate
activityandchannelsquery keys on complete/failed events so the Activity page and channel content counts update without manual refresh - Add
libraryquery key invalidation on complete events if the library hook uses a separate query key
- Read the