made stuff nicer a bit

This commit is contained in:
Pünkösd Marcell 2020-11-26 21:53:32 +01:00
parent 9dc4a1a25c
commit 4c7f0cc58d
4 changed files with 38 additions and 6 deletions

View File

@ -1,9 +1,15 @@
<template> <template>
<b-col class="my-3" cols="12" md="6"> <b-col class="my-3" cols="12" md="6">
<b-card :title="title"> <b-card>
<template slot="header">
<h4>
<b-icon :icon="typeIcon"/>&nbsp;{{ title }}
</h4>
</template>
<b-button class="float-right" @click="performClick">Open</b-button> <b-button class="float-right" @click="performClick">Open</b-button>
<div class="float-left"> <div class="float-left">
Tracks: {{ count }} <p><b>Items:</b> {{ count }}</p>
<p><b>Type:</b> {{ type | capitalize }}</p>
</div> </div>
</b-card> </b-card>
</b-col> </b-col>
@ -14,12 +20,36 @@ export default {
name: "CollectionsListElement", name: "CollectionsListElement",
props: { props: {
title: String, title: String,
count: Number count: Number,
type: String
}, },
methods: { methods: {
performClick() { performClick() {
this.$emit('click'); this.$emit('click');
} }
},
computed: {
typeIcon() {
switch (this.type) {
case "work":
return "pencil-fill";
case "artist":
return "person-fill";
case "recording":
return "music-note";
case "release":
return "folder2";
default:
return "play-fill";
}
}
},
filters: {
capitalize(value) {
if (!value) return ''
value = value.toString()
return value.charAt(0).toUpperCase() + value.slice(1)
}
} }
} }
</script> </script>

View File

@ -20,7 +20,7 @@
<template #cell(id)="data"> <template #cell(id)="data">
<div class="text-right"> <div class="text-right">
<b-button variant="success" :disabled="!data.item.spotify_id" @click="startPlayer(data.item.spotify_id)"> <b-button variant="success" :disabled="!data.item.spotify_id" @click="startPlayer(data.item.spotify_id)">
Play <b-icon icon="play-fill"/> Play
</b-button> </b-button>
</div> </div>
</template> </template>

View File

@ -7,7 +7,8 @@
</b-row> </b-row>
<big-chungus-loader text="Fetching collections..." v-if="processing"/> <big-chungus-loader text="Fetching collections..." v-if="processing"/>
<b-row v-else> <b-row v-else>
<collections-list-element :title="c.name" :count="c.element_count" @click="openCollection(c.id)" :key="c.id" v-for="c in collections"/> <collections-list-element :title="c.name" :count="c.element_count" :type="c.type" @click="openCollection(c.id)"
:key="c.id" v-for="c in collections"/>
</b-row> </b-row>
</b-container> </b-container>
</template> </template>
@ -41,6 +42,7 @@ export default {
}).catch(({text}) => { }).catch(({text}) => {
this.$showToast(text); this.$showToast(text);
}); });
} }
} }
</script> </script>

View File

@ -23,7 +23,7 @@
</div> </div>
<div class="my-3"> <div class="my-3">
<b-button :disabled="!songInfo.spotify_id" :href="spotifyLink" target="_blank">Open on Spotify!</b-button>&nbsp; <b-button :disabled="!songInfo.spotify_id" :href="spotifyLink" target="_blank">Open on Spotify!</b-button>&nbsp;
<b-button variant="success" :disabled="!songInfo.spotify_id" @click="startPlayer">Play!</b-button> <b-button variant="success" :disabled="!songInfo.spotify_id" @click="startPlayer"><b-icon icon="play-fill"/> Play!</b-button>
</div> </div>
</b-col> </b-col>