environments/review-docs-renov-b1i8ag/deployments/15025
wvffle 2022-10-28 12:59:54 +00:00 zatwierdzone przez Georg Krause
rodzic f51007b807
commit 4376e40e26
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 2970D504B2183D22
3 zmienionych plików z 13 dodań i 6 usunięć

Wyświetl plik

@ -38,6 +38,7 @@ const {
queue, queue,
currentIndex, currentIndex,
currentTrack, currentTrack,
isShuffled,
shuffle shuffle
} = useQueue() } = useQueue()
@ -277,7 +278,7 @@ const loopingTitle = computed(() => {
:aria-label="labels.shuffle" :aria-label="labels.shuffle"
@click.prevent.stop="shuffle()" @click.prevent.stop="shuffle()"
> >
<i :class="['ui', 'random', {'disabled': queue.length === 0}, 'icon']" /> <i :class="['ui', 'random', { disabled: queue.length === 0, shuffling: isShuffled }, 'icon']" />
</button> </button>
</div> </div>
<div class="group"> <div class="group">

Wyświetl plik

@ -159,8 +159,6 @@ export const useQueue = createGlobalState(() => {
if (index <= currentIndex.value) { if (index <= currentIndex.value) {
currentIndex.value -= 1 currentIndex.value -= 1
} }
// TODO (wvffle): Check if removing last element works well
} }
// Play track // Play track
@ -227,11 +225,19 @@ export const useQueue = createGlobalState(() => {
// Shuffle // Shuffle
const shuffle = () => { const shuffle = () => {
if (isShuffled.value) { if (isShuffled.value) {
const id = shuffledIds.value[currentIndex.value]
shuffledIds.value.length = 0 shuffledIds.value.length = 0
// NOTE: This this looses the correct index when there are multiple tracks with the same id in the queue
// Since we shuffled the queue before, we probably do not even care for the correct index, just the order
currentIndex.value = tracks.value.indexOf(id)
return return
} }
shuffledIds.value = shuffleArray(tracks.value) const ids = [...tracks.value]
const [first] = ids.splice(currentIndex.value, 1)
shuffledIds.value = [first, ...shuffleArray(ids)]
currentIndex.value = 0
} }
const reshuffleUpcomingTracks = () => { const reshuffleUpcomingTracks = () => {

Wyświetl plik

@ -203,8 +203,8 @@
} }
} }
} }
.shuffling .loader.inline { .shuffling {
margin: 0; color: var(--vibrant-color);
} }
.control.circular.button { .control.circular.button {
padding: 0; padding: 0;