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) => {
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;
document.getElementById("acontent")?.scrollTo(0, 0);
+7 -7
View File
@@ -10,7 +10,7 @@
@updateQueue="updateQueue"
:isPlaying="queue.playing"
:isCurrent="queue.currentid == track.trackid"
:isHighlighted="highlightid == track.trackid"
:isHighlighted="highlightid == track.uniq_hash"
/>
</div>
</div>
@@ -46,16 +46,16 @@ const route = useRoute();
const routename = route.name as string;
const highlightid = ref(route.query.highlight as string);
function highlightTrack(trackid: string) {
focusElem(`track-${trackid}`, 400, "center");
function highlightTrack(t_hash: string) {
focusElem(`track-${t_hash}`, 500, "center");
}
onBeforeRouteUpdate(async (to, from) => {
const hid = to.query.highlight as string;
highlightid.value = hid as string;
const h_hash = to.query.highlight as string;
highlightid.value = h_hash as string;
if (hid) {
highlightTrack(hid as string);
if (h_hash) {
highlightTrack(h_hash);
}
});
+1 -1
View File
@@ -8,7 +8,7 @@
highlighted: isHighlighted,
},
]"
v-bind:class="`track-${track.trackid}`"
v-bind:class="`track-${track.uniq_hash}`"
@dblclick="emitUpdate(track)"
@contextmenu="showContextMenu"
>
+1 -1
View File
@@ -90,7 +90,7 @@ export default async (
Router.push({
name: "FolderView",
params: { path: track.folder },
query: { highlight: track.trackid },
query: { highlight: track.uniq_hash },
});
},
icon: "folder",
+2 -1
View File
@@ -16,6 +16,7 @@ export interface Track {
tracknumber?: number;
disknumber?: number;
index?: number;
uniq_hash: string;
}
export interface Folder {
@@ -64,7 +65,7 @@ export interface Playlist {
count?: number;
lastUpdated?: string;
thumb?: string;
duration?: number
duration?: number;
}
export interface Notif {