Clean up Album and Box view
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Artem Anufrij 2023-02-12 23:03:19 +01:00
parent 268e913663
commit a71bbf8dc7
4 changed files with 157 additions and 235 deletions

View File

@ -98,7 +98,7 @@ td.fillCell>* {
bottom: -16px; bottom: -16px;
position: absolute; position: absolute;
filter: blur(8px); filter: blur(8px);
opacity: 0.75; opacity: 0.5;
} }
/* /*

View File

@ -7,7 +7,7 @@
--dark50: #31363b80; --dark50: #31363b80;
--dark25: #31363b40; --dark25: #31363b40;
--shadow: #23262940; --shadow: #23262940;
--glow: #eff0f140; --glow: #eff0f180;
--light-gray: #d9dfe3; --light-gray: #d9dfe3;
--dim-gray: #bdc3c7; --dim-gray: #bdc3c7;
@ -1231,41 +1231,15 @@ td.strech {
margin-left: 12px; margin-left: 12px;
} }
.ma-horizontal { .ma-horizontal {
margin-right: 12px; margin: 0 12px;
margin-left: 12px;
} }
.ma-vertical { .ma-vertical {
margin-top: 12px; margin: 12px 0;
margin-bottom: 12px;
} }
.ma { .ma {
margin: 12px; margin: 12px;
} }
.ma8-top {
margin-top: 8px;
}
.ma8-bottom {
margin-bottom: 8px;
}
.ma8-right {
margin-right: 8px;
}
.ma8-left {
margin-left: 8px;
}
.ma8-vertical {
margin-top: 8px;
margin-bottom: 8px;
}
.ma8-horizontal {
margin-right: 8px;
margin-left: 8px;
}
.ma8 {
margin: 8px;
}
.ma4-top { .ma4-top {
margin-top: 4px; margin-top: 4px;
} }
@ -1279,17 +1253,59 @@ td.strech {
margin-left: 4px; margin-left: 4px;
} }
.ma4-vertical { .ma4-vertical {
margin-top: 4px; margin: 4px 0;
margin-bottom: 4px;
} }
.ma4-horizontal { .ma4-horizontal {
margin-right: 4px; margin: 0 4px;
margin-left: 4px;
} }
.ma4 { .ma4 {
margin: 4px; margin: 4px;
} }
.ma8-top {
margin-top: 8px;
}
.ma8-bottom {
margin-bottom: 8px;
}
.ma8-right {
margin-right: 8px;
}
.ma8-left {
margin-left: 8px;
}
.ma8-vertical {
margin: 8px 0;
}
.ma8-horizontal {
margin: 0 8px;
}
.ma8 {
margin: 8px;
}
.ma24-top {
margin-top: 24px;
}
.ma24-bottom {
margin-bottom: 24px;
}
.ma24-right {
margin-right: 24px;
}
.ma24-left {
margin-left: 24px;
}
.ma24-vertical {
margin: 24px 0;
}
.ma24-horizontal {
margin: 0 24px;
}
.ma24 {
margin: 24px;
}
/* /*
OPACITY OPACITY
*/ */
@ -1397,6 +1413,28 @@ td.strech {
padding-bottom: 12px; padding-bottom: 12px;
} }
.pa24 {
padding: 24px;
}
.pa24-vertical {
padding: 24px 0;
}
.pa24-horizontal {
padding: 0 24px;
}
.pa24-left {
padding-left: 24px;
}
.pa24-rigth {
padding-right: 24px;
}
.pa24-top {
padding-top: 24px;
}
.pa24-bottom {
padding-bottom: 24px;
}
.border { .border {
border: 1px solid var(--dark-border); border: 1px solid var(--dark-border);
} }

View File

@ -3,33 +3,15 @@
ref="dialogWindow" ref="dialogWindow"
:title="album_title" :title="album_title"
@canceled="closed" @canceled="closed"
@opened="opened"
:showFooter="false" :showFooter="false"
:disableXscroll="true" :disableXscroll="true"
:disableYscroll="true" :disableYscroll="true"
> >
<div id="albumViewer"> <div id="albumViewer" class="flex-row">
<div id="header" class="flex-column"> <div id="header" class="flex-column">
<div id="background" :style="coverBackground" /> <div id="background" :style="coverBackground" />
<div class="grow z1 center flex-column">
<div id="albumList" class="flex-row z1" @scroll="loadingAlbums()"> <img class="glow ma24" :src="cover" @dblclick="dblclick" />
<div class="dummyAlbum" />
<div id="loadPrevAlbums" />
<AlbumItem
v-for="album in albums"
:key="album._id"
:item="album"
class="ma"
:class="{ focus: album._id == selectedAlbum._id }"
:id="album._id"
@touchend="albumAutoSelect"
@click="selectAlbum(album)"
@dblclick="dblclick"
/>
<div id="loadNextAlbums" />
<div class="dummyAlbum" />
</div> </div>
<awesome-icon <awesome-icon
icon="star" icon="star"
@ -38,9 +20,9 @@
:class="{ active: isFavourite }" :class="{ active: isFavourite }"
@click="toggleFavourite" @click="toggleFavourite"
/> />
<div id="stats" class="flex-row grow z1 pa4-bottom"> <div id="stats" class="flex-row z1">
<DropDown v-if="$store.getters['user/isAdministrator']"> <DropDown v-if="$store.getters['user/isAdministrator']">
<button class="flat pa8-left pa8-right" :title="visibility_text"> <button class="flat center" :title="visibility_text">
<awesome-icon :icon="visibility_icon" /> <awesome-icon :icon="visibility_icon" />
</button> </button>
<template v-slot:dropdown-content> <template v-slot:dropdown-content>
@ -57,22 +39,25 @@
</div> </div>
</template> </template>
</DropDown> </DropDown>
<div class="grow flex-column">
<span class="grow center" @click="scrollIntoCenter(selectedAlbum)"> <p class="ma4 center">
<b>{{ album_title }}</b> by <span class="grow center">
<b @click="gotoArtist" class="pointer">{{ by
selectedAlbum.artist_name <b @click="gotoArtist" class="pointer">{{
}}</b> selectedAlbum.artist_name
<br /> }}</b>
<span v-if="album_year"> <br />
from year <b>{{ album_year }}</b> </span <span v-if="album_year">
><br /> from year <b>{{ album_year }}</b> </span
<b>{{ album_tracks.length }}</b> Tracks with a duration of ><br />
<b>{{ album_duration }}</b> <b>{{ album_tracks.length }}</b> Tracks with a duration of
</span> <b>{{ album_duration }}</b>
</span>
</p>
</div>
<DropDown v-if="$store.getters['user/isAdministrator']"> <DropDown v-if="$store.getters['user/isAdministrator']">
<button class="flat pa8-left pa8-right"> <button class="flat center">
<awesome-icon icon="ellipsis-v" /> <awesome-icon icon="ellipsis-v" />
</button> </button>
<template v-slot:dropdown-content> <template v-slot:dropdown-content>
@ -125,41 +110,6 @@ export default {
} }
}, },
methods: { methods: {
albumAutoSelect() {
this.albums.forEach((album) => {
let center_client = document.documentElement.clientWidth / 2;
let e = document.getElementById(album._id);
let r = e.getBoundingClientRect();
let center_element = center_client - r.left - r.width / 2;
if (center_element < this.move / 2 && center_element > -this.move / 2) {
if (album._id == this.selectedAlbum._id) {
this.scrollIntoCenter(album, "smooth");
} else {
this.selectAlbum(album);
}
}
});
},
readElements() {
if (document.getElementById("header") == undefined) {
return false;
}
this.elements.prev = document
.getElementById("loadPrevAlbums")
.getBoundingClientRect();
this.elements.next = document
.getElementById("loadNextAlbums")
.getBoundingClientRect();
this.elements.header = document
.getElementById("header")
.getBoundingClientRect();
this.elements.albums = document.getElementById("albumList");
return true;
},
dblclick() { dblclick() {
this.$store.commit("tracks/resetSelectedTrack"); this.$store.commit("tracks/resetSelectedTrack");
this.$store.commit("radios/resetSelectedRadio"); this.$store.commit("radios/resetSelectedRadio");
@ -180,16 +130,10 @@ export default {
} }
}, },
gotoNextAlbum() { gotoNextAlbum() {
let i = this.albums.indexOf(this.selectedAlbum); this.$store.dispatch("albums/gotoNextAlbum");
if (i < this.albums.length - 1) {
this.selectAlbum(this.albums[++i]);
}
}, },
gotoPrevAlbum() { gotoPrevAlbum() {
let i = this.albums.indexOf(this.selectedAlbum); this.$store.dispatch("albums/gotoPrevAlbum");
if (i > 0) {
this.selectAlbum(this.albums[--i]);
}
}, },
gotoTrack() { gotoTrack() {
if (this.$route.query.play) { if (this.$route.query.play) {
@ -216,66 +160,16 @@ export default {
keydownListener(e) { keydownListener(e) {
if (e.key == "ArrowLeft") { if (e.key == "ArrowLeft") {
e.preventDefault(); e.preventDefault();
this.elements.albums.scrollLeft -= 0;
this.gotoPrevAlbum(); this.gotoPrevAlbum();
} }
if (e.key == "ArrowRight") { if (e.key == "ArrowRight") {
e.preventDefault(); e.preventDefault();
this.elements.albums.scrollLeft += 0;
this.gotoNextAlbum(); this.gotoNextAlbum();
} }
}, },
loadingAlbums() {
clearTimeout(this.scrollTimer);
if (!this.readElements()) {
return;
}
let posPrev = this.elements.prev.left - this.elements.header.left;
let posNext = this.elements.header.right - this.elements.next.right;
if (posPrev >= -this.move && !this.loadingPrev) {
this.loadingPrev = true;
this.$store
.dispatch("albums/getPrevTo", this.albums[0])
.then((album) => {
if (album) {
this.albums.unshift(album);
this.elements.albums.scrollLeft += this.move;
}
this.loadingPrev = false;
});
} else if (posPrev < -this.move * 3 && !this.loadingPrev) {
this.loadingPrev = true;
this.elements.albums.scrollLeft -= this.move;
this.albums.shift();
this.loadingPrev = false;
}
if (posNext >= -this.move && !this.loadingNext) {
this.loadingNext = true;
this.$store
.dispatch("albums/getNextTo", this.albums[this.albums.length - 1])
.then((album) => {
if (album) {
this.albums.push(album);
}
this.loadingNext = false;
});
} else if (posNext < -this.move * 3 && !this.loadingNext) {
this.loadingNext = true;
this.albums.pop();
this.loadingNext = false;
}
},
mergeAlbum() { mergeAlbum() {
this.$refs.mergeDialog.open(this.selectedAlbum); this.$refs.mergeDialog.open(this.selectedAlbum);
}, },
opened() {
this.$nextTick(() => {
this.scrollIntoCenter(this.selectedAlbum);
});
},
setVisibility(visibility) { setVisibility(visibility) {
this.selectedAlbum.visibility = visibility; this.selectedAlbum.visibility = visibility;
this.$store.dispatch("albums/updateAlbum", this.selectedAlbum); this.$store.dispatch("albums/updateAlbum", this.selectedAlbum);
@ -310,15 +204,8 @@ export default {
? "Hide this Album" ? "Hide this Album"
: "Only for me"; : "Only for me";
}, },
scrollIntoCenter(album, behavior = "auto") {
let e = document.getElementById(album._id);
if (e) {
e.scrollIntoView({ behavior: behavior, inline: "center" });
}
},
selectAlbum(album) { selectAlbum(album) {
this.$store.dispatch("albums/selectAlbum", album); this.$store.dispatch("albums/selectAlbum", album);
this.scrollIntoCenter(album);
}, },
}, },
computed: { computed: {
@ -367,7 +254,6 @@ export default {
seconds seconds
); );
}, },
coverBackground() { coverBackground() {
return "background-image: url('" + this.cover + "')"; return "background-image: url('" + this.cover + "')";
}, },
@ -376,7 +262,6 @@ export default {
this.selectedAlbum.covers.cover256 || "/static/icons/dummy/album.svg" this.selectedAlbum.covers.cover256 || "/static/icons/dummy/album.svg"
); );
}, },
visibility_icon() { visibility_icon() {
return this.selectedAlbum.visibility == "global" return this.selectedAlbum.visibility == "global"
? "globe" ? "globe"
@ -430,30 +315,16 @@ export default {
<style scoped> <style scoped>
#albumViewer { #albumViewer {
display: flex; height: 366px;
flex-direction: column; width: 640px;
height: 100%;
}
#albumList {
overflow-x: overlay;
max-width: 100%;
align-self: center;
}
#albumList::-webkit-scrollbar {
display: none;
} }
#header { #header {
position: relative; position: relative;
min-width: 280px; background-color: black;
width: 456px;
background: black;
} }
#header img { #header img {
align-self: center; align-self: center;
} width: 256px;
#navigation {
width: 456px;
overflow: auto;
} }
#stats { #stats {
z-index: 2; z-index: 2;
@ -464,31 +335,32 @@ export default {
border-top: 1px solid #ffffff20; border-top: 1px solid #ffffff20;
border-bottom: 1px solid #00000020; border-bottom: 1px solid #00000020;
} }
#stats button {
width: 32px;
}
#trackList { #trackList {
height: 360px;
width: 456px;
background-color: var(--white); background-color: var(--white);
z-index: 1; z-index: 1;
} }
.album { @media (max-width: 480px) {
transition: transform 0.25s;
}
.album.focus {
transform: scale(1.1);
}
.dummyAlbum {
min-width: 160px;
}
@media (max-width: 480px), (max-height: 480px) {
#header { #header {
width: 100%; width: 100%;
} }
#albumViewer {
flex-direction: column;
}
}
@media (max-width: 480px), (max-height: 480px) {
#albumViewer {
width: 100%;
height: 100%;
}
#trackList { #trackList {
height: initial; height: initial;
width: 100%; flex-grow: 1;
}
.dummyAlbum {
min-width: 128px;
} }
} }
</style> </style>

View File

@ -8,9 +8,12 @@
:disableXscroll="true" :disableXscroll="true"
:disableYscroll="true" :disableYscroll="true"
> >
<div id="boxViewer"> <div id="boxViewer" class="flex-row">
<div id="header" class="flex-column"> <div id="header" class="flex-column">
<div id="background" :style="coverBackground" /> <div id="background" :style="coverBackground" />
<div class="grow z1 center flex-column">
<img class="glow ma24" :src="cover" @dblclick="dblclick" />
</div>
<awesome-icon <awesome-icon
icon="star" icon="star"
size="2x" size="2x"
@ -18,16 +21,10 @@
:class="{ active: isFavourite }" :class="{ active: isFavourite }"
@click="toggleFavourite" @click="toggleFavourite"
/> />
<div id="navigation" class="flex-row grow center z1">
<img class="glow ma" :src="cover" @dblclick="dblclick" />
</div>
<div id="stats" class="z1 pa4"> <div id="stats" class="z1 pa4">
<div class="flex-row"> <div class="flex-row">
<DropDown v-if="$store.getters['user/isAdministrator']"> <DropDown v-if="$store.getters['user/isAdministrator']">
<button <button class="flat center" :title="visibility_text">
class="flat ma4 pa8-left pa8-right"
:title="visibility_text"
>
<awesome-icon :icon="visibility_icon" /> <awesome-icon :icon="visibility_icon" />
</button> </button>
<template v-slot:dropdown-content> <template v-slot:dropdown-content>
@ -44,13 +41,17 @@
</div> </div>
</template> </template>
</DropDown> </DropDown>
<span class="grow center"> <div class="grow flex-column">
<b>{{ selectedBox.title }}</b> <p class="ma4 center">
<br /> <span class="">
<b>{{ box_videos.length }}</b> Videos <b>{{ selectedBox.title }}</b>
</span> <br />
<b>{{ box_videos.length }}</b> Videos
</span>
</p>
</div>
<DropDown v-if="$store.getters['user/isAdministrator']"> <DropDown v-if="$store.getters['user/isAdministrator']">
<button class="flat ma4 pa8-left pa8-right"> <button class="flat center">
<awesome-icon icon="ellipsis-v" /> <awesome-icon icon="ellipsis-v" />
</button> </button>
<template v-slot:dropdown-content> <template v-slot:dropdown-content>
@ -242,19 +243,19 @@ export default {
<style scoped> <style scoped>
#boxViewer { #boxViewer {
display: flex; height: 462px;
flex-direction: row;
height: 100%;
overflow: hidden;
} }
#header { #header {
position: relative; position: relative;
min-width: 280px;
background-color: black; background-color: black;
} }
#header img {
align-self: center;
width: 256px;
}
#videoList { #videoList {
height: 440px;
background-color: var(--white); background-color: var(--white);
z-index: 1; z-index: 1;
overflow: overlay; overflow: overlay;
@ -270,6 +271,14 @@ export default {
border-bottom: 1px solid #00000020; border-bottom: 1px solid #00000020;
} }
#stats button {
width: 32px;
}
#stats p {
max-width: 192px;
align-self: center;
}
.video { .video {
width: 220px; width: 220px;
} }
@ -278,24 +287,27 @@ export default {
#boxViewer { #boxViewer {
flex-direction: column; flex-direction: column;
} }
#stats p {
max-width: initial;
}
} }
@media (max-width: 480px), (max-height: 480px) { @media (max-width: 480px), (max-height: 480px) {
#boxViewer {
width: 100%;
height: 100%;
}
#header img {
width: 192px;
}
#videoList { #videoList {
max-height: initial;
height: initial; height: initial;
flex-grow: 1;
} }
.video { .video {
width: initial; width: initial;
} }
#navigation img{
height: 220px;
}
} }
@media (max-height: 480px) { @media (max-height: 480px) {
#navigation {
align-items: center;
}
} }
</style> </style>