diff --git a/README.md b/README.md index b7292a6..a96751f 100644 --- a/README.md +++ b/README.md @@ -328,7 +328,7 @@ npm install SONDA_URL=http://127.0.0.1:8080 npm run dev # open http://localhost:5173, /api is proxied to Sonda ``` -What it does today: sign in (and create the first account of a new server), browse artists, albums and songs, search, and play with a queue, shuffle, repeat, media keys and a full-screen player. Artist pages show the Wikipedia text, similar artists and tags when those providers are on, each with its credit, and the photo credit next to the photo. It reports one listen per play. Discover suggests artists from the ones you pick, or from your listening only after you allow it (a dialog says that their names go to Last.fm), explains each score, and keeps your wishlist and the artists you are not interested in. An admin who set up the `lidarr` provider gets a "Request on Lidarr" button on an artist's page and on the Discover cards: it asks first, then sends that one artist to their own Lidarr, which does the downloading (the web app downloads nothing; the page of an artist reads what Lidarr has, the cards ask nothing until you send). An admin also gets an Admin area to add, rename, move and remove libraries and to start a scan (of one library or all, optionally reading every file again) and follow it, and to manage accounts: add one by email, give or take away the admin role, reset a password (which ends that person's sessions) and delete an account. The last admin cannot be changed, and your own account has no buttons there. Providers have a card each that says what the provider is sent: turning one on asks first, the API key is write-only (never shown, and gone from the page once saved), and there are a test of the key, the contact or address, removing what a provider gave, and, for Lidarr, the profiles and root folder to use when an artist is added. There are six themes (Sonda, Tokyo Night, Gruvbox dark, Gruvbox light, Dracula and Neon) and two languages (English and Italian), both chosen in Settings. +What it does today: sign in (and create the first account of a new server), browse artists, albums and songs, search, and play with a queue, shuffle, repeat, media keys, a volume slider with mute (remembered in the browser) and a full-screen player. Artist pages show the Wikipedia text, similar artists and tags when those providers are on, each with its credit, and the photo credit next to the photo. It reports one listen per play. Discover suggests artists from the ones you pick, or from your listening only after you allow it (a dialog says that their names go to Last.fm), explains each score, and keeps your wishlist and the artists you are not interested in. An admin who set up the `lidarr` provider gets a "Request on Lidarr" button on an artist's page and on the Discover cards: it asks first, then sends that one artist to their own Lidarr, which does the downloading (the web app downloads nothing; the page of an artist reads what Lidarr has, the cards ask nothing until you send). An admin also gets an Admin area to add, rename, move and remove libraries and to start a scan (of one library or all, optionally reading every file again) and follow it, and to manage accounts: add one by email, give or take away the admin role, reset a password (which ends that person's sessions) and delete an account. The last admin cannot be changed, and your own account has no buttons there. Providers have a card each that says what the provider is sent: turning one on asks first, the API key is write-only (never shown, and gone from the page once saved), and there are a test of the key, the contact or address, removing what a provider gave, and, for Lidarr, the profiles and root folder to use when an artist is added. There are six themes (Sonda, Tokyo Night, Gruvbox dark, Gruvbox light, Dracula and Neon) and two languages (English and Italian), both chosen in Settings. More commands, all run in `web/`: `npm test`, `npm run build`, and `npm run gen:api`, which rebuilds `src/api/schema.d.ts` from the OpenAPI spec (it fetches the generator with `npx`, so it needs the network once). The bulk jobs screen and serving the app from the binary come later. diff --git a/web/src/components/layout/NowPlaying.tsx b/web/src/components/layout/NowPlaying.tsx index 8376960..24f2294 100644 --- a/web/src/components/layout/NowPlaying.tsx +++ b/web/src/components/layout/NowPlaying.tsx @@ -6,6 +6,7 @@ import Cover from '@/components/Cover' import FullscreenButton from '@/components/FullscreenButton' import Scrubber from '@/components/Scrubber' import TrackRow from '@/components/TrackRow' +import VolumeControl from '@/components/VolumeControl' import { Button } from '@/components/ui/button' import { Dialog, DialogContent, DialogDescription, DialogTitle } from '@/components/ui/dialog' import { formatTime } from '@/lib/time' @@ -92,6 +93,7 @@ export default function NowPlaying() { + {upNext.length > 0 && (
diff --git a/web/src/components/layout/Player.test.tsx b/web/src/components/layout/Player.test.tsx index 2fa5d13..141ff21 100644 --- a/web/src/components/layout/Player.test.tsx +++ b/web/src/components/layout/Player.test.tsx @@ -263,6 +263,19 @@ test('the bar and the full-screen player both have a button for browser full scr } }) +test('the bar and the full-screen player both have a volume control, and they move the same volume', async () => { + usePlayer.setState({ volume: 0.5, muted: false }) + act(() => usePlayer.getState().playTracks([a])) + renderBar() + expect(within(screen.getByRole('contentinfo')).getByRole('slider', { name: 'Volume' })).toHaveValue('50') + expect(screen.getByRole('button', { name: 'Mute' })).toBeInTheDocument() + const { dialog } = await openNowPlaying() + fireEvent.change(within(dialog).getByRole('slider', { name: 'Volume' }), { target: { value: '20' } }) + expect(usePlayer.getState().volume).toBe(0.2) + await userEvent.click(within(dialog).getByRole('button', { name: 'Mute' })) + expect(usePlayer.getState().muted).toBe(true) +}) + test('without the Fullscreen API neither the bar nor the full-screen player shows the button', async () => { act(() => usePlayer.getState().playTracks([a])) renderBar() diff --git a/web/src/components/layout/PlayerBar.tsx b/web/src/components/layout/PlayerBar.tsx index 7e30540..5843761 100644 --- a/web/src/components/layout/PlayerBar.tsx +++ b/web/src/components/layout/PlayerBar.tsx @@ -5,6 +5,7 @@ import { Link } from 'react-router-dom' import Cover from '@/components/Cover' import FullscreenButton from '@/components/FullscreenButton' import Scrubber from '@/components/Scrubber' +import VolumeControl from '@/components/VolumeControl' import { Button } from '@/components/ui/button' import { formatTime } from '@/lib/time' import { currentTrack, usePlayer } from '@/player/store' @@ -85,7 +86,8 @@ export default function PlayerBar() { -
+
+