UI fix and following page

This commit is contained in:
dragongoose 2024-01-01 15:17:06 -05:00
parent d52bd9c193
commit c386cd9b5c
No known key found for this signature in database
GPG key ID: 01397EEC371CDAA5
2 changed files with 15 additions and 17 deletions

View file

@ -98,24 +98,22 @@ export function getTimeFromQuery(query: string) {
* @returns the streamers in that list that are online
*/
export async function followersStreaming(streamers: string[]): Promise<string[]> {
const payload = {
streamers: streamers
}
// do not make request if no followers
if (streamers.length == 0) {
return []
}
const data: StreamerData[] = await postEndpoint('api/users/followingStreamer/bulk', payload)
const liveStreamers: string[] = []
for (const streamer of data) {
if (streamer.isLive) {
liveStreamers.push(streamer.login)
}
let data: string[] = []
const payload = {
streamers
}
return liveStreamers
await postEndpoint('api/users/isLive/bulk', payload)
.then((res: string[]) => {
data = res
})
return data
}

View file

@ -71,8 +71,6 @@ export default {
async mounted() {
window.onscroll = this.getNextCategory
this.following = await followersStreaming(getFollows())
// get discover page
await getEndpoint('api/discover')
.catch(() => {
@ -81,6 +79,8 @@ export default {
.then((data: CategoryPreviewInterface[]) => {
this.data = data
})
this.following = await followersStreaming(getFollows())
},
components: {
StreamPreviewVue,
@ -96,10 +96,10 @@ export default {
<error-message v-else-if="status == 'error'"></error-message>
<div v-else-if="data" class="max-w-5xl mx-auto">
<div v-if="following && following.length > 0" class="p-2 text-white">
<div v-if="following && following.length > 0" class="p-2 text-white w-[100vw]">
<h1 class="font-bold text-5xl">Following</h1>
<p class="text-xl">Streamers you follow</p>
<ul class="flex flex-wrap justify-begin overflow-x-scroll space-x-2 mt-1 h-[19rem] items-center">
<ul class="flex flex-nowrap justify-begin overflow-x-scroll overflow-y-hidden space-x-2 mt-1 h-[19rem] items-center">
<li v-for="streamer in following" :key="streamer" class="inline-block">
<stream-preview-vue :name="streamer"></stream-preview-vue>
</li>