Skip to content

Commit

Permalink
feat: previous/next buttons on PlayNext context-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Bellisario committed Apr 30, 2024
1 parent cff294f commit e10bac1
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/components/PlayNextView/PlayNextView.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
<script lang="ts">
import { playNextList, menuEntries, shuffle, currentID } from '$lib/player';
import {
playNextList,
menuEntries,
shuffle,
currentID,
playNextIndex,
} from '$lib/player';
import Modal from '$lib/Modal.svelte';
import './PlayNextController';
import PlayNextList from './PlayNextList.svelte';
import ActionButton from '$lib/ActionButton.svelte';
import { wantPlay } from '$lib/wantPlay';
import { tick } from 'svelte';
import { playNextSong, playPreviousSong } from './PlayNextController';
let modalClosed = true;
let canOpenModal = true;
Expand Down Expand Up @@ -55,6 +62,25 @@
forceOpenEffect = false;
},
discardAction: () => (forceOpenEffect = false),
breakAfter: true,
},
{
title: 'Play Previous',
action: () => {
playPreviousSong();
forceOpenEffect = false;
},
disabled: $playNextIndex === 0,
discardAction: () => (forceOpenEffect = false),
},
{
title: 'Play Next',
action: () => {
playNextSong();
forceOpenEffect = false;
},
disabled: $playNextIndex === $playNextList.length - 1,
discardAction: () => (forceOpenEffect = false),
},
];
}}
Expand Down

0 comments on commit e10bac1

Please sign in to comment.