rewrite highlight track to use track.uniq_hash instead of trackid

This commit is contained in:
geoffrey45
2022-07-10 22:10:09 +03:00
parent 7e3243272f
commit e538b0d4d7
5 changed files with 13 additions and 12 deletions
+2 -2
View File
@@ -62,9 +62,9 @@ function removeHighlight(route: RouteLocationNormalized) {
} }
router.afterEach((to, from) => { router.afterEach((to, from) => {
const hid = to.query.highlight as string; const h_hash = to.query.highlight as string;
if (hid) removeHighlight(to); if (h_hash) removeHighlight(to);
if (isSameRoute(to, from)) return; if (isSameRoute(to, from)) return;
document.getElementById("acontent")?.scrollTo(0, 0); document.getElementById("acontent")?.scrollTo(0, 0);
+7 -7
View File
@@ -10,7 +10,7 @@
@updateQueue="updateQueue" @updateQueue="updateQueue"
:isPlaying="queue.playing" :isPlaying="queue.playing"
:isCurrent="queue.currentid == track.trackid" :isCurrent="queue.currentid == track.trackid"
:isHighlighted="highlightid == track.trackid" :isHighlighted="highlightid == track.uniq_hash"
/> />
</div> </div>
</div> </div>
@@ -46,16 +46,16 @@ const route = useRoute();
const routename = route.name as string; const routename = route.name as string;
const highlightid = ref(route.query.highlight as string); const highlightid = ref(route.query.highlight as string);
function highlightTrack(trackid: string) { function highlightTrack(t_hash: string) {
focusElem(`track-${trackid}`, 400, "center"); focusElem(`track-${t_hash}`, 500, "center");
} }
onBeforeRouteUpdate(async (to, from) => { onBeforeRouteUpdate(async (to, from) => {
const hid = to.query.highlight as string; const h_hash = to.query.highlight as string;
highlightid.value = hid as string; highlightid.value = h_hash as string;
if (hid) { if (h_hash) {
highlightTrack(hid as string); highlightTrack(h_hash);
} }
}); });
+1 -1
View File
@@ -8,7 +8,7 @@
highlighted: isHighlighted, highlighted: isHighlighted,
}, },
]" ]"
v-bind:class="`track-${track.trackid}`" v-bind:class="`track-${track.uniq_hash}`"
@dblclick="emitUpdate(track)" @dblclick="emitUpdate(track)"
@contextmenu="showContextMenu" @contextmenu="showContextMenu"
> >
+1 -1
View File
@@ -90,7 +90,7 @@ export default async (
Router.push({ Router.push({
name: "FolderView", name: "FolderView",
params: { path: track.folder }, params: { path: track.folder },
query: { highlight: track.trackid }, query: { highlight: track.uniq_hash },
}); });
}, },
icon: "folder", icon: "folder",
+2 -1
View File
@@ -16,6 +16,7 @@ export interface Track {
tracknumber?: number; tracknumber?: number;
disknumber?: number; disknumber?: number;
index?: number; index?: number;
uniq_hash: string;
} }
export interface Folder { export interface Folder {
@@ -64,7 +65,7 @@ export interface Playlist {
count?: number; count?: number;
lastUpdated?: string; lastUpdated?: string;
thumb?: string; thumb?: string;
duration?: number duration?: number;
} }
export interface Notif { export interface Notif {