new looks
This commit is contained in:
19
nginx/vue/src/components/api/Login.vue
Normal file
19
nginx/vue/src/components/api/Login.vue
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<template>
|
||||||
|
<div v-if="loggedIn">
|
||||||
|
<h1>login</h1>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { ref, onMounted } from "vue";
|
||||||
|
export default {
|
||||||
|
name: "api-login",
|
||||||
|
setup() {
|
||||||
|
const loggedIn = ref(false);
|
||||||
|
onMounted(() => {
|
||||||
|
loggedIn.value = true;
|
||||||
|
});
|
||||||
|
return { loggedIn };
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
32
nginx/vue/src/components/api/Posts.vue
Normal file
32
nginx/vue/src/components/api/Posts.vue
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<template>
|
||||||
|
<!-- Input post display -->
|
||||||
|
<div v-if="posting"></div>
|
||||||
|
<!-- View post display -->
|
||||||
|
<div v-else>
|
||||||
|
<div v-for="(post, idx) in posts" :key="post.id || idx">
|
||||||
|
<h1>post info</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { ref, onMounted } from "vue";
|
||||||
|
export default {
|
||||||
|
name: "api-posts",
|
||||||
|
setup() {
|
||||||
|
const posting = ref(false);
|
||||||
|
const posts = ref([]);
|
||||||
|
|
||||||
|
async function fetchRecent() {}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
fetchRecent();
|
||||||
|
setInterval(fetchRecent, 120000);
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
posting,
|
||||||
|
posts,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<h2 class="center-content">Listening to RECENTLY</h2>
|
<h2 class="center-content">Listening to RECENTLY</h2>
|
||||||
<div class="flex-row">
|
<div v-if="fetched" class="flex-row">
|
||||||
<div
|
<div
|
||||||
|
v-if="fetched"
|
||||||
v-for="(song, idx) in played"
|
v-for="(song, idx) in played"
|
||||||
:key="song.track.id || idx"
|
:key="song.track.id || idx"
|
||||||
class="bg-white border2 shadow1"
|
class="bg-white border2 shadow1"
|
||||||
@@ -12,6 +13,20 @@
|
|||||||
<p><strong>Artist:</strong> {{ song.track.artists[0].name }}</p>
|
<p><strong>Artist:</strong> {{ song.track.artists[0].name }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else class="flex-row">
|
||||||
|
<div class="bg-white border2 shadow1 tile1">
|
||||||
|
<img src="/img/Untitled.png" />
|
||||||
|
<p>I ain't listenin to nofin rn :/</p>
|
||||||
|
</div>
|
||||||
|
<div class="bg-white border2 shadow1 tile1">
|
||||||
|
<img src="/img/Untitled.png" />
|
||||||
|
<p>I ain't listenin to nofin rn :/</p>
|
||||||
|
</div>
|
||||||
|
<div class="bg-white border2 shadow1 tile1">
|
||||||
|
<img src="/img/Untitled.png" />
|
||||||
|
<p>I ain't listenin to nofin rn :/</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -21,12 +36,14 @@ export default {
|
|||||||
name: "spotify-recent",
|
name: "spotify-recent",
|
||||||
setup() {
|
setup() {
|
||||||
const played = ref([]);
|
const played = ref([]);
|
||||||
|
const fetched = ref(false);
|
||||||
|
|
||||||
async function fetchRecent() {
|
async function fetchRecent() {
|
||||||
try {
|
try {
|
||||||
const res = await fetch("/api/spotify/recent");
|
const res = await fetch("/api/spotify/recent");
|
||||||
if (!res.ok) throw new Error("Failed to fetch Spotify data");
|
if (!res.ok) throw new Error("Failed to fetch Spotify data");
|
||||||
played.value = await res.json();
|
played.value = await res.json();
|
||||||
|
fetched.value = true;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
@@ -39,6 +56,7 @@ export default {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
played,
|
played,
|
||||||
|
fetched,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -62,5 +62,13 @@ import Radio from "@/components/Radio.vue";
|
|||||||
<div class="border1 tile1">
|
<div class="border1 tile1">
|
||||||
<SpotifyListening class="border2 bg-white shadow1 fill" />
|
<SpotifyListening class="border2 bg-white shadow1 fill" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="border1 tile1">
|
||||||
|
<Posts />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="border1 tile1">
|
||||||
|
<Login />
|
||||||
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user