remove highlight track mechanism

-
I found out that it's very annoying
-
This commit is contained in:
geoffrey45
2022-09-02 19:25:22 +03:00
parent 4c8d437530
commit 140c25d0ff
4 changed files with 8 additions and 51 deletions
+2 -37
View File
@@ -23,7 +23,6 @@
@updateQueue="updateQueue" @updateQueue="updateQueue"
:isPlaying="queue.playing" :isPlaying="queue.playing"
:isCurrent="queue.currentid == track.trackid" :isCurrent="queue.currentid == track.trackid"
:isHighlighted="($route.query.highlight as string) == track.hash"
/> />
</div> </div>
<div class="copyright" v-if="copyright && copyright()"> <div class="copyright" v-if="copyright && copyright()">
@@ -38,8 +37,8 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, onUpdated, ref } from "vue"; import { ref } from "vue";
import { onBeforeRouteUpdate, useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { useElementSize } from "@vueuse/core"; import { useElementSize } from "@vueuse/core";
import SongItem from "../shared/SongItem.vue"; import SongItem from "../shared/SongItem.vue";
@@ -48,7 +47,6 @@ import { Routes } from "@/composables/enums";
import { Track } from "@/interfaces"; import { Track } from "@/interfaces";
import useAlbumStore from "@/stores/pages/album"; import useAlbumStore from "@/stores/pages/album";
import useQStore from "@/stores/queue"; import useQStore from "@/stores/queue";
import { focusElem } from "@/utils";
import { computed } from "@vue/reactivity"; import { computed } from "@vue/reactivity";
const queue = useQStore(); const queue = useQStore();
@@ -66,7 +64,6 @@ const props = defineProps<{
const route = useRoute(); const route = useRoute();
const routename = route.name as string; const routename = route.name as string;
const highlightid = ref(route.query.highlight as string | null);
const tracklistElem = ref<HTMLElement | null>(null); const tracklistElem = ref<HTMLElement | null>(null);
const { width, height } = useElementSize(tracklistElem); const { width, height } = useElementSize(tracklistElem);
@@ -79,38 +76,6 @@ const brk = {
const isSmall = computed(() => width.value < brk.sm); const isSmall = computed(() => width.value < brk.sm);
const isMedium = computed(() => width.value > brk.sm && width.value < brk.md); const isMedium = computed(() => width.value > brk.sm && width.value < brk.md);
function highlightTrack(t_hash: string) {
focusElem(`track-${t_hash}`, 500, "center");
}
function resetHighlight() {
setTimeout(() => {
highlightid.value = null;
}, 1000);
}
onBeforeRouteUpdate(async (to, from) => {
const h_hash = to.query.highlight as string;
highlightid.value = h_hash as string;
if (h_hash) {
highlightTrack(h_hash);
}
});
onUpdated(() => {
if (highlightid.value) {
highlightTrack(highlightid.value);
resetHighlight();
}
});
onMounted(() => {
if (highlightid.value) {
highlightTrack(highlightid.value);
resetHighlight();
}
});
/** /**
* Plays a clicked track and updates the queue * Plays a clicked track and updates the queue
* *
@@ -54,8 +54,8 @@ const props = defineProps<{
top: 0; top: 0;
background-image: linear-gradient( background-image: linear-gradient(
to top, to top,
rgba(22, 22, 22, 0.507), rgba(0, 0, 0, 0.753),
transparent 50% transparent 60%
); );
height: 100%; height: 100%;
width: 100%; width: 100%;
+2 -10
View File
@@ -1,14 +1,7 @@
<template> <template>
<div <div
class="songlist-item" class="songlist-item"
:class="[ :class="[{ current: isCurrent }, { contexton: context_on }]"
{ current: isCurrent },
{ contexton: context_on },
{
highlighted: isHighlighted,
},
]"
v-bind:class="`track-${track.hash}`"
@dblclick="emitUpdate(track)" @dblclick="emitUpdate(track)"
@contextmenu.prevent="showMenu" @contextmenu.prevent="showMenu"
> >
@@ -31,7 +24,7 @@
<div class="title ellip" @click="emitUpdate(track)"> <div class="title ellip" @click="emitUpdate(track)">
{{ track.title }} {{ track.title }}
</div> </div>
<div class="isSmallArtists" style="display: none;"> <div class="isSmallArtists" style="display: none">
<ArtistName <ArtistName
:artists="track.artists" :artists="track.artists"
:albumartist="track.albumartist" :albumartist="track.albumartist"
@@ -86,7 +79,6 @@ const props = defineProps<{
index?: number; index?: number;
isPlaying: Boolean; isPlaying: Boolean;
isCurrent: Boolean; isCurrent: Boolean;
isHighlighted: Boolean;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
+2 -2
View File
@@ -5,7 +5,8 @@ import { Option } from "../interfaces";
import Router from "../router"; import Router from "../router";
import { import {
addTrackToPlaylist, getAllPlaylists addTrackToPlaylist,
getAllPlaylists,
} from "../composables/fetch/playlists"; } from "../composables/fetch/playlists";
import useModalStore from "../stores/modal"; import useModalStore from "../stores/modal";
@@ -92,7 +93,6 @@ export default async (
Router.push({ Router.push({
name: "FolderView", name: "FolderView",
params: { path: track.folder }, params: { path: track.folder },
query: { highlight: track.hash },
}); });
}, },
icon: "folder", icon: "folder",