Move liked tracks state to state/ and recently played merge to player/

This commit is contained in:
2026-09-24 13:58:43 +02:00
parent a54d1ef077
commit 155f0e2b6a
7 changed files with 5 additions and 5 deletions
@@ -0,0 +1,15 @@
import { player } from '$lib/player/player.svelte';
import type { Track } from '$lib/types';
export function mergeRecentlyPlayed(history: Track[], limit: number): Track[] {
const seen = new Set<string>();
const merged: Track[] = [];
for (const track of [...player.recentlyPlayed, ...history]) {
if (seen.has(track.id)) continue;
seen.add(track.id);
merged.push(track);
}
return merged.slice(0, limit);
}