move master flag into component

This commit is contained in:
geoffrey45 2022-12-24 14:38:08 +03:00 committed by Mungai Njoroge
parent c7cc687286
commit 58d4317ab8
10 changed files with 4115 additions and 2397 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
.DS_Store .DS_Store
node_modules node_modules
/dist /dist
.yarn*
# local env files # local env files

View File

@ -18,7 +18,7 @@
<div class="creator t-center"> <div class="creator t-center">
Designed and developed by Designed and developed by
<span class="name" <span class="name"
><a href="https://github.com/geoffrey45">Geoffrey Mungai</a> ><a href="https://github.com/geoffrey45">Mungai Njoroge</a>
</span> </span>
</div> </div>
</div> </div>

View File

@ -4,6 +4,7 @@
:class="{ :class="{
hide_play: header_shown, hide_play: header_shown,
}" }"
v-if="album.info.albumhash"
> >
<div class="first grid"> <div class="first grid">
<PlayBtn :source="things.source" :store="things.store" /> <PlayBtn :source="things.source" :store="things.store" />
@ -30,6 +31,9 @@ defineProps<{
header_shown: boolean; header_shown: boolean;
}>(); }>();
const album = useAlbumStore();
const playlist = usePStore();
const things = computed(() => { const things = computed(() => {
const route = useRoute(); const route = useRoute();
let thing = { let thing = {

View File

@ -0,0 +1,15 @@
<template>
<span class="master-flag" title="Master audio file">M</span>
</template>
<style lang="scss">
.master-flag {
font-size: 10px;
margin-left: $smaller;
background-color: rgba(184, 108, 21, 0.281);
color: rgb(255, 153, 0);
padding: 2px 5px;
border-radius: 5px;
opacity: 0.75;
}
</style>

View File

@ -32,7 +32,7 @@
<span class="title ellip" ref="artisttitle"> <span class="title ellip" ref="artisttitle">
{{ track.title }} {{ track.title }}
</span> </span>
<span v-if="track.bitrate > 1024" class="master-flag"><b>M</b> </span> <MasterFlag v-if="track.bitrate > 1024" />
</div> </div>
<div class="isSmallArtists" style="display: none"> <div class="isSmallArtists" style="display: none">
<ArtistName <ArtistName
@ -86,6 +86,8 @@ import useQueueStore from "@/stores/queue";
import { addFavorite, removeFavorite } from "@/composables/fetch/favorite"; import { addFavorite, removeFavorite } from "@/composables/fetch/favorite";
import { favType } from "@/composables/enums"; import { favType } from "@/composables/enums";
import MasterFlag from "./MasterFlag.vue";
const imguri = paths.images.thumb.small; const imguri = paths.images.thumb.small;
const context_menu_showing = ref(false); const context_menu_showing = ref(false);
const queue = useQueueStore(); const queue = useQueueStore();
@ -156,16 +158,6 @@ async function addToFav(trackhash: string) {
align-items: center; align-items: center;
} }
.master-flag {
font-size: 10px;
margin-left: $smaller;
background-color: rgba(184, 108, 21, 0.281);
color: rgb(255, 153, 0);
padding: 2px 5px;
border-radius: 5px;
opacity: 0.75;
}
cursor: pointer; cursor: pointer;
.title { .title {

View File

@ -25,10 +25,6 @@ const getAlbumData = async (hash: string, ToastStore: typeof useNotifStore) => {
if (status == 204) { if (status == 204) {
ToastStore().showNotification("Album not created yet!", NotifType.Error); ToastStore().showNotification("Album not created yet!", NotifType.Error);
return {
info: {} as Album,
tracks: [],
};
} }
return data as AlbumData; return data as AlbumData;

View File

@ -1,3 +1,4 @@
import { NotifType, useNotifStore } from "@/stores/notification";
import { paths } from "@/config"; import { paths } from "@/config";
import useAxios from "./useAxios"; import useAxios from "./useAxios";
import { Artist, Track, Album } from "@/interfaces"; import { Artist, Track, Album } from "@/interfaces";
@ -8,11 +9,15 @@ const getArtistData = async (hash: string, limit: number = 5) => {
tracks: Track[]; tracks: Track[];
} }
const { data, error } = await useAxios({ const { data, error, status } = await useAxios({
get: true, get: true,
url: paths.api.artist + `/${hash}?limit=${limit}`, url: paths.api.artist + `/${hash}?limit=${limit}`,
}); });
if (status == 404) {
useNotifStore().showNotification("Artist not found", NotifType.Error);
}
if (error) { if (error) {
console.error(error); console.error(error);
} }

View File

@ -7,7 +7,7 @@ export interface D<T = string> {
const domains: D = { const domains: D = {
local: "http://localhost:", local: "http://localhost:",
remote: "http://10.10.219.196:", remote: "http://192.168.100.25:",
}; };
const ports = { const ports = {

View File

@ -6,11 +6,10 @@ import { AlbumDisc } from "./../../interfaces";
import { FuseTrackOptions } from "@/composables/enums"; import { FuseTrackOptions } from "@/composables/enums";
import { maxAbumCards } from "@/stores/content-width"; import { maxAbumCards } from "@/stores/content-width";
import { import { getAlbum, getAlbumsFromArtist } from "../../composables/fetch/album";
getAlbum, getAlbumsFromArtist
} from "../../composables/fetch/album";
import { Album, FuseResult, Track } from "../../interfaces"; import { Album, FuseResult, Track } from "../../interfaces";
import { useNotifStore } from "../notification"; import { useNotifStore } from "../notification";
import router from "@/router";
interface Disc { interface Disc {
[key: string]: Track[]; [key: string]: Track[];
@ -62,6 +61,7 @@ export default defineStore("album", {
*/ */
async fetchTracksAndArtists(hash: string) { async fetchTracksAndArtists(hash: string) {
const album = await getAlbum(hash, useNotifStore); const album = await getAlbum(hash, useNotifStore);
this.rawTracks = album.tracks; this.rawTracks = album.tracks;
this.info = album.info; this.info = album.info;
}, },

6457
yarn.lock

File diff suppressed because it is too large Load Diff