feat(web): make Sonda feel like an app on a phone
A review of the phone experience (the issue) found a desktop page made smaller. What changes: feat: - The player bar is one row on a phone (cover, title, play and next, a thin line of progress) and is not there while nothing plays. A tap or a swipe up on it opens the full-screen player. - The Back gesture closes the full-screen player instead of leaving the page under it; a swipe down closes it too. The full queue is listed on a phone. - The queue is kept in the browser: a reload, or a tab that Android throws away, comes back paused on the same song at the same second. It belongs to the person signed in and is forgotten on sign-out. - Tabs have icons; the page starts at its top on a new route and back goes to where the list was; a swipe on the page no longer reloads it. fix: - The player now knows when the system pauses the audio (another app, a headset), so the button and the lock screen no longer say it plays. - The lock screen has a working seek bar and the right play/pause state. - The player bar was not hidden by max-sm:hidden: its grid rules were outside the Tailwind layers and won. They are in the components layer now. - Song rows give the title the room on a phone (no number column). - The album header is centred and the greeting is smaller on a phone; recent songs on Home show the artist. - Thumbnails ask for the small cover (300 px) and not the 1000 px one. - Pages use dvh, the viewport covers the notch, and the tabs keep clear of the gesture bar; the update notice no longer sits on the bar. - No grey tap flash, no double-tap delay, no image menu on a long press.
This commit is contained in:
parent
ee31e0ee7c
commit
75a7898c68
1 changed files with 892 additions and 91 deletions
|
|
@ -394,7 +394,7 @@ Back up the database and `sonda.toml`. Your music stays wherever you keep it.
|
|||
|
||||
## Web app
|
||||
|
||||
A web client lives in `web/` (React, Vite and shadcn/ui). It talks only to the Sonda server: no CDN, no external fonts, no analytics. With the app built into the binary (`make build`, or the Docker image) `sondad` serves it: open the address of the server, for example `http://127.0.0.1:8080`, and sign in. The page carries a strict Content-Security-Policy (only resources of the server itself, no inline scripts), cannot be framed and sends no referrer, and a link inside the app (`/admin/users`) works when you reload it. The player draws a live picture of what is playing, in the browser, from the sound itself (Web Audio). Settings has a choice for it, kept on the device: a spectrogram (the last seconds, low notes at the bottom, the default), the classic bars with falling caps, an oscilloscope, Milkdrop, or nothing. The bars, the oscilloscope and the spectrogram take the colour of this server or, for a friend's song, the colour of the friend. Milkdrop fills the background of the full-screen player with the pictures Winamp made famous, drawn on the device with [butterchurn](https://github.com/jberg/butterchurn) (MIT) and its presets, which are part of the app: nothing is fetched from outside. It is loaded only when chosen, and anyone who asked the system for less motion gets the spectrogram instead, because the pictures flash. The player listens to the sound and changes nothing of it, and draws only while something plays.
|
||||
A web client lives in `web/` (React, Vite and shadcn/ui). It talks only to the Sonda server: no CDN, no external fonts, no analytics. With the app built into the binary (`make build`, or the Docker image) `sondad` serves it: open the address of the server, for example `http://127.0.0.1:8080`, and sign in. The page carries a strict Content-Security-Policy (only resources of the server itself, no inline scripts), cannot be framed and sends no referrer, and a link inside the app (`/admin/users`) works when you reload it. The player draws a live picture of what is playing, in the browser, from the sound itself (Web Audio). Settings has a choice for it, kept on the device: a spectrogram (the last seconds, low notes at the bottom, the default), the classic bars with falling caps, an oscilloscope, Milkdrop, or nothing. The bars, the oscilloscope and the spectrogram take the colour of this server or, for a friend's song, the colour of the friend. Milkdrop fills the background of the full-screen player with the pictures Winamp made famous, drawn on the device with [butterchurn](https://github.com/jberg/butterchurn) (MIT) and its presets, which are part of the app: nothing is fetched from outside. It is loaded only when chosen, and anyone who asked the system for less motion gets the spectrogram instead, because the pictures flash. The player listens to the sound and changes nothing of it, and draws only while something plays. On a phone the player is one row at the foot of the page (and is not there while nothing plays); a tap or a swipe up opens the full-screen player, a swipe down or the Back gesture closes it, and the lock screen shows the song with its seek bar and follows play and pause. The queue is kept in the browser, so a page that is reloaded, or a tab that Android throws away, comes back paused on the same song at the same second.
|
||||
|
||||
To work on the interface itself, run the Vite dev server next to a running `sondad` (set `SONDA_URL` to where it listens: the default is `http://127.0.0.1:8080`):
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue