2023-03-19 19:51:55 -04:00
|
|
|
<script lang="ts">
|
|
|
|
import { useRoute } from 'vue-router'
|
|
|
|
|
2023-03-24 18:48:45 -04:00
|
|
|
export default {
|
2023-03-19 19:51:55 -04:00
|
|
|
async setup() {
|
|
|
|
const route = useRoute()
|
|
|
|
const game = route.params.game
|
2023-03-24 18:48:45 -04:00
|
|
|
const res = await fetch(`${import.meta.env.VITE_BACKEND_URL}/api/discover/${game}`)
|
|
|
|
const data = await res.json()
|
|
|
|
let frontend_url = import.meta.env.VITE_INSTANCE_URL
|
2023-03-19 19:51:55 -04:00
|
|
|
return {
|
2023-03-24 18:48:45 -04:00
|
|
|
data,
|
|
|
|
frontend_url
|
2023-03-19 19:51:55 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
abbreviate(text: number) {
|
2023-03-24 18:48:45 -04:00
|
|
|
return Intl.NumberFormat('en-US', {
|
|
|
|
//@ts-ignore
|
|
|
|
notation: 'compact',
|
|
|
|
maximumFractionDigits: 1
|
|
|
|
}).format(text)
|
2023-03-19 19:51:55 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="flex flex-col max-w-5xl mx-auto">
|
|
|
|
<div class="flex space-x-4 p-3">
|
2023-03-24 18:48:45 -04:00
|
|
|
<img :src="data.cover" class="self-start rounded-md" />
|
2023-03-19 19:51:55 -04:00
|
|
|
|
2023-03-24 18:48:45 -04:00
|
|
|
<div>
|
|
|
|
<h1 class="font-bold text-5xl text-white">{{ data.name }}</h1>
|
|
|
|
<div class="inline-flex my-1 space-x-3">
|
|
|
|
<p class="font-bold text-white text-lg">Followers: {{ abbreviate(data.followers) }}</p>
|
|
|
|
<p class="font-bold text-white text-lg">Viewers: {{ abbreviate(data.viewers) }}</p>
|
2023-03-19 19:51:55 -04:00
|
|
|
</div>
|
|
|
|
|
2023-03-24 18:48:45 -04:00
|
|
|
<ul class="mb-5">
|
|
|
|
<li v-for="tag in data.tags" :key="tag" class="inline-flex">
|
|
|
|
<span class="text-white p-1 py-0.5 mr-1 text-sm font-bold bg-ctp-overlay1 rounded-sm">{{
|
|
|
|
tag
|
|
|
|
}}</span>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<p class="text-md text-gray-400 overflow-y-auto">{{ data.description }}</p>
|
|
|
|
</div>
|
2023-03-19 19:51:55 -04:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="max-w-[58rem] mx-auto">
|
2023-03-24 18:48:45 -04:00
|
|
|
<ul>
|
|
|
|
<li
|
|
|
|
v-for="stream in data.streams"
|
|
|
|
:key="stream"
|
|
|
|
class="inline-flex m-2 hover:scale-105 transition-transform"
|
|
|
|
>
|
|
|
|
<div class="bg-ctp-crust rounded-lg">
|
|
|
|
<a :href="`${frontend_url}/${stream.streamer.name}`">
|
|
|
|
<img :src="stream.preview" class="rounded-lg rounded-b-none" />
|
|
|
|
</a>
|
2023-03-19 19:51:55 -04:00
|
|
|
|
2023-03-24 18:48:45 -04:00
|
|
|
<div class="text-white p-2 inline-flex space-x-2 w-full">
|
|
|
|
<div class="inline-flex w-full">
|
|
|
|
<div class="inline-flex">
|
|
|
|
<img :src="stream.streamer.pfp" class="rounded-full mr-2" />
|
|
|
|
<div>
|
|
|
|
<p class="font-bold w-[22.9rem] truncate">{{ stream.title }}</p>
|
|
|
|
<div class="inline-flex w-full justify-between">
|
|
|
|
<p class="text-gray-300">{{ stream.streamer.name }}</p>
|
|
|
|
<p class="self-end float-right">
|
|
|
|
<v-icon name="io-person"></v-icon> {{ abbreviate(stream.viewers) }}
|
|
|
|
</p>
|
2023-03-19 19:51:55 -04:00
|
|
|
</div>
|
2023-03-24 18:48:45 -04:00
|
|
|
</div>
|
2023-03-19 19:51:55 -04:00
|
|
|
</div>
|
2023-03-24 18:48:45 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2023-03-19 19:51:55 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|