Merge - fix search and add correct image path for album card (#52)

This commit is contained in:
Mungai Geoffrey
2022-05-04 03:17:43 +03:00
committed by GitHub
parent e05c4602b0
commit d6a01cd35e
4 changed files with 30 additions and 18 deletions
+4 -1
View File
@@ -1,9 +1,12 @@
""" """
Contains all the album routes. Contains all the album routes.
""" """
from typing import List
from app import api from app import api
from app import functions from app import functions
from app import helpers from app import helpers
from app import models
from app.lib import albumslib from app.lib import albumslib
from app.lib import trackslib from app.lib import trackslib
from flask import Blueprint from flask import Blueprint
@@ -71,7 +74,7 @@ def get_albumartists():
album = data["album"] album = data["album"]
artist = data["artist"] artist = data["artist"]
tracks = [] tracks: List[models.Track] = []
for track in api.TRACKS: for track in api.TRACKS:
if track.album == album and track.albumartist == artist: if track.album == album and track.albumartist == artist:
+2 -2
View File
@@ -99,7 +99,7 @@ def use_memoji():
Returns a path to a random memoji image. Returns a path to a random memoji image.
""" """
path = str(random.randint(0, 20)) + ".svg" path = str(random.randint(0, 20)) + ".svg"
return settings.IMG_ARTIST_URI + "defaults/" + path return "defaults/" + path
def check_artist_image(image: str) -> str: def check_artist_image(image: str) -> str:
@@ -112,7 +112,7 @@ def check_artist_image(image: str) -> str:
img_name)): img_name)):
return use_memoji() return use_memoji()
else: else:
return (settings.IMG_ARTIST_URI + img_name, ) return img_name
class Timer: class Timer:
+11 -7
View File
@@ -2,7 +2,7 @@
<router-link <router-link
:to="{ :to="{
name: 'AlbumView', name: 'AlbumView',
params: { album: album.album, artist: album.artist }, params: { album: album.title, artist: album.artist },
}" }"
class="result-item" class="result-item"
> >
@@ -10,20 +10,24 @@
<div <div
class="album-art image" class="album-art image"
:style="{ :style="{
backgroundImage: `url(&quot;${album.image}&quot;)`, backgroundImage: `url(&quot;${imguri + album.image}&quot;)`,
}" }"
></div> ></div>
<div class="play shadow-lg image"></div> <div class="play shadow-lg image"></div>
</div> </div>
<div class="title ellip">{{ album.album }}</div> <div class="title ellip">{{ album.title }}</div>
<div class="artistsx ellipsis">{{ album.artist }}</div> <div class="artistsx ellipsis">{{ album.artist }}</div>
</router-link> </router-link>
</template> </template>
<script> <script setup lang="ts">
export default { import { AlbumInfo } from "../../interfaces";
props: ["album"], import { paths } from "../../config";
};
const imguri = paths.images.thumb;
defineProps<{
album: AlbumInfo;
}>();
</script> </script>
<style lang="scss"> <style lang="scss">
+13 -8
View File
@@ -2,7 +2,7 @@
<div class="xartist" :style="{ backgroundColor: `#${color}` }"> <div class="xartist" :style="{ backgroundColor: `#${color}` }">
<div <div
class="artist-image image border-sm" class="artist-image image border-sm"
:style="{ backgroundImage: `url('${artist.image}')` }" :style="{ backgroundImage: `url('${imguri + artist.image}')` }"
></div> ></div>
<div> <div>
<p class="artist-name ellipsis">{{ artist.name }}</p> <p class="artist-name ellipsis">{{ artist.name }}</p>
@@ -10,10 +10,16 @@
</div> </div>
</template> </template>
<script> <script setup lang="ts">
export default { import { paths } from "../../config";
props: ["artist", "color"],
}; const imguri = paths.images.artist;
defineProps<{
artist: any;
color: string;
}>();
</script> </script>
<style lang="scss"> <style lang="scss">
@@ -24,14 +30,13 @@ export default {
min-width: 8.25em; min-width: 8.25em;
height: 11em; height: 11em;
border-radius: .75rem; border-radius: 0.75rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
cursor: pointer; cursor: pointer;
.artist-image { .artist-image {
width: 7em; width: 7em;
height: 7em; height: 7em;
@@ -41,7 +46,7 @@ export default {
background-position: center; background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
transition: all 0.5s ease-in-out; transition: all 0.5s ease-in-out;
transition-delay: .25s; transition-delay: 0.25s;
} }
&:hover { &:hover {