clean components

This commit is contained in:
geoffrey45
2022-09-21 15:09:51 +03:00
committed by Mungai Njoroge
parent 74ea700d93
commit d4f54a21b4
3 changed files with 26 additions and 11 deletions
+2 -1
View File
@@ -40,11 +40,12 @@
</template>
<script setup lang="ts">
import { useElementSize, useVirtualList } from "@vueuse/core";
import { computed, ref } from "vue";
import { useElementSize, useVirtualList } from "@vueuse/core";
import { Track } from "@/interfaces";
import useQStore from "@/stores/queue";
import SongItem from "@/components/shared/SongItem.vue";
const props = defineProps<{
+9 -2
View File
@@ -14,11 +14,18 @@
</template>
<script setup lang="ts">
import { Track } from "@/interfaces";
import SongList from "@/components/FolderView/SongList.vue";
// @stores
import useQueueStore from "@/stores/queue";
import useAlbumStore from "@/stores/pages/album";
// @utils
import { Track } from "@/interfaces";
// @components
import SongList from "@/components/FolderView/SongList.vue";
// @setup
const props = defineProps<{
discs: {
[key: string]: Track[];
+15 -8
View File
@@ -7,20 +7,33 @@
</template>
<script setup lang="ts">
import useAStore from "@/stores/pages/album";
// @libs
import {
onBeforeRouteLeave,
onBeforeRouteUpdate,
RouteLocationNormalized,
} from "vue-router";
// @stores
import useQueueStore from "@/stores/queue";
import useAStore from "@/stores/pages/album";
// @components
import Header from "./Header.vue";
import Layout from "@/layouts/HeaderAndVList.vue";
import useQueueStore from "@/stores/queue";
// @vars
const album = useAStore();
const queue = useQueueStore();
// @methods
function playFromAlbum(index: number) {
const { title, artist, hash } = album.info;
queue.playFromAlbum(title, artist, hash, album.allTracks);
queue.play(index);
}
// @hooks
onBeforeRouteUpdate(async (to: RouteLocationNormalized) => {
await album
.fetchTracksAndArtists(to.params.hash.toString())
@@ -32,10 +45,4 @@ onBeforeRouteLeave(() => {
album.resetQuery();
}, 500);
});
function playFromAlbum(index: number) {
const { title, artist, hash } = album.info;
queue.playFromAlbum(title, artist, hash, album.allTracks);
queue.play(index);
}
</script>