feat(web): the logo of Sonda, and a design pass

- The logo, sONDA with an O that is a sea wave, traced to vector paths: the s in the text colour and the rest in the accent colour of the theme, in the sidebar and on the sign-in page; folded, the sidebar shows the wave alone. The favicon, the touch icon and the 192 and 512 icons are the wave on the blue of the logo (the old favicon was left by the build tool).
- Touch targets: buttons, fields, icon buttons and small links are 44 pixels tall; the time of the player is 13 pixels; the seek bar has a taller hit area.
- A phone: the menu is one row that scrolls sideways and the player is two lines (what is playing and the controls, then the position), so the page keeps the screen.
- Cards that are links lift a little and their pictures grow inside the frame on hover, unless less motion is asked for.
- The provider cards have a ground of their own.
This commit is contained in:
tgiachi 2026-11-13 12:10:54 +01:00
commit 7e46c38245
26 changed files with 158 additions and 58 deletions

View file

@ -3,6 +3,9 @@
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="icon" type="image/png" sizes="192x192" href="/icon-192.png" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<meta name="theme-color" content="#041d3a" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Sonda</title>
</head>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Before After
Before After

BIN
web/public/icon-192.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
web/public/icon-512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View file

@ -1,6 +1,7 @@
import { useState, type FormEvent } from 'react'
import { useTranslation } from 'react-i18next'
import { ApiError } from '@/api/client'
import Logo from '@/components/Logo'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
@ -32,14 +33,7 @@ export default function LoginPage() {
return (
<main className="flex min-h-screen items-center justify-center bg-background p-4">
<div className="flex w-full max-w-sm flex-col gap-6 rounded-xl bg-card p-8 text-card-foreground">
<div className="flex items-center gap-3">
<svg width="32" height="32" viewBox="0 0 28 28" fill="none" aria-hidden="true">
<circle cx="14" cy="14" r="3" fill="var(--primary)" />
<circle cx="14" cy="14" r="8" stroke="var(--primary)" strokeWidth="2" opacity="0.75" />
<circle cx="14" cy="14" r="12.5" stroke="var(--primary)" strokeWidth="1.5" opacity="0.35" />
</svg>
<span className="text-2xl font-extrabold tracking-tight">{t('app.name')}</span>
</div>
<Logo name={t('app.name')} className="h-9 w-auto self-start" />
<h1 className="text-xl font-bold">{creating ? t('auth.registerTitle') : t('auth.signInTitle')}</h1>
<form onSubmit={submit} className="flex flex-col gap-4">
<div className="flex flex-col gap-2">
@ -76,7 +70,7 @@ export default function LoginPage() {
<Button
type="button"
variant="link"
className="h-auto self-start p-0"
className="min-h-11 self-start px-0"
onClick={() => {
setCreating(!creating)
setError(null)

View file

@ -17,7 +17,7 @@ export default function AddToPlaylist({ track }: { track: Track }) {
const [open, setOpen] = useState(false)
return (
<>
<Button variant="ghost" size="icon" className="mr-2 size-10" aria-label={t('playlists.add')} onClick={() => setOpen(true)}>
<Button variant="ghost" size="icon" className="mr-2" aria-label={t('playlists.add')} onClick={() => setOpen(true)}>
<ListPlus />
</Button>
{open && <AddDialog track={track} onClose={() => setOpen(false)} />}

View file

@ -0,0 +1,26 @@
import { render, screen } from '@testing-library/react'
import { expect, test } from 'vitest'
import Logo from './Logo'
test('the logo is a picture named after the app, in the colours of the theme', () => {
const { container } = render(<Logo name="Sonda" />)
const svg = screen.getByRole('img', { name: 'Sonda' })
expect(svg).toBe(container.querySelector('svg'))
const paths = Array.from(container.querySelectorAll('path'))
expect(paths.map((p) => p.getAttribute('fill'))).toEqual(['var(--foreground)', 'var(--primary)'])
expect(paths.every((p) => (p.getAttribute('d') ?? '').length > 500)).toBe(true)
})
test('the mark is the O alone, in the accent colour', () => {
const { container } = render(<Logo name="Sonda" mark />)
expect(screen.getByRole('img', { name: 'Sonda' })).toBeInTheDocument()
const paths = container.querySelectorAll('path')
expect(paths).toHaveLength(1)
expect(paths[0].getAttribute('fill')).toBe('var(--primary)')
expect(container.querySelector('svg')?.getAttribute('viewBox')).not.toBe(render(<Logo name="x" />).container.querySelector('svg')?.getAttribute('viewBox'))
})
test('a size can be given by a class', () => {
const { container } = render(<Logo name="Sonda" className="h-7 w-auto" />)
expect(container.querySelector('svg')).toHaveClass('h-7', 'w-auto')
})

View file

@ -0,0 +1,20 @@
import { MARK, MARK_BOX, WORD_BOX, WORD_ONDA, WORD_S } from './logoPaths'
/**
* The logo of Sonda: "sONDA", the s in the text colour and the rest, whose O is a sea wave, in the accent colour of the
* theme. `mark` is the O alone, for where there is no room for the word. It is a picture with the name of the app.
*/
export default function Logo({ name, mark = false, className }: { name: string; mark?: boolean; className?: string }) {
return (
<svg role="img" aria-label={name} viewBox={mark ? MARK_BOX : WORD_BOX} className={className} xmlns="http://www.w3.org/2000/svg">
{mark ? (
<path d={MARK} fill="var(--primary)" fillRule="evenodd" />
) : (
<>
<path d={WORD_S} fill="var(--foreground)" fillRule="evenodd" />
<path d={WORD_ONDA} fill="var(--primary)" fillRule="evenodd" />
</>
)}
</svg>
)
}

View file

@ -33,7 +33,7 @@ export default function Scrubber({ positionMs, durationMs, onSeek, variant }: Sc
onChange={(e) => onSeek(Number(e.target.value))}
className={cn(
'cursor-pointer disabled:cursor-default',
variant === 'line' ? 'h-1 w-full accent-primary' : 'absolute inset-0 h-full w-full opacity-0',
variant === 'line' ? 'h-6 w-full accent-primary' : 'absolute inset-0 h-full w-full opacity-0',
)}
/>
)

View file

@ -10,7 +10,7 @@ export const CARD_GRID = 'grid grid-cols-[repeat(auto-fill,minmax(160px,1fr))] g
export function ArtistCard({ artist }: { artist: Artist }) {
const { t } = useTranslation()
return (
<Link to={`/artists/${artist.id}`} className="flex flex-col items-center gap-3 rounded-xl p-3 text-center hover:bg-secondary">
<Link to={`/artists/${artist.id}`} className="flex flex-col items-center gap-3 lift rounded-xl p-3 text-center hover:bg-secondary">
<ArtistPhoto artistId={artist.id} name={artist.name} size={128} />
<span className="flex min-w-0 max-w-full flex-col">
<span className="truncate font-bold">{artist.name}</span>
@ -24,7 +24,7 @@ export function ArtistCard({ artist }: { artist: Artist }) {
export function AlbumCard({ album }: { album: Album }) {
return (
<Link to={`/albums/${album.id}`} className="flex flex-col gap-3 rounded-xl p-3 hover:bg-secondary">
<Link to={`/albums/${album.id}`} className="flex flex-col gap-3 lift rounded-xl p-3 hover:bg-secondary">
<Cover albumId={album.id} size={200} fluid />
<span className="flex min-w-0 flex-col">
<span className="truncate font-bold">{album.title}</span>

View file

@ -39,9 +39,9 @@ export default function PlayerBar() {
return (
<footer
aria-label={t('player.label')}
className="flex flex-wrap items-center gap-x-6 gap-y-3 rounded-xl bg-card px-5 py-3 text-card-foreground"
className="player-bar gap-x-4 gap-y-1 rounded-xl bg-card px-4 py-2 text-card-foreground sm:gap-x-6 sm:px-5 sm:py-3"
>
<div className="flex min-w-0 flex-[1_1_240px] items-center gap-3">
<div className="player-info flex min-w-0 items-center gap-3">
{track ? (
<>
<button type="button" aria-label={t('player.open')} onClick={() => setOpen(true)} className="rounded-md">
@ -70,23 +70,24 @@ export default function PlayerBar() {
)}
</div>
<div className="flex flex-[2_1_400px] flex-col items-center gap-1">
<div className="player-controls flex justify-end sm:justify-center">
<PlayerControls />
<div className="flex w-full max-w-xl items-center gap-3 text-xs text-muted-foreground tabular-nums">
<span>{formatTime(track ? player.positionMs : 0)}</span>
<div className="flex-1">
<Scrubber
positionMs={player.positionMs}
durationMs={track?.duration_ms ?? 0}
onSeek={player.seek}
variant="line"
/>
</div>
<span>{formatTime(track?.duration_ms ?? 0)}</span>
</div>
</div>
<div className="flex flex-[1_1_120px] items-center justify-end">
<div className="player-seek flex w-full max-w-xl items-center gap-3 justify-self-center text-[13px] text-muted-foreground tabular-nums">
<span>{formatTime(track ? player.positionMs : 0)}</span>
<div className="flex-1">
<Scrubber
positionMs={player.positionMs}
durationMs={track?.duration_ms ?? 0}
onSeek={player.seek}
variant="line"
/>
</div>
<span>{formatTime(track?.duration_ms ?? 0)}</span>
</div>
<div className="player-extras flex items-center justify-end max-sm:hidden">
<VolumeControl />
<FullscreenButton />
<Button

View file

@ -46,6 +46,16 @@ test('folded, it keeps every link with its name and a tooltip, and the same butt
expect(within(nav).getByRole('link', { name: 'Albums' })).not.toHaveAttribute('title')
})
test('folded, the logo shrinks to its wave and the word is still the name of the app', async () => {
const nav = renderSidebar()
expect(within(nav).getAllByRole('img', { name: 'Sonda' })).toHaveLength(1)
await userEvent.click(within(nav).getByRole('button', { name: 'Collapse the sidebar' }))
const logos = within(nav).getAllByRole('img', { name: 'Sonda' })
expect(logos).toHaveLength(2) // the word (hidden from the wide bar) and the wave
expect(logos.filter((l) => l.classList.contains('sm:hidden'))).toHaveLength(1)
expect(logos.filter((l) => l.classList.contains('sm:block'))).toHaveLength(1)
})
test('the choice is remembered in the browser', async () => {
const first = renderSidebar()
await userEvent.click(within(first).getByRole('button', { name: 'Collapse the sidebar' }))

View file

@ -5,6 +5,7 @@ import { useState } from 'react'
import { NavLink } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { useSession } from '@/auth/session'
import Logo from '@/components/Logo'
import { cn } from '@/lib/utils'
const LINKS: { to: string; key: string; icon: LucideIcon; end: boolean; adminOnly: boolean }[] = [
@ -60,34 +61,32 @@ export default function Sidebar() {
aria-label={t('nav.main')}
data-collapsed={collapsed}
className={cn(
'flex flex-[0_0_248px] flex-col gap-6 rounded-xl bg-card p-5 text-card-foreground max-sm:flex-[1_1_100%] max-sm:gap-3 max-sm:p-3',
'flex flex-[0_0_248px] flex-col gap-6 rounded-xl bg-card p-5 text-card-foreground max-sm:min-w-0 max-sm:flex-[1_1_100%] max-sm:gap-3 max-sm:p-3',
collapsed && 'sm:flex-[0_0_72px] sm:items-center sm:p-3',
)}
>
<div className={cn('flex items-center gap-3', collapsed && 'sm:flex-col')}>
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" aria-hidden="true" className="shrink-0">
<circle cx="14" cy="14" r="3" fill="var(--primary)" />
<circle cx="14" cy="14" r="8" stroke="var(--primary)" strokeWidth="2" opacity="0.75" />
<circle cx="14" cy="14" r="12.5" stroke="var(--primary)" strokeWidth="1.5" opacity="0.35" />
</svg>
<span className={cn('text-[22px] font-extrabold tracking-tight', collapsed && 'sm:sr-only')}>{t('app.name')}</span>
{/* The word, or only its wave when the bar is folded (never on a phone, where the bar is a row). */}
<Logo name={t('app.name')} className={cn('h-7 w-auto shrink-0', collapsed && 'sm:hidden')} />
{collapsed && <Logo mark name={t('app.name')} className="hidden size-8 shrink-0 sm:block" />}
<button
type="button"
onClick={toggle}
aria-label={t(collapsed ? 'nav.expand' : 'nav.collapse')}
className={cn(
'ml-auto flex size-9 items-center justify-center rounded-lg text-muted-foreground hover:bg-secondary hover:text-foreground max-sm:hidden',
'ml-auto flex size-11 items-center justify-center rounded-lg text-muted-foreground hover:bg-secondary hover:text-foreground max-sm:hidden',
collapsed && 'sm:ml-0',
)}
>
{collapsed ? <PanelLeftOpen className="size-5" aria-hidden="true" /> : <PanelLeftClose className="size-5" aria-hidden="true" />}
</button>
</div>
<ul className="flex flex-col gap-1 max-sm:flex-row max-sm:flex-wrap">
{/* On a phone the links are one row that scrolls sideways, so that the page keeps the screen. */}
<ul className="flex flex-col gap-1 max-sm:min-w-0 max-sm:-mx-3 max-sm:flex-row max-sm:gap-0 max-sm:overflow-x-auto max-sm:px-3 max-sm:pb-1 max-sm:[scrollbar-width:none]">
{links.map((link) => {
const label = t(link.key)
return (
<li key={link.to}>
<li key={link.to} className="max-sm:shrink-0">
<NavLink
to={link.to}
end={link.end}

File diff suppressed because one or more lines are too long

View file

@ -20,16 +20,16 @@ const buttonVariants = cva(
},
size: {
default:
"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
icon: "size-8",
"h-11 gap-2 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
xs: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
sm: "h-9 gap-1 rounded-[min(var(--radius-md),12px)] px-3 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
lg: "h-12 gap-2 px-5 has-data-[icon=inline-end]:pr-4 has-data-[icon=inline-start]:pl-4",
icon: "size-11",
"icon-xs":
"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
"icon-sm":
"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
"icon-lg": "size-9",
"size-9 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
"icon-lg": "size-12",
},
},
defaultVariants: {

View file

@ -8,7 +8,7 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
type={type}
data-slot="input"
className={cn(
"h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
"h-11 w-full min-w-0 rounded-lg border border-input bg-transparent px-3 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
className
)}
{...props}

View file

@ -59,3 +59,34 @@
@apply font-sans;
}
}
/*
* The player bar. On a phone it is two lines, so that it leaves the page its room: what is playing and the controls on
* the first, the position on the second, and no volume or full-screen (the phone has its own volume, and the cover opens
* the full player). From 640px up the words are on the left, the controls and the position in the middle, the extras
* on the right.
*/
.player-bar {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
grid-template-areas: 'info controls' 'seek seek';
align-items: center;
}
.player-info { grid-area: info; }
.player-controls { grid-area: controls; }
.player-seek { grid-area: seek; }
.player-extras { grid-area: extras; }
@media (min-width: 640px) {
.player-bar {
grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
grid-template-areas: 'info controls extras' 'info seek extras';
}
}
/* A card that is a link answers the pointer: it lifts a little and its picture grows inside its frame. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
.lift { transition: transform 150ms ease-out; }
.lift:hover { transform: translateY(-2px); }
.lift img { transition: transform 200ms ease-out; }
.lift:hover img { transform: scale(1.03); }
}

View file

@ -103,7 +103,7 @@ export default function HomePage() {
))}
</ul>
{(albums.data?.total ?? 0) > albumItems.length && (
<Link to="/albums" className="self-start font-semibold text-primary hover:underline">
<Link to="/albums" className="inline-flex min-h-11 items-center self-start font-semibold text-primary hover:underline">
{t('common.seeAll')}
</Link>
)}
@ -124,7 +124,7 @@ export default function HomePage() {
))}
</ul>
{(artists.data?.total ?? 0) > artistItems.length && (
<Link to="/artists" className="self-start font-semibold text-primary hover:underline">
<Link to="/artists" className="inline-flex min-h-11 items-center self-start font-semibold text-primary hover:underline">
{t('common.seeAll')}
</Link>
)}

View file

@ -10,7 +10,7 @@ import { mixTitle } from './mixTitle'
function MixCard({ mix }: { mix: Mix }) {
const { t } = useTranslation()
return (
<Link to={`/mixes/${encodeURIComponent(mix.id)}`} className="flex flex-col gap-3 rounded-xl p-3 hover:bg-secondary">
<Link to={`/mixes/${encodeURIComponent(mix.id)}`} className="flex flex-col gap-3 lift rounded-xl p-3 hover:bg-secondary">
<MixCover albumIds={mix.album_ids} size={200} fluid />
<span className="flex min-w-0 flex-col">
<span className="truncate font-bold">{mixTitle(t, mix)}</span>

Some files were not shown because too many files have changed in this diff Show more