fix current track in queue auto scroll position

- add another inner container to limit the offset
- auto scroll current track to container start
- add todo file
This commit is contained in:
geoffrey45
2022-06-13 09:17:00 +03:00
parent 9a2635d7c3
commit f1ec6309ba
11 changed files with 65 additions and 30 deletions
+1 -1
View File
@@ -13,7 +13,7 @@
</router-link>
</template>
<script setup>
<script setup lang="ts">
const props = defineProps({
folder: {
type: Object,
+2 -4
View File
@@ -20,9 +20,9 @@
/>
</div>
</div>
<div v-else-if="tracks.length === 0 && search_query">
<div v-else-if="tracks.length === 0">
<div class="no-results">
<div class="text">Nothing down here 😑</div>
<div class="text">No tracks here</div>
</div>
</div>
</div>
@@ -33,7 +33,6 @@ import { useRoute } from "vue-router";
import SongItem from "../shared/SongItem.vue";
import state from "../../composables/state";
import useQStore from "../../stores/queue";
import { Track } from "../../interfaces";
@@ -47,7 +46,6 @@ const props = defineProps<{
}>();
let route = useRoute().name;
const search_query = state.search_query;
/**
* Plays a clicked track and updates the queue
+26 -17
View File
@@ -2,19 +2,21 @@
<div class="up-next">
<div class="r-grid">
<UpNext :next="queue.next" :playNext="queue.playNext" />
<div
class="scrollable-r border rounded"
@mouseenter="setMouseOver(true)"
@mouseleave="setMouseOver(false)"
>
<TrackItem
v-for="t in queue.tracks"
:key="t.trackid"
:track="t"
@playThis="queue.play(t)"
:isCurrent="t.trackid === queue.current.trackid"
:isPlaying="queue.playing"
/>
<div class="scrollable-r border rounded">
<div
class="inner"
@mouseenter="setMouseOver(true)"
@mouseleave="setMouseOver(false)"
>
<TrackItem
v-for="t in queue.tracks"
:key="t.trackid"
:track="t"
@playThis="queue.play(t)"
:isCurrent="t.trackid === queue.current.trackid"
:isPlaying="queue.playing"
/>
</div>
</div>
<PlayingFrom :from="queue.from" />
</div>
@@ -62,10 +64,17 @@ onUpdated(() => {
.scrollable-r {
height: 100%;
padding: $small;
overflow: auto;
overflow-x: hidden;
scrollbar-color: grey transparent;
padding: $small 0 $small $small;
overflow: hidden;
.inner {
height: 100%;
overflow: scroll;
margin-top: 1rem;
padding-right: $small;
overflow-x: hidden;
scrollbar-color: grey transparent;
}
}
}
}
@@ -11,7 +11,6 @@
<ArtistGrid />
</Tab>
</TabsWrapper>
<component :is="s.currentTab" />
</div>
</template>
@@ -22,8 +21,6 @@ import TracksGrid from "./TracksGrid.vue";
import AlbumGrid from "./AlbumGrid.vue";
import ArtistGrid from "./ArtistGrid.vue";
import "@/assets/css/Search/Search.scss";
import useSearchStore from "@/stores/search";
const s = useSearchStore();
</script>
+1 -1
View File
@@ -1,5 +1,5 @@
<template>
<div v-show="name == s.currentTab" v-motion-slide-visible-top>
<div v-show="name == s.currentTab" v-motion-slide-visible-top>
<slot />
</div>
</template>
@@ -26,7 +26,7 @@ const queue = useQStore();
const search = useSearchStore();
function loadMore() {
search.updateLoadCounter("tracks", 5);
search.updateLoadCounter("tracks", 5);
search.loadTracks(search.loadCounter.tracks);
}
+12 -1
View File
@@ -41,7 +41,7 @@
/>
</div>
<div class="submit">
<input type="submit" class="rounded" value="Update" />
<input type="submit" id="updateplaylistsubmit" class="rounded" value="Update" @click="" />
</div>
</form>
</template>
@@ -98,8 +98,19 @@ function handleFile(file: File) {
image = file;
}
let clicked = false;
function update_playlist(e: Event) {
e.preventDefault();
if (!clicked) {
clicked = true;
const elem = document.getElementById("updateplaylistsubmit") as HTMLFormElement
elem.value = "Updating"
} else {
return;
}
const form = e.target as HTMLFormElement;
const formData = new FormData(form);
+1 -1
View File
@@ -19,7 +19,7 @@ function focusElem(className: string, delay?: number) {
if (dom) {
dom.scrollIntoView({
behavior: "smooth",
block: "center",
block: "start",
inline: "center",
});
}