diff --git a/src/components/shared/AlbumCard.vue b/src/components/shared/AlbumCard.vue index b472425..318858f 100644 --- a/src/components/shared/AlbumCard.vue +++ b/src/components/shared/AlbumCard.vue @@ -18,31 +18,45 @@ }" >
- - + +

{{ album.title }}

-
{{ album.albumartists[0].name }}
+
+ + {{ album.albumartists[0].name }} + +
diff --git a/src/components/shared/PlayBtn.vue b/src/components/shared/PlayBtn.vue index 4dc48fa..41dd431 100644 --- a/src/components/shared/PlayBtn.vue +++ b/src/components/shared/PlayBtn.vue @@ -1,8 +1,5 @@ @@ -16,12 +13,29 @@ import { playSources } from "@/composables/enums"; import usePlayFrom from "@/composables/usePlayFrom"; import PlaySvg from "../../assets/icons/play.svg"; +import { playFromAlbumCard } from "@/composables/usePlayFrom"; -defineProps<{ +const props = defineProps<{ source: playSources; + albumHash?: string; + albumName?: string; store: typeof useAlbumStore | typeof usePlaylistStore; - color: string; }>(); + +function handlePlay() { + switch (props.source) { + case playSources.album: + playFromAlbumCard( + useQStore, + props.albumHash || "", + props.albumName || "" + ); + break; + + default: + break; + } +} diff --git a/src/composables/useKeyboard.ts b/src/composables/useKeyboard.ts index f876ea9..cb1e5bf 100644 --- a/src/composables/useKeyboard.ts +++ b/src/composables/useKeyboard.ts @@ -15,8 +15,9 @@ export default function (queue: typeof useQStore) { const q = queue(); window.addEventListener("keydown", (e: KeyboardEvent) => { const target = e.target as HTMLElement; - // if alt is pressed, don't do anything if (e.altKey) return; + if (e.shiftKey) return; + let ctrlKey = e.ctrlKey; function FocusedOnInput(target: HTMLElement) { diff --git a/src/composables/usePlayFrom.ts b/src/composables/usePlayFrom.ts index 99dcb2d..eebf5bf 100644 --- a/src/composables/usePlayFrom.ts +++ b/src/composables/usePlayFrom.ts @@ -1,11 +1,15 @@ import { playSources } from "@/composables/enums"; + import useAStore from "@/stores/pages/album"; import useArtistPageStore from "@/stores/pages/artist"; import useFStore from "@/stores/pages/folder"; import usePStore from "@/stores/pages/playlist"; import useQStore from "@/stores/queue"; import useSettingsStore from "@/stores/settings"; +import { useNotifStore } from "@/stores/notification"; + import { getArtistTracks } from "./fetch/artists"; +import { getAlbumTracks } from "./fetch/album"; const queue = useQStore; const folder = useFStore; @@ -86,4 +90,16 @@ async function utilPlayFromArtist( qu.play(index); } -export { utilPlayFromArtist }; +async function playFromAlbumCard( + queue: typeof useQStore, + albumhash: string, + albumname: string +) { + const qu = queue(); + + const tracks = await getAlbumTracks(albumhash, useNotifStore); + qu.playFromAlbum(albumname, albumhash, tracks.tracks); + qu.play(); +} + +export { utilPlayFromArtist, playFromAlbumCard };