Skip to content

Commit

Permalink
🔨 Fix carousel navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
devmount committed Jan 7, 2025
1 parent 4adabeb commit e0de388
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions frontend/src/modals/SetlistPresent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<!-- back navigation -->
<secondary-button
class="absolute bottom-0 left-4 md:left-auto md:right-1/2 flex items-center gap-1 mr-0.5"
:disabled="currentPosition == 0"
:disabled="currentPosition <= 0"
title="Previous Song"
@click="presentation.prev()"
>
Expand All @@ -56,7 +56,7 @@
<!-- forward navigation -->
<secondary-button
class="absolute bottom-0 left-16 md:left-1/2 flex items-center gap-1 ml-0.5"
:disabled="currentPosition == songs.length-1"
:disabled="currentPosition >= songs.length-1"
title="Next Song"
@click="presentation.next()"
>
Expand Down Expand Up @@ -215,7 +215,7 @@ import 'vue3-carousel/dist/carousel.css';
import { Carousel, Slide, Pagination } from 'vue3-carousel';
import { logicOr } from '@vueuse/math';
import { whenever } from '@vueuse/core';
import { reactive, ref, computed, watch, onMounted, onUnmounted, nextTick, inject, watchEffect } from 'vue';
import { reactive, ref, computed, watch, onMounted, onUnmounted, nextTick, inject } from 'vue';
import { useI18n } from 'vue-i18n';
import Dropdown from '@/elements/Dropdown.vue';
import InfoSongData from '@/modals/InfoSongData.vue';
Expand Down Expand Up @@ -398,11 +398,19 @@ onUnmounted(() => {
// component shortcuts
whenever(
logicOr(hkUp, hkBack),
() => presentation.value?.prev()
() => {
if (props.active && currentPosition.value > 0) {
presentation.value?.prev();
}
}
);
whenever(
logicOr(hkDown, hkForward),
() => presentation.value?.next()
() => {
if (props.active && currentPosition.value < props.songs.length-1) {
presentation.value?.next();
}
}
);
whenever(
hkInfo,
Expand Down

0 comments on commit e0de388

Please sign in to comment.