🔷 some refactors

This commit is contained in:
geoffrey45
2022-04-08 06:48:39 +03:00
parent b61a0a7eeb
commit 6cd982c8ee
9 changed files with 66 additions and 69 deletions
-15
View File
@@ -59,21 +59,6 @@ a {
display: none; display: none;
} }
button {
border: none;
outline: none;
color: inherit;
font-size: 1rem;
cursor: pointer;
display: flex;
align-items: center;
background-color: $blue;
border-radius: $small;
&:hover {
background-color: $red !important;
}
}
.l-container { .l-container {
display: grid; display: grid;
+31 -40
View File
@@ -1,25 +1,24 @@
<template> <template>
<div class="album-h"> <div class="album-h">
<div class="a-header rounded"> <div class="a-header rounded">
<div <div class="art">
class="image art shadow-lg rounded" <div
:style="{ class="image shadow-lg"
backgroundImage: `url(&quot;${props.album.image}&quot;)`, :style="{
}" backgroundImage: `url(&quot;${props.album.image}&quot;)`,
></div> }"
></div>
</div>
<div class="info"> <div class="info">
<div class="top"> <div class="top">
<div class="h">Album</div> <div class="h">Album</div>
<div class="separator no-border"></div> <div class="title ellip">{{ props.album.album }}</div>
<div class="title">{{ props.album.album }}</div>
<div class="artist">{{ props.album.artist }}</div>
</div> </div>
<div class="separator no-border"></div>
<div class="bottom"> <div class="bottom">
<div class="stats shadow-sm"> <div class="stats">
{{ props.album.count }} Tracks {{ props.album.count }} Tracks
{{ perks.formatSeconds(props.album.duration, "long") }} {{ perks.formatSeconds(props.album.duration, "long") }}
{{ props.album.date }} {{ props.album.date }} {{ props.album.artist }}
</div> </div>
<PlayBtnRect :source="playSources.album" /> <PlayBtnRect :source="playSources.album" />
</div> </div>
@@ -40,56 +39,51 @@ const props = defineProps<{
<style lang="scss"> <style lang="scss">
.album-h { .album-h {
height: 14rem; height: 16rem;
} }
.a-header { .a-header {
position: relative; display: grid;
display: flex; grid-template-columns: 13rem 1fr;
align-items: center;
padding: 1rem; padding: 1rem;
height: 100%; height: 100%;
background-color: $gray4; background-color: $gray4;
background-image: linear-gradient( background-image: linear-gradient(37deg, $black 20%, $gray5, $black 90%);
to bottom,
$gray3 0%,
$gray3 25%,
$gray3 35%,
$gray4 50%,
$gray 75%,
$black 100%
);
.art { .art {
position: absolute; width: 100%;
width: 12rem; height: 100%;
height: 12rem;
left: 1rem; left: 1rem;
display: flex;
align-items: flex-end;
.image {
width: 12rem;
height: 12rem;
}
} }
.info { .info {
width: 100%; width: 100%;
height: calc(100%);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: flex-end; justify-content: flex-end;
margin-left: 13rem;
.top { .top {
.h { .h {
color: #ffffffcb; color: #ffffffcb;
} }
.title { .title {
font-size: 2rem; font-size: 2.5rem;
font-weight: 1000; font-weight: 1000;
color: white; color: white;
text-transform: capitalize; text-transform: capitalize;
} }
.artist { .artist {
margin-top: $small; font-size: 1.15rem;
font-size: 1.5rem; color: #ffffffe0;
color: #fffffff1;
} }
} }
@@ -98,16 +92,13 @@ const props = defineProps<{
} }
.bottom { .bottom {
position: relative; margin-top: $smaller;
.stats { .stats {
background-color: $red;
padding: $small;
border-radius: $small; border-radius: $small;
position: absolute;
right: 0;
bottom: 0;
font-weight: bold; font-weight: bold;
font-size: 0.8rem;
margin-bottom: 0.75rem;
} }
.play { .play {
+3
View File
@@ -84,6 +84,9 @@ function updateQueue(track: Track) {
overflow-y: auto; overflow-y: auto;
.current { .current {
a {
color: inherit;
}
color: $red; color: $red;
} }
+4 -4
View File
@@ -1,7 +1,6 @@
<template> <template>
<div class="up-next"> <div class="up-next">
<div class="r-grid"> <div class="r-grid">
<PlayingFrom :from="queue.from" />
<UpNext :next="queue.next" :playNext="queue.playNext" /> <UpNext :next="queue.next" :playNext="queue.playNext" />
<div class="scrollable-r border rounded"> <div class="scrollable-r border rounded">
<TrackItem <TrackItem
@@ -13,6 +12,7 @@
:isPlaying="queue.playing" :isPlaying="queue.playing"
/> />
</div> </div>
<PlayingFrom :from="queue.from" />
</div> </div>
</div> </div>
</template> </template>
@@ -33,7 +33,7 @@ function playThis(track: Track) {
<style lang="scss"> <style lang="scss">
.up-next { .up-next {
padding: $small $small $small 0; padding: $small $small 0 0;
overflow: hidden; overflow: hidden;
height: 100%; height: 100%;
@@ -46,13 +46,13 @@ function playThis(track: Track) {
position: relative; position: relative;
height: 100%; height: 100%;
display: grid; display: grid;
grid-template-rows: max-content max-content 1fr; grid-template-rows: max-content 1fr max-content;
gap: $small;
.scrollable-r { .scrollable-r {
height: 100%; height: 100%;
padding: $small; padding: $small;
overflow: auto; overflow: auto;
// background-color: $card-dark;
scrollbar-color: grey transparent; scrollbar-color: grey transparent;
} }
} }
@@ -103,7 +103,6 @@ function goTo() {
background: linear-gradient(-200deg, $gray4 40%, $red, $gray4); background: linear-gradient(-200deg, $gray4 40%, $red, $gray4);
background-size: 120%; background-size: 120%;
padding: 0.75rem; padding: 0.75rem;
margin-bottom: $small;
cursor: pointer; cursor: pointer;
position: relative; position: relative;
transition: all .2s ease; transition: all .2s ease;
@@ -115,7 +114,7 @@ function goTo() {
.abs { .abs {
position: absolute; position: absolute;
right: $small; right: $small;
top: $small; bottom: $small;
font-size: .9rem; font-size: .9rem;
background-color: $gray; background-color: $gray;
padding: $smaller; padding: $smaller;
+2 -3
View File
@@ -1,6 +1,6 @@
<template> <template>
<div class="main-item border" @click="playNext"> <div class="main-item border" @click="playNext">
<div class="h">#Up_Next</div> <div class="h">Up Next</div>
<div class="itemx shadow"> <div class="itemx shadow">
<div <div
class="album-art image" class="album-art image"
@@ -34,7 +34,6 @@ const props = defineProps<{
<style lang="scss"> <style lang="scss">
.main-item { .main-item {
border-radius: 0.5rem; border-radius: 0.5rem;
margin-bottom: 0.5rem;
position: relative; position: relative;
&:hover { &:hover {
@@ -49,7 +48,7 @@ const props = defineProps<{
.h { .h {
position: absolute; position: absolute;
right: $small; right: $small;
top: $small; bottom: $small;
font-size: 0.9rem; font-size: 0.9rem;
background-color: $accent; background-color: $accent;
padding: $smaller; padding: $smaller;
+20 -1
View File
@@ -60,7 +60,6 @@ async function getAllPlaylists(): Promise<Playlist[]> {
async function addTrackToPlaylist(playlist: Playlist, track: Track) { async function addTrackToPlaylist(playlist: Playlist, track: Track) {
const uri = `${state.settings.uri}/playlist/${playlist.playlistid}/add`; const uri = `${state.settings.uri}/playlist/${playlist.playlistid}/add`;
console.log(track.trackid, playlist.playlistid);
await axios await axios
.post(uri, { track: track.trackid }) .post(uri, { track: track.trackid })
@@ -114,10 +113,30 @@ async function getPlaylist(pid: string) {
return playlist; return playlist;
} }
async function updatePlaylist(pid: string, playlist: FormData, pStore: any) {
const uri = state.settings.uri + "/playlist/" + pid + "/update";
await axios
.put(uri, playlist, {
headers: {
"Content-Type": "multipart/form-data",
},
})
.then((res) => {
pStore.updatePInfo(res.data.data);
new Notification("Playlist updated!");
})
.catch((err) => {
new Notification("Something funny happened!", NotifType.Error);
throw new Error(err);
});
}
export { export {
createNewPlaylist, createNewPlaylist,
getAllPlaylists, getAllPlaylists,
addTrackToPlaylist, addTrackToPlaylist,
getPTracks, getPTracks,
getPlaylist, getPlaylist,
updatePlaylist,
}; };
+3 -2
View File
@@ -52,10 +52,11 @@ interface Playlist {
playlistid: string; playlistid: string;
name: string; name: string;
description?: string; description?: string;
image?: string; image?: string | FormData;
tracks?: Track[]; tracks?: Track[];
count?: number; count?: number;
lastUpdated?: number; lastUpdated?: string;
color?: string;
} }
interface Notif { interface Notif {
+2 -2
View File
@@ -25,8 +25,8 @@ const pStore = usePStore();
.grid { .grid {
display: grid; display: grid;
grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
gap: 1rem; gap: $small;
} }
} }
</style> </style>