feat: redesign main page, get player working (mostly) with Apple Music source

This commit is contained in:
2026-09-01 18:16:11 +02:00
parent faa271edd6
commit 01526034ce
29 changed files with 425 additions and 219 deletions
+12 -1
View File
@@ -1,9 +1,16 @@
import {
currentSource,
isPlaying,
queue,
queueIdx,
rawQueue,
shuffle
shuffle,
sources
} from '../state';
import {
duration,
playbackPercentage
} from '../status-tracking';
import type {
Song
} from '@/ts/dtype/playlist';
@@ -23,6 +30,10 @@ export const addSongList = ( songs: Song[], first: boolean = false ) => {
export const clearQueue = () => {
queue.value = [];
rawQueue.value = [];
sources[currentSource.value]?.stop();
duration.value = -1;
playbackPercentage.value = 1;
isPlaying.value = false;
};
/**
+11 -2
View File
@@ -1,5 +1,6 @@
import {
currentSource,
isPlaying,
queue,
queueIdx,
repeat,
@@ -21,9 +22,15 @@ export const playIndex = async ( idx: number ) => {
idx = repeat.value === 'all' ? queue.value.length - 1 : -1;
}
if ( idx < 0 ) return false;
sources[currentSource.value]?.stop();
if ( idx < 0 ) {
isPlaying.value = false;
currentSource.value = '';
return false;
}
stopTracking();
const nextSong = queue.value[ idx ]!;
@@ -33,4 +40,6 @@ export const playIndex = async ( idx: number ) => {
sources[currentSource.value]?.playSong( nextSong.identifier );
startTracking();
isPlaying.value = true;
};