diff --git a/src/components/AlbumView/Header.vue b/src/components/AlbumView/Header.vue index cb6365c..429189a 100644 --- a/src/components/AlbumView/Header.vue +++ b/src/components/AlbumView/Header.vue @@ -50,7 +50,7 @@
- +
@@ -92,14 +92,18 @@ import HeartSvg from "../shared/HeartSvg.vue"; import PlayBtnRect from "../shared/PlayBtnRect.vue"; import favoriteHandler from "@/composables/favoriteHandler"; +import { storeToRefs } from "pinia"; -const props = defineProps<{ - album: Album; -}>(); +// const props = defineProps<{ +// album: Album; +// }>(); const albumheaderthing = ref(null); const imguri = paths.images; const nav = useNavStore(); +const store = useAlbumStore(); + +const { info: album } = storeToRefs(store); defineEmits<{ (event: "playThis"): void; @@ -117,10 +121,16 @@ function handleVisibilityState(state: boolean) { useVisibility(albumheaderthing, handleVisibilityState); -const is_fav = ref(props.album.is_favorite); +// const is_fav = ref(props.album.is_favorite); function handleFav() { - favoriteHandler(is_fav, favType.album, props.album.albumhash); + favoriteHandler( + album.value.is_favorite, + favType.album, + album.value.albumhash, + store.makeFavorite, + store.removeFavorite + ); } diff --git a/src/components/ArtistView/Header.vue b/src/components/ArtistView/Header.vue index 8397efa..f67c085 100644 --- a/src/components/ArtistView/Header.vue +++ b/src/components/ArtistView/Header.vue @@ -31,7 +31,7 @@
- +
@@ -51,8 +51,6 @@ diff --git a/src/components/PlaylistView/ArtistsList.vue b/src/components/PlaylistView/ArtistsList.vue index b912ece..4f422ec 100644 --- a/src/components/PlaylistView/ArtistsList.vue +++ b/src/components/PlaylistView/ArtistsList.vue @@ -28,6 +28,8 @@ defineProps<{ display: flex; justify-content: space-between; padding-left: $medium; + align-items: center; + margin-bottom: $small; .see-all { font-size: $medium; diff --git a/src/components/nav/NavBar.vue b/src/components/nav/NavBar.vue index b9ee919..fea7f3c 100644 --- a/src/components/nav/NavBar.vue +++ b/src/components/nav/NavBar.vue @@ -4,10 +4,6 @@
- ([]); diff --git a/src/components/nav/Titles/APTitle.vue b/src/components/nav/Titles/APTitle.vue deleted file mode 100644 index 79827d0..0000000 --- a/src/components/nav/Titles/APTitle.vue +++ /dev/null @@ -1,86 +0,0 @@ - - - - - diff --git a/src/composables/favoriteHandler.ts b/src/composables/favoriteHandler.ts index a0df540..bff1b97 100644 --- a/src/composables/favoriteHandler.ts +++ b/src/composables/favoriteHandler.ts @@ -1,31 +1,25 @@ -import { Ref } from "vue"; import { favType } from "./enums"; import { addFavorite, removeFavorite } from "./fetch/favorite"; /** * Handles the favorite state of an item. - * @param flag The ref to track the is_favorite state + * @param setter The ref to track the is_favorite state * @param type The type of item * @param itemhash The hash of the item */ export default async function favoriteHandler( - flag: Ref, + flag: boolean | undefined, type: favType, - itemhash: string + itemhash: string, + setter: () => void, + remover: () => void ) { - if (flag.value) { + if (flag) { const removed = await removeFavorite(type, itemhash); - - if (removed) { - flag.value = false; - } - + if (removed) remover(); return; } const added = await addFavorite(type, itemhash); - - if (added) { - flag.value = true; - } + if (added) setter(); } diff --git a/src/stores/pages/album.ts b/src/stores/pages/album.ts index 2dd9de1..dc5f598 100644 --- a/src/stores/pages/album.ts +++ b/src/stores/pages/album.ts @@ -64,7 +64,6 @@ export default defineStore("album", { this.srcTracks.forEach((t, index) => { t.master_index = index; - console.log(t.disc, t.track); }); }, async fetchArtistAlbums() { @@ -84,6 +83,12 @@ export default defineStore("album", { resetAlbumArtists() { this.albumArtists = []; }, + makeFavorite() { + this.info.is_favorite = true; + }, + removeFavorite() { + this.info.is_favorite = false; + }, }, getters: { discs(): Disc { diff --git a/src/stores/pages/artist.ts b/src/stores/pages/artist.ts index 9323089..587f0d2 100644 --- a/src/stores/pages/artist.ts +++ b/src/stores/pages/artist.ts @@ -50,5 +50,11 @@ export default defineStore("artistPage", { this.eps = []; this.singles = []; }, + makeFavorite() { + this.info.is_favorite = true; + }, + removeFavorite() { + this.info.is_favorite = false; + }, }, }); diff --git a/src/views/AlbumView/index.vue b/src/views/AlbumView/index.vue index 98108cb..d1a6c2f 100644 --- a/src/views/AlbumView/index.vue +++ b/src/views/AlbumView/index.vue @@ -94,6 +94,7 @@ function getArtistAlbumComponents(): ScrollerItem[] { albums: ar.albums, title: `More from ${artistname}`, albumType: discographyAlbumTypes.all, + route: `/artists/${artisthash}/discography` }, size: 20 * 16, }; @@ -104,9 +105,6 @@ const scrollerItems = computed(() => { const header: ScrollerItem = { id: "album-header", component: Header, - props: { - album: album.info, - }, size: 19 * 16, };