mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 04:23:01 +00:00
add "go to artist" and "go to album artist" context options
+ refactor api endpoints to point to / for production
This commit is contained in:
committed by
Mungai Njoroge
parent
c52390117e
commit
4476a8ebe0
@@ -1,3 +1,3 @@
|
||||
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13.9912 22.1445C14.2197 22.1445 14.5449 21.9775 14.8086 21.8105C19.7217 18.6465 22.8682 14.9375 22.8682 11.1758C22.8682 7.9502 20.6445 5.7002 17.8408 5.7002C16.0918 5.7002 14.7822 6.66699 13.9912 8.11719C13.2178 6.67578 11.8994 5.7002 10.1504 5.7002C7.34668 5.7002 5.11426 7.9502 5.11426 11.1758C5.11426 14.9375 8.26074 18.6465 13.1738 21.8105C13.4463 21.9775 13.7715 22.1445 13.9912 22.1445Z" fill="#EB5757"/>
|
||||
<svg width="28" height="28" viewBox="0 0 28 28" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13.9912 22.1445C14.2197 22.1445 14.5449 21.9775 14.8086 21.8105C19.7217 18.6465 22.8682 14.9375 22.8682 11.1758C22.8682 7.9502 20.6445 5.7002 17.8408 5.7002C16.0918 5.7002 14.7822 6.66699 13.9912 8.11719C13.2178 6.67578 11.8994 5.7002 10.1504 5.7002C7.34668 5.7002 5.11426 7.9502 5.11426 11.1758C5.11426 14.9375 8.26074 18.6465 13.1738 21.8105C13.4463 21.9775 13.7715 22.1445 13.9912 22.1445Z"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 524 B After Width: | Height: | Size: 517 B |
@@ -1 +1 @@
|
||||
<svg fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="28px" height="28px" baseProfile="basic"><path d="M13,46h16.205c0.338,1.549,1.093,2.903,2.174,4H13c-1.104,0-2-0.895-2-2C11,46.895,11.896,46,13,46z"/><path d="M12.999,38l18.714,0c-1.142,0.918-2.077,2.195-2.486,4L13,42c-1.104,0-2-0.895-2-2C11,38.895,11.895,38,12.999,38z"/><path d="M13,30h28v4H13c-1.104,0-2-0.895-2-2C11,30.895,11.896,30,13,30z"/><path d="M13,22h28v4H13c-1.104,0-2-0.895-2-2C11,22.895,11.896,22,13,22z"/><path d="M13,14h28v4H13c-1.104,0-2-0.895-2-2C11,14.895,11.896,14,13,14z"/><path d="M54.026,9.158C54.997,8.834,56,9.557,56,10.581v7.484c0,0.829-0.511,1.572-1.286,1.868l-5.75,2.199 C48.384,22.353,48,22.911,48,23.532V39c0,8-4.083,11-8.561,11C35.026,50,32,47.754,32,44.079c0-3.39,2.07-4.633,6.224-5.553 c4.067-0.9,5.776-1.327,5.776-4.142V13.942c0-0.861,0.551-1.625,1.368-1.897L54.026,9.158z"/></svg>
|
||||
<svg fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="28px" height="28px" baseProfile="basic"><path d="M13,46h16.205c0.338,1.549,1.093,2.903,2.174,4H13c-1.104,0-2-0.895-2-2C11,46.895,11.896,46,13,46z"/><path d="M12.999,38l18.714,0c-1.142,0.918-2.077,2.195-2.486,4L13,42c-1.104,0-2-0.895-2-2C11,38.895,11.895,38,12.999,38z"/><path d="M13,30h28v4H13c-1.104,0-2-0.895-2-2C11,30.895,11.896,30,13,30z"/><path d="M13,22h28v4H13c-1.104,0-2-0.895-2-2C11,22.895,11.896,22,13,22z"/><path d="M13,14h28v4H13c-1.104,0-2-0.895-2-2C11,14.895,11.896,14,13,14z"/><path d="M54.026,9.158C54.997,8.834,56,9.557,56,10.581v7.484c0,0.829-0.511,1.572-1.286,1.868l-5.75,2.199 C48.384,22.353,48,22.911,48,23.532V39c0,8-4.083,11-8.561,11C35.026,50,32,47.754,32,44.079c0-3.39,2.07-4.633,6.224-5.553 c4.067-0.9,5.776-1.327,5.776-4.142V13.942c0-0.861,0.551-1.625,1.368-1.897L54.026,9.158z" /></svg>
|
||||
|
Before Width: | Height: | Size: 901 B After Width: | Height: | Size: 902 B |
@@ -16,7 +16,7 @@
|
||||
}"
|
||||
>
|
||||
<section class="text">
|
||||
<div class="card-title">ARTIST</div>
|
||||
<div class="card-title">Artist</div>
|
||||
<div class="artist-name">{{ artist.info.name }}</div>
|
||||
<div class="stats">
|
||||
{{ artist.info.trackcount }} Track{{
|
||||
|
||||
@@ -76,8 +76,6 @@ const menus = [
|
||||
.side-nav-container {
|
||||
text-transform: capitalize;
|
||||
margin-top: 1rem;
|
||||
// background-color: rgba(255, 255, 255, 0.075);
|
||||
// padding: $small;
|
||||
|
||||
.nav-button {
|
||||
border-radius: $medium;
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
<template>
|
||||
<div class="sidebar-playlists">
|
||||
<div class="header">your playlists</div>
|
||||
<div class="list rounded">
|
||||
<div v-for="p in pStore.playlists" class="ellip">
|
||||
<router-link
|
||||
:to="{
|
||||
name: 'PlaylistView',
|
||||
params: {
|
||||
pid: p.id,
|
||||
},
|
||||
}"
|
||||
>
|
||||
{{ p.name }}
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import usePStore from "@/stores/pages/playlists";
|
||||
import { onMounted } from "vue";
|
||||
const pStore = usePStore();
|
||||
|
||||
onMounted(() => {
|
||||
if (pStore.playlists.length == 0) {
|
||||
pStore.fetchAll();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.sidebar-playlists {
|
||||
display: grid;
|
||||
grid-template-rows: max-content 1fr;
|
||||
|
||||
.header {
|
||||
opacity: 0.5;
|
||||
margin-bottom: $small;
|
||||
margin-left: 1rem;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.list {
|
||||
padding: $small;
|
||||
|
||||
& > * {
|
||||
padding: $small;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -226,6 +226,7 @@ async function addToFav(trackhash: string) {
|
||||
align-content: center;
|
||||
transition: all 0.2s;
|
||||
transform: translateX(-1.5rem);
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-12
@@ -1,17 +1,13 @@
|
||||
// "local" | "remote"
|
||||
let mode = "local";
|
||||
// "dev" | "prod"
|
||||
let mode = "dev";
|
||||
|
||||
export interface D<T = string> {
|
||||
[key: string]: T;
|
||||
}
|
||||
|
||||
const domains: D = {
|
||||
local: "http://localhost:",
|
||||
remote: "http://192.168.100.25:",
|
||||
};
|
||||
|
||||
const ports = {
|
||||
api: 1970,
|
||||
dev: "http://localhost:1970",
|
||||
prod: "",
|
||||
};
|
||||
|
||||
const imageRoutes = {
|
||||
@@ -28,14 +24,13 @@ const imageRoutes = {
|
||||
};
|
||||
|
||||
function toggleMode() {
|
||||
mode = mode === "local" ? "remote" : "local";
|
||||
mode = mode === "dev" ? "prod" : "dev";
|
||||
}
|
||||
|
||||
const domain = () => domains[mode];
|
||||
|
||||
const baseImgUrl = domain() + ports.api + "/img";
|
||||
|
||||
const baseApiUrl = domain() + ports.api;
|
||||
const baseApiUrl = domain();
|
||||
const baseImgUrl = baseApiUrl + "/img";
|
||||
|
||||
const paths = {
|
||||
api: {
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import { Playlist, Track } from "../interfaces";
|
||||
import { Artist, Playlist, Track } from "../interfaces";
|
||||
|
||||
// @ts-ignore
|
||||
import { Option } from "../interfaces";
|
||||
import Router from "../router";
|
||||
|
||||
import {
|
||||
addTrackToPlaylist,
|
||||
getAllPlaylists
|
||||
addTrackToPlaylist,
|
||||
getAllPlaylists,
|
||||
} from "../composables/fetch/playlists";
|
||||
|
||||
import useModalStore from "../stores/modal";
|
||||
import useQueueStore from "../stores/queue";
|
||||
import { Routes } from "@/router/routes";
|
||||
/**
|
||||
* Returns a list of context menu items for a track.
|
||||
* @param {any} track a track object.
|
||||
@@ -28,6 +29,7 @@ export default async (
|
||||
};
|
||||
|
||||
const single_artist = track.artist.length === 1;
|
||||
const single_album_artist = track.albumartist.length === 1;
|
||||
|
||||
let playlists = <Option[]>[];
|
||||
const p = await getAllPlaylists();
|
||||
@@ -41,15 +43,21 @@ export default async (
|
||||
};
|
||||
});
|
||||
|
||||
const goToArtist = () => {
|
||||
if (single_artist) {
|
||||
const goToArtist = (artists: Artist[]) => {
|
||||
if (artists.length === 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return track.artist.map((artist) => {
|
||||
return artists.map((artist) => {
|
||||
return <Option>{
|
||||
label: artist,
|
||||
action: () => console.log("artist"),
|
||||
label: artist.name,
|
||||
action: () =>
|
||||
Router.push({
|
||||
name: Routes.artist,
|
||||
params: {
|
||||
hash: artist.artisthash,
|
||||
},
|
||||
}),
|
||||
};
|
||||
});
|
||||
};
|
||||
@@ -99,20 +107,35 @@ export default async (
|
||||
};
|
||||
|
||||
const go_to_artist: Option = {
|
||||
label: single_artist ? "Go to Artist" : "Go to Artists",
|
||||
label: `Go to Artist`,
|
||||
icon: "artist",
|
||||
action: () => {
|
||||
if (single_artist) {
|
||||
console.log("Go to Artist");
|
||||
}
|
||||
single_artist
|
||||
? Router.push({
|
||||
name: Routes.artist,
|
||||
params: {
|
||||
hash: track.artist[0].artisthash,
|
||||
},
|
||||
})
|
||||
: null;
|
||||
},
|
||||
children: goToArtist(),
|
||||
children: goToArtist(track.artist),
|
||||
};
|
||||
|
||||
const go_to_alb_artist: Option = {
|
||||
label: "Go to Album Artist",
|
||||
action: () => console.log("Go to Album Artist"),
|
||||
label: `Go to Album Artist`,
|
||||
action: () => {
|
||||
single_album_artist
|
||||
? Router.push({
|
||||
name: Routes.artist,
|
||||
params: {
|
||||
hash: track.albumartist[0].artisthash,
|
||||
},
|
||||
})
|
||||
: null;
|
||||
},
|
||||
icon: "artist",
|
||||
children: goToArtist(track.albumartist),
|
||||
};
|
||||
|
||||
const go_to_album: Option = {
|
||||
@@ -145,11 +168,11 @@ export default async (
|
||||
separator,
|
||||
add_to_playlist,
|
||||
separator,
|
||||
go_to_folder,
|
||||
go_to_album,
|
||||
go_to_folder,
|
||||
// add_to_fav,
|
||||
// go_to_artist,
|
||||
// go_to_alb_artist,
|
||||
go_to_artist,
|
||||
go_to_alb_artist,
|
||||
// separator,
|
||||
// del_track,
|
||||
];
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ export interface Track extends AlbumDisc {
|
||||
title: string;
|
||||
album?: string;
|
||||
artist: Artist[];
|
||||
albumartist: string;
|
||||
albumartist: Artist[];
|
||||
albumhash?: string;
|
||||
folder?: string;
|
||||
filepath?: string;
|
||||
@@ -70,7 +70,7 @@ export interface Artist {
|
||||
export interface Option {
|
||||
type?: string;
|
||||
label?: string;
|
||||
action: () => void;
|
||||
action?: () => void;
|
||||
children?: Option[] | false;
|
||||
icon?: string;
|
||||
critical?: Boolean;
|
||||
|
||||
Reference in New Issue
Block a user