Add album link detection and lyrics list UI with loading/partial-error handling#3
Add album link detection and lyrics list UI with loading/partial-error handling#3spacegrey23 wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c537e64d98
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const albumLink = isAlbumLink(songLink) | ||
| const endpoint = albumLink ? 'getAlbumData' : 'getSongData' | ||
| const response = await fetch(`${import.meta.env.VITE_MY_BACKEND_LINK}${endpoint}?url=${encodeURIComponent(songLink)}`) |
There was a problem hiding this comment.
Route album links to a non-existent backend endpoint
When a pasted URL contains /album/, the client now switches to getAlbumData, but the backend in this repo only registers /getSongData (see backend/api/routes/routes.mjs). With no getAlbumData route, album URLs will always hit a 404 and surface an error, so the new album flow never succeeds unless a matching backend endpoint is added.
Useful? React with 👍 / 👎.
Motivation
/album/) and fetch per-track data instead of a single track.Description
useLyricsinclient/src/hooks/useLyrics.jsandclient/src/features/lyrics/useLyrics.jsto detect album links viaisAlbumLink, callgetAlbumDatafor albums orgetSongDatafor songs, andselect/normalize the response intoitems(list of normalized track objects).extractItems,normalizeItem, andnormalizeResultsto support varied backend payload shapes and to produceid,songName,artistName,albumName,albumImage,syncedLyrics,plainLyrics, anderrorMessageper item.LyricsCardrendering inclient/src/App.jsxwith list-aware rendering that shows aSongCardfor the primary item and mapslyricsItemsto oneLyricsCardper track with per-itemhandleCopy/handleDownloadwiring, list-level loading banner, and partial-error banner.client/src/components/LyricsCard/LyricsCard.jsxto supporttitle,subtitle,isLoading, anderrorMessageprops, render loading skeletons, show an explicit empty state, and disable copy/download when no lyrics exist.Testing
npm installin theclientdirectory which completed successfully.npm run devand Vite started and served the app successfully.Codex Task