-
+ />
{t('discover.listening.label')}
diff --git a/web/src/components/RouteLoading.tsx b/web/src/components/RouteLoading.tsx
new file mode 100644
index 0000000..39ba75c
--- /dev/null
+++ b/web/src/components/RouteLoading.tsx
@@ -0,0 +1,7 @@
+import { useTranslation } from 'react-i18next'
+
+/** What is on screen while the first page of a lazy route is being fetched. */
+export default function RouteLoading() {
+ const { t } = useTranslation()
+ return
+}
diff --git a/web/src/components/Scrubber.tsx b/web/src/components/Scrubber.tsx
index fef02c0..96d4370 100644
--- a/web/src/components/Scrubber.tsx
+++ b/web/src/components/Scrubber.tsx
@@ -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-6 w-full accent-primary' : 'absolute inset-0 h-full w-full opacity-0',
+ variant === 'line' ? '-my-2 h-11 w-full accent-primary' : 'absolute inset-0 h-full w-full opacity-0',
)}
/>
)
diff --git a/web/src/components/layout/Player.test.tsx b/web/src/components/layout/Player.test.tsx
index 56bdf3f..2adfc89 100644
--- a/web/src/components/layout/Player.test.tsx
+++ b/web/src/components/layout/Player.test.tsx
@@ -321,3 +321,8 @@ test('the controls and the title do not render again when only the position move
act(() => usePlayer.getState().tick(6_000))
expect(commits).toBe(before)
})
+
+test('the seek bar of the player bar is 44 pixels high to take a thumb', () => {
+ render(
{}} variant="line" />)
+ expect(screen.getByRole('slider')).toHaveClass('h-11')
+})
diff --git a/web/src/components/ui/switch.test.tsx b/web/src/components/ui/switch.test.tsx
new file mode 100644
index 0000000..1544bbf
--- /dev/null
+++ b/web/src/components/ui/switch.test.tsx
@@ -0,0 +1,23 @@
+import { render, screen } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
+import { expect, test, vi } from 'vitest'
+import { Switch } from './switch'
+
+test('it is a switch that says whether it is on and reports a click', async () => {
+ const onClick = vi.fn()
+ render()
+ const sw = screen.getByRole('switch', { name: 'Wi-Fi' })
+ expect(sw).toHaveAttribute('aria-checked', 'false')
+ await userEvent.click(sw)
+ expect(onClick).toHaveBeenCalledTimes(1)
+})
+
+test('the area that takes a tap is 44 pixels high, and a disabled switch ignores taps', async () => {
+ const onClick = vi.fn()
+ render()
+ const sw = screen.getByRole('switch')
+ expect(sw).toHaveClass('h-11')
+ expect(sw).toHaveAttribute('aria-checked', 'true')
+ await userEvent.click(sw)
+ expect(onClick).not.toHaveBeenCalled()
+})
diff --git a/web/src/components/ui/switch.tsx b/web/src/components/ui/switch.tsx
new file mode 100644
index 0000000..016ce15
--- /dev/null
+++ b/web/src/components/ui/switch.tsx
@@ -0,0 +1,37 @@
+import type { ComponentProps } from 'react'
+import { cn } from '@/lib/utils'
+
+interface SwitchProps extends Omit, 'role' | 'type' | 'children'> {
+ checked: boolean
+}
+
+/** An on/off switch. The button is 44 pixels high so that a thumb finds it; the track drawn inside is smaller. */
+export function Switch({ checked, className, ...props }: SwitchProps) {
+ return (
+
+ )
+}
diff --git a/web/src/index.css b/web/src/index.css
index 770ca55..115c2aa 100644
--- a/web/src/index.css
+++ b/web/src/index.css
@@ -52,6 +52,16 @@
* {
@apply border-border outline-ring/50;
}
+ /* A line of reading stays readable on a wide screen, and no line ends on a lone word. */
+ p {
+ max-width: 56ch;
+ text-wrap: pretty;
+ }
+ h1,
+ h2,
+ h3 {
+ text-wrap: balance;
+ }
body {
@apply bg-background text-foreground;
}
diff --git a/web/src/pages/MixPage.tsx b/web/src/pages/MixPage.tsx
index d00be23..6108174 100644
--- a/web/src/pages/MixPage.tsx
+++ b/web/src/pages/MixPage.tsx
@@ -44,7 +44,7 @@ function MixView({ id }: { id: string }) {
{title}
- {mix.artists.length > 0 &&
{t('mixes.with', { artists: mix.artists.join(', ') })}
}
+ {mix.artists.length > 0 &&
{t('mixes.with', { artists: mix.artists.join(', ') })}
}
{t('playlists.meta', { count: mix.tracks.length, duration: formatTime(duration) })}