Lay foundations for fully implementing the info cards
This commit is contained in:
parent
0b8f169a02
commit
eebb319357
4 changed files with 84 additions and 7 deletions
|
|
@ -5,16 +5,34 @@
|
||||||
:preview="preview_mode"
|
:preview="preview_mode"
|
||||||
:api_url="api_base"
|
:api_url="api_base"
|
||||||
:token="get_token()"
|
:token="get_token()"
|
||||||
|
:data_exists="data.length !== 0"
|
||||||
@playlist_export="handle_export"
|
@playlist_export="handle_export"
|
||||||
@data_request="get_data"
|
@data_request="get_data"
|
||||||
/>
|
/>
|
||||||
<div v-if="error" class="error">{{ error }}</div>
|
<div v-if="error" class="error">{{ error }}</div>
|
||||||
|
<div v-else id="data_view">
|
||||||
|
<span
|
||||||
|
v-for="item in data"
|
||||||
|
:key="item.uri"
|
||||||
|
>
|
||||||
|
<Track
|
||||||
|
v-if="item.type === 'track'"
|
||||||
|
:item="item"/>
|
||||||
|
<Artist
|
||||||
|
v-else-if="item.type === 'artist'"
|
||||||
|
:item="item"/>
|
||||||
|
<Unknown v-else :item="item"/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as axios from "axios";
|
import * as axios from "axios";
|
||||||
import ControlCard from "./ControlBar.vue";
|
import ControlCard from "./ControlBar.vue";
|
||||||
|
import ArtistCard from "./cards/Artist.vue";
|
||||||
|
import TrackCard from "./cards/Track.vue";
|
||||||
|
import UnknownTypeCard from "./cards/UnknownType.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: `MainView`,
|
name: `MainView`,
|
||||||
|
|
@ -23,7 +41,10 @@ export default {
|
||||||
dev_mode: Boolean,
|
dev_mode: Boolean,
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
Control: ControlCard
|
Control: ControlCard,
|
||||||
|
Track: TrackCard,
|
||||||
|
Artist: ArtistCard,
|
||||||
|
Unknown: UnknownTypeCard,
|
||||||
},
|
},
|
||||||
data() { return {
|
data() { return {
|
||||||
data: [],
|
data: [],
|
||||||
|
|
@ -40,8 +61,6 @@ export default {
|
||||||
console.log("Handling the export");
|
console.log("Handling the export");
|
||||||
},
|
},
|
||||||
get_data(config) {
|
get_data(config) {
|
||||||
console.log("Fetching data from Spotify")
|
|
||||||
console.log(config)
|
|
||||||
let url = `${this.api_base}/me/top/${config.type.toLowerCase()}`;
|
let url = `${this.api_base}/me/top/${config.type.toLowerCase()}`;
|
||||||
|
|
||||||
let limit = parseInt(config.count) || 10;
|
let limit = parseInt(config.count) || 10;
|
||||||
|
|
@ -62,6 +81,34 @@ export default {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style scoped>
|
||||||
|
#data_view {
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin: 0 auto;
|
||||||
|
display: flex;
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
background-color: var(--card-colour);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
color: var(--card-text);
|
||||||
|
padding: 20px 10px 10px;
|
||||||
|
flex-direction: column;
|
||||||
|
border-style: none;
|
||||||
|
position: relative;
|
||||||
|
margin: 5px auto;
|
||||||
|
display: flex;
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@media only screen and (min-width: 768px) {
|
||||||
|
.card {
|
||||||
|
width: 230px;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -1,11 +1,22 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="card"></div>
|
<div class="card">
|
||||||
|
<div class="image"></div>
|
||||||
|
<div class="track-info"></div>
|
||||||
|
<div class="popularity bottom left corner"></div>
|
||||||
|
<div class="followers bottom right corner"></div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: `ArtistCard`,
|
name: `ArtistCard`,
|
||||||
components: {},
|
components: {},
|
||||||
|
props: {
|
||||||
|
item: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
}
|
||||||
|
},
|
||||||
data() { return {};},
|
data() { return {};},
|
||||||
computed: {},
|
computed: {},
|
||||||
methods: {}
|
methods: {}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,22 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="card"></div>
|
<div class="card">
|
||||||
|
<div class="image"></div>
|
||||||
|
<div class="track-info"></div>
|
||||||
|
<div class="popularity bottom left corner"></div>
|
||||||
|
<div class="duration bottom right corner"></div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: `TrackCard`,
|
name: `TrackCard`,
|
||||||
components: {},
|
components: {},
|
||||||
|
props: {
|
||||||
|
item: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
}
|
||||||
|
},
|
||||||
data() { return {};},
|
data() { return {};},
|
||||||
computed: {},
|
computed: {},
|
||||||
methods: {}
|
methods: {}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,19 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="card"></div>
|
<div class="card">
|
||||||
|
Unknown Type: {{ item.type }}
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: `UnknownTypeCard`,
|
name: `UnknownTypeCard`,
|
||||||
components: {},
|
components: {},
|
||||||
|
props: {
|
||||||
|
item: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
}
|
||||||
|
},
|
||||||
data() { return {};},
|
data() { return {};},
|
||||||
computed: {},
|
computed: {},
|
||||||
methods: {}
|
methods: {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue