refactor queu store to use play track using index

- this allows to have duplicate tracks in queue safely
- store indexes in localstorage instead of track objects.
This commit is contained in:
geoffrey45
2022-07-02 18:13:54 +03:00
committed by Mungai Geoffrey
parent f0d3c1c663
commit c9830842ed
10 changed files with 62 additions and 89 deletions
+6 -3
View File
@@ -10,7 +10,7 @@
</div>
<div class="separator no-border"></div>
<div>
<SongCard :track="queue.current" />
<SongCard :track="queue.tracks[queue.current]" />
<Progress />
<HotKeys />
</div>
@@ -39,7 +39,11 @@ const showContextMenu = (e: Event) => {
e.preventDefault();
e.stopPropagation();
const menus = trackContext(queue.current, useModalStore, useQueueStore);
const menus = trackContext(
queue.tracks[queue.current],
useModalStore,
useQueueStore
);
contextStore.showContextMenu(e, menus, ContextSrc.Track);
context_on.value = true;
@@ -82,7 +86,6 @@ const showContextMenu = (e: Event) => {
.button {
position: absolute;
background-size: 1.5rem;
top: $small;
cursor: pointer;
transition: all 200ms;