mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 13:03:02 +00:00
clean components
This commit is contained in:
committed by
Mungai Njoroge
parent
74ea700d93
commit
d4f54a21b4
@@ -40,11 +40,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useElementSize, useVirtualList } from "@vueuse/core";
|
|
||||||
import { computed, ref } from "vue";
|
import { computed, ref } from "vue";
|
||||||
|
import { useElementSize, useVirtualList } from "@vueuse/core";
|
||||||
|
|
||||||
import { Track } from "@/interfaces";
|
import { Track } from "@/interfaces";
|
||||||
import useQStore from "@/stores/queue";
|
import useQStore from "@/stores/queue";
|
||||||
|
|
||||||
import SongItem from "@/components/shared/SongItem.vue";
|
import SongItem from "@/components/shared/SongItem.vue";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
|||||||
@@ -14,11 +14,18 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Track } from "@/interfaces";
|
// @stores
|
||||||
import SongList from "@/components/FolderView/SongList.vue";
|
|
||||||
import useQueueStore from "@/stores/queue";
|
import useQueueStore from "@/stores/queue";
|
||||||
import useAlbumStore from "@/stores/pages/album";
|
import useAlbumStore from "@/stores/pages/album";
|
||||||
|
|
||||||
|
// @utils
|
||||||
|
import { Track } from "@/interfaces";
|
||||||
|
|
||||||
|
// @components
|
||||||
|
import SongList from "@/components/FolderView/SongList.vue";
|
||||||
|
|
||||||
|
// @setup
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
discs: {
|
discs: {
|
||||||
[key: string]: Track[];
|
[key: string]: Track[];
|
||||||
|
|||||||
@@ -7,20 +7,33 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import useAStore from "@/stores/pages/album";
|
// @libs
|
||||||
import {
|
import {
|
||||||
onBeforeRouteLeave,
|
onBeforeRouteLeave,
|
||||||
onBeforeRouteUpdate,
|
onBeforeRouteUpdate,
|
||||||
RouteLocationNormalized,
|
RouteLocationNormalized,
|
||||||
} from "vue-router";
|
} from "vue-router";
|
||||||
|
|
||||||
|
// @stores
|
||||||
|
import useQueueStore from "@/stores/queue";
|
||||||
|
import useAStore from "@/stores/pages/album";
|
||||||
|
|
||||||
|
// @components
|
||||||
import Header from "./Header.vue";
|
import Header from "./Header.vue";
|
||||||
import Layout from "@/layouts/HeaderAndVList.vue";
|
import Layout from "@/layouts/HeaderAndVList.vue";
|
||||||
import useQueueStore from "@/stores/queue";
|
|
||||||
|
|
||||||
|
// @vars
|
||||||
const album = useAStore();
|
const album = useAStore();
|
||||||
const queue = useQueueStore();
|
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) => {
|
onBeforeRouteUpdate(async (to: RouteLocationNormalized) => {
|
||||||
await album
|
await album
|
||||||
.fetchTracksAndArtists(to.params.hash.toString())
|
.fetchTracksAndArtists(to.params.hash.toString())
|
||||||
@@ -32,10 +45,4 @@ onBeforeRouteLeave(() => {
|
|||||||
album.resetQuery();
|
album.resetQuery();
|
||||||
}, 500);
|
}, 500);
|
||||||
});
|
});
|
||||||
|
|
||||||
function playFromAlbum(index: number) {
|
|
||||||
const { title, artist, hash } = album.info;
|
|
||||||
queue.playFromAlbum(title, artist, hash, album.allTracks);
|
|
||||||
queue.play(index);
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user