feat: tapping a search result starts radio from that track, on web and Android (DRY A3)
Android played the visible search results as a queue; the web started radio. Both now start radio seeded from the tapped track: the song plays first, then songs like it. Android falls back to playing the track alone when radio can't be had (offline, or an empty answer). The web's two identical onTrackPlay handlers (search and search/tracks) become one, radioFromRow. PlayerController gains playRadio, which replaces the queue; the track menu's startRadio still keeps the current song playing and queues radio after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,8 +10,7 @@
|
||||
import ApiErrorBanner from '#lib/components/ApiErrorBanner.svelte';
|
||||
import ListContinuation from '#lib/components/ListContinuation.svelte';
|
||||
import { useDelayed } from '#lib/utils/useDelayed.svelte.js';
|
||||
import { playRadio } from '#lib/player/store.svelte.js';
|
||||
import type { TrackRef } from '#lib/api/types.js';
|
||||
import { radioFromRow } from '#lib/player/radioFromRow.js';
|
||||
|
||||
const q = $derived((page.url.searchParams.get('q') ?? '').trim());
|
||||
const queryStore = $derived(q ? createSearchTracksInfiniteQuery(q) : null);
|
||||
@@ -20,10 +19,6 @@
|
||||
const tracks = $derived(query?.data?.pages?.flatMap((p) => p.items) ?? []);
|
||||
const total = $derived(query?.data?.pages?.[0]?.total ?? 0);
|
||||
const showSkeleton = useDelayed(() => !!query?.isPending);
|
||||
|
||||
function onTrackPlay(_tracks: TrackRef[], index: number) {
|
||||
playRadio(_tracks[index].id);
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head><title>{pageTitle('Search · Tracks')}</title></svelte:head>
|
||||
@@ -50,7 +45,7 @@
|
||||
{:else}
|
||||
<TrackList>
|
||||
{#each tracks as t, i (t.id)}
|
||||
<TrackRow tracks={tracks} index={i} onPlay={onTrackPlay} />
|
||||
<TrackRow tracks={tracks} index={i} onPlay={radioFromRow} />
|
||||
{/each}
|
||||
</TrackList>
|
||||
<ListContinuation
|
||||
|
||||
Reference in New Issue
Block a user