mirror of
https://codeberg.org/SafeTwitch/safetwitch.git
synced 2024-12-22 13:22:58 -05:00
UI fix and following page
This commit is contained in:
parent
d52bd9c193
commit
c386cd9b5c
2 changed files with 15 additions and 17 deletions
|
@ -98,24 +98,22 @@ export function getTimeFromQuery(query: string) {
|
||||||
* @returns the streamers in that list that are online
|
* @returns the streamers in that list that are online
|
||||||
*/
|
*/
|
||||||
export async function followersStreaming(streamers: string[]): Promise<string[]> {
|
export async function followersStreaming(streamers: string[]): Promise<string[]> {
|
||||||
const payload = {
|
|
||||||
streamers: streamers
|
|
||||||
}
|
|
||||||
|
|
||||||
// do not make request if no followers
|
// do not make request if no followers
|
||||||
if (streamers.length == 0) {
|
if (streamers.length == 0) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
const data: StreamerData[] = await postEndpoint('api/users/followingStreamer/bulk', payload)
|
let data: string[] = []
|
||||||
|
const payload = {
|
||||||
const liveStreamers: string[] = []
|
streamers
|
||||||
|
|
||||||
for (const streamer of data) {
|
|
||||||
if (streamer.isLive) {
|
|
||||||
liveStreamers.push(streamer.login)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return liveStreamers
|
await postEndpoint('api/users/isLive/bulk', payload)
|
||||||
|
.then((res: string[]) => {
|
||||||
|
data = res
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return data
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,8 +71,6 @@ export default {
|
||||||
async mounted() {
|
async mounted() {
|
||||||
window.onscroll = this.getNextCategory
|
window.onscroll = this.getNextCategory
|
||||||
|
|
||||||
this.following = await followersStreaming(getFollows())
|
|
||||||
|
|
||||||
// get discover page
|
// get discover page
|
||||||
await getEndpoint('api/discover')
|
await getEndpoint('api/discover')
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
@ -81,6 +79,8 @@ export default {
|
||||||
.then((data: CategoryPreviewInterface[]) => {
|
.then((data: CategoryPreviewInterface[]) => {
|
||||||
this.data = data
|
this.data = data
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.following = await followersStreaming(getFollows())
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
StreamPreviewVue,
|
StreamPreviewVue,
|
||||||
|
@ -96,10 +96,10 @@ export default {
|
||||||
<error-message v-else-if="status == 'error'"></error-message>
|
<error-message v-else-if="status == 'error'"></error-message>
|
||||||
|
|
||||||
<div v-else-if="data" class="max-w-5xl mx-auto">
|
<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>
|
<h1 class="font-bold text-5xl">Following</h1>
|
||||||
<p class="text-xl">Streamers you follow</p>
|
<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">
|
<li v-for="streamer in following" :key="streamer" class="inline-block">
|
||||||
<stream-preview-vue :name="streamer"></stream-preview-vue>
|
<stream-preview-vue :name="streamer"></stream-preview-vue>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in a new issue