web-player: add lint guardrails for imports, non-null assertions, unused props and icon sizes; refresh docs
This commit is contained in:
+35
-112
@@ -1,128 +1,51 @@
|
||||
# Musify, page guide
|
||||
|
||||
Living document describing what each page of the web frontend should contain. It works as a map for prioritizing features. The design system (tokens, recipes, components) lives in the `musify-web` skill; here we describe **content and structure**, not styling.
|
||||
|
||||
Status legend: ✅ done · 🟡 partial / mockup · ⬜ pending.
|
||||
|
||||
> **Note (app redesign):** the `Musify.dc.html` prototype is being ported over (an app with a sidebar, views, and a persistent player with a dynamic accent per track). The marketing landing page was removed. The sections below still describe the older design and are pending an update to match the app views (Home, Search, Library, Upload, Import, Downloads, Playlists). The **player** is already built as components in `$lib/components/player/`, with its theme in `$lib/theme/` (`theme.css` for the palette, `color.ts` for the accent and gradient).
|
||||
|
||||
## Home (app) `/` 🟡
|
||||
|
||||
- **Hero**: a greeting plus "Your music. No limits." with a color wash taken from the current track's hue.
|
||||
- **Quick access, meaning recently played** (`GET /users/{id}/listening-history` merged with `player.recentlyPlayed` via `mergeRecentlyPlayed`). Empty state with an icon and an "Explore" CTA.
|
||||
- **Your playlists**: mosaic cards for the user's playlists (sample data for now). Has an empty state.
|
||||
- **Resume on load**: the root layout fetches `GET /users/{id}/last-listened-track` and hydrates the player (`player.hydrate`) with it, paused, so the player bar isn't empty on a fresh session. Only applies when nothing is already loaded (won't override an in-progress session).
|
||||
|
||||
### Pending backend work (ASP.NET) for Home
|
||||
|
||||
- **Playlists by last listen**: add `lastPlayedAt` to the playlist (the schema currently only has `createdAt`/`updatedAt`) and allow sorting `GET /playlists/users/{userId}` by that field (for example `?sort=lastPlayed`), to show "your most recently played" playlists.
|
||||
- Tracks will need an **artist** and a **color/hue** (or a real cover to extract one from) for the artwork and the dynamic accent. Right now `TrackApplicationResponse` carries neither artist nor color.
|
||||
Living document describing what each page of the web frontend contains. The design system (tokens, recipes, components) lives in the `musify-web` skill and in `CLAUDE.md`; here we describe **content and structure**, not styling.
|
||||
|
||||
## Route structure
|
||||
|
||||
Routes are grouped to separate the public experience from the authenticated one (the groups don't change the URL):
|
||||
Everything the user sees after signing in lives under the `(app)` group (the group doesn't change the URL). `auth/` and `api/` sit outside it.
|
||||
|
||||
```
|
||||
src/routes/
|
||||
(marketing)/ Public, no session required
|
||||
+page.svelte / Landing ✅
|
||||
(app)/ The app experience
|
||||
explore/ /explore Explore / search ✅
|
||||
upload/ /upload Upload music 🟡 mockup
|
||||
library/ /library Your library ⬜
|
||||
playlists/ /playlists Your playlists ⬜
|
||||
[id]/ /playlists/:id Playlist detail ⬜
|
||||
auth auth/login auth/logout auth/callback Auth (page + endpoints) ✅
|
||||
api/tracks/[id]/stream Stream proxy ✅
|
||||
(app)/
|
||||
+page.svelte / Home
|
||||
explore/ /explore Search and genre discovery
|
||||
liked/ /liked Liked songs
|
||||
library/ /library Your uploaded songs
|
||||
upload/ /upload Upload a song
|
||||
albums/ /albums Your albums
|
||||
[id]/ /albums/:id Album detail
|
||||
playlists/ /playlists Your playlists
|
||||
[id]/ /playlists/:id Playlist detail
|
||||
mixes/[id]/ /mixes/:id Generated mix
|
||||
user/[id]/ /user/:id Public profile
|
||||
[list=followList]/ /user/:id/followers|following
|
||||
auth/ auth/login auth/logout auth/callback Login screen and OIDC endpoints
|
||||
api/ Same origin JSON endpoints used by the client
|
||||
```
|
||||
|
||||
Global components (present on every page): **Navbar**, **Footer**, and **PlayerBar** (the fixed playback bar, shown while something is playing).
|
||||
Global chrome on every app page: sidebar (desktop) or tab bar (mobile), top bar with search and account menu, the persistent player dock, and the queue panel.
|
||||
|
||||
---
|
||||
## Pages
|
||||
|
||||
## 1. Landing `/` ✅ (marketing)
|
||||
- **Home `/`**: a greeting, weekly listening stats, "continue listening" (recently played merged with the in-session history), the featured playlist with its first tracks (play and shuffle load the full list on demand), the user's mixes and playlists. Anonymous visitors are redirected to `/explore`.
|
||||
- **Explore `/explore`**: genre tiles when there is no query, otherwise search results grouped by songs, albums, users and playlists with filter chips and counts taken from the API totals. Songs paginate with infinite scroll. Track and album context menus offer play next, add to queue and add to playlist.
|
||||
- **Liked `/liked`**: the songs the user liked, newest first, with unlike per row.
|
||||
- **Library `/library`**: the songs the user uploaded, with a confirmed delete.
|
||||
- **Upload `/upload`**: audio, cover, title, genres (incompatible genres are blocked) and explicit flag. The server reserves presigned URLs, uploads both files and creates the track; processing happens asynchronously in the backend.
|
||||
- **Albums `/albums`, `/albums/:id`**: list and create albums. The owner can edit, delete and add or remove tracks from their library.
|
||||
- **Playlists `/playlists`, `/playlists/:id`**: list and create playlists. The owner can edit, delete and remove tracks; everyone else gets a read only view.
|
||||
- **Mix `/mixes/:id`**: a generated mix with play, shuffle and a track menu.
|
||||
- **Profile `/user/:id`**: public playlists, follow button and links to the followers and following lists, which respect the profile's privacy.
|
||||
- **Auth `/auth`**: the login screen. Its buttons lead to `/auth/login`, which starts the Zitadel OIDC flow; `?mode=register` opens the sign up variant and `?returnTo=` (local paths only) sends the user back afterwards. `/auth/logout` ends the session and `/auth/callback` creates the encrypted `mf_session` cookie.
|
||||
|
||||
The entry page for logged out visitors. Its job is to sell the product and drive people to sign up or explore.
|
||||
## Data flow
|
||||
|
||||
- **Hero**: a status badge (beta), a title, a subtitle, a primary CTA (Start for free, leading to sign up) and a secondary one (Explore songs).
|
||||
- **Features**: three cards covering listening, playlists, and uploading.
|
||||
- **Suggested next steps**: a screenshots or demo section, social proof, a short FAQ.
|
||||
Each page loads its data in `+page.server.ts` through the typed API client, and normalizes it with the mappers in `$lib/server/mappers.ts` so the client only ever sees the domain types in `$lib/types.ts`. Mutations are form actions built with `authedAction`. Client side pagination goes through the `/api/*` endpoints.
|
||||
|
||||
## 2. Login / Auth ✅ (endpoints)
|
||||
## Pending backend work
|
||||
|
||||
`/auth` is Musify's login screen; its buttons lead to `/auth/login`, which kicks off the Zitadel OIDC flow and redirects. `?mode=register` starts on the sign up variant, and `?returnTo=` sends the user back to the route they came from once they're in. `/auth/logout` ends the session. `/auth/callback` exchanges the code and creates the encrypted `mf_session` cookie. The credentials UI itself is served by Zitadel, not by Musify.
|
||||
|
||||
## 3. Explore / Search `/explore` ✅ (app)
|
||||
|
||||
Discovery and search over the catalog.
|
||||
|
||||
- **Search box**: a text input (`?q=`) that filters by name on the backend.
|
||||
- **Results count** and a **track grid** (2 to 4 columns): cover, title, date, and a play/pause button on hover that queues and plays through the global player.
|
||||
- **Pagination**: previous/next (`?page=`, 24 per page).
|
||||
- **Empty state**: no results, or an empty catalog.
|
||||
- **Suggested next steps**: filters (most recent, by user), loading skeletons, a real track cover (the listing API doesn't currently return the image key).
|
||||
|
||||
## 4. Upload music `/upload` 🟡 mockup (app)
|
||||
|
||||
Adding a new song. The real backend flow, for when it gets wired up:
|
||||
|
||||
1. `POST /tracks/upload-urls` returns presigned URLs for cover and audio, plus `intentId`s.
|
||||
2. `PUT` each file to its presigned URL (a direct upload to storage).
|
||||
3. `POST /tracks` with `title`, `pictureIntentId`, `audioIntentId`.
|
||||
4. The backend processes the audio asynchronously (transcoding it to DASH).
|
||||
|
||||
What the page needs:
|
||||
|
||||
- **Audio zone**: drag and drop or a file picker, showing the file's name and size, with type (audio) and size validation.
|
||||
- **Cover**: an image picker with a square preview.
|
||||
- **Metadata**: title (required), with room for future fields like a description.
|
||||
- **Visible pipeline**: the Upload, Process, Publish steps and their status.
|
||||
- **Progress bar** for the upload and the processing state.
|
||||
- **States**: empty, file selected, uploading, processing, published, error.
|
||||
- **Requires a session** (once wired up: redirect to `/auth?returnTo=/upload`).
|
||||
|
||||
## 5. Your library `/library` ⬜ (app)
|
||||
|
||||
The authenticated user's personal panel, everything of theirs in one place.
|
||||
|
||||
- **Tabs / sections**: "Your songs" (`GET /tracks/users/{userId}`) and "Your playlists" (`GET /playlists/users/{userId}`).
|
||||
- **Your songs**: a list with play, plus management actions (delete via `DELETE /tracks/{id}`, add to a playlist).
|
||||
- **Your playlists**: a grid of covers with a "Create playlist" button.
|
||||
- **Empty state** with a CTA to upload or create.
|
||||
- **Requires a session.**
|
||||
|
||||
## 6. Playlists `/playlists` ⬜ (app)
|
||||
|
||||
A listing of the user's playlists.
|
||||
|
||||
- **Grid** of playlists (cover, name, track count), linking to the detail page.
|
||||
- **Create playlist**: a modal or page with a name, description, and cover (`POST /playlists`, cover via `POST /playlists/upload-picture`).
|
||||
- **Empty state** with a CTA.
|
||||
- **Requires a session.**
|
||||
|
||||
## 7. Playlist detail `/playlists/[id]` ⬜ (app)
|
||||
|
||||
- **Header**: a large cover, name, description, track count, and a "Play all" button.
|
||||
- **Track list** (`GET /playlists/{id}/tracks`, paginated): index, title, date, play, and remove from the playlist (`DELETE /playlists/{id}/tracks/{trackId}`).
|
||||
- **Owner actions**: edit (`PUT`), delete (`DELETE`) the playlist, reorder (a future addition).
|
||||
- **Add tracks**: from explore or the library (`POST /playlists/{id}/tracks/{trackId}`).
|
||||
|
||||
## 8. User profile `/user/[id]` ⬜ (future)
|
||||
|
||||
A public view of a user: avatar, name, their public songs and playlists (`GET /users/{id}`, `GET /tracks/users/{id}`, `GET /playlists/users/{id}`).
|
||||
|
||||
---
|
||||
|
||||
## Global player (PlayerBar) ✅
|
||||
|
||||
A fixed bottom bar, visible while something is playing. Shows track info, transport controls (previous, play/pause, next), a progress bar, and volume control. Queues lists from any grid (`player.playQueue`). Plays DASH through the `/api/tracks/:id/stream` proxy, which requests a manifest and a signed ticket from the backend.
|
||||
|
||||
## Available backend (summary)
|
||||
|
||||
| Resource | Endpoints |
|
||||
| --------- | ----------------------------------------------------------------- |
|
||||
| Tracks | list/search, detail, by user, stream, create, delete, upload-urls |
|
||||
| Playlists | CRUD, playlist tracks, add/remove track, upload-picture |
|
||||
| Users | list/search, detail, create |
|
||||
|
||||
Typed client in `$lib/server/api.ts` (`openapi-fetch`, ErrorOr style). Use it inside `load`/server actions, never from the client. Types live in `src/lib/api/schema.d.ts`.
|
||||
- Sorting playlists by last listen (`lastPlayedAt`) for a "recently played playlists" shelf.
|
||||
- A bulk endpoint to add several tracks to a playlist at once (adding an album currently posts one track at a time).
|
||||
- An endpoint returning the most listened tracks, to bring back a "popular" section on Home.
|
||||
|
||||
Reference in New Issue
Block a user