This commit is contained in:
Korbs 2024-08-10 20:10:27 -04:00
parent 5b3b85ae8a
commit fa352ba512
3 changed files with 47 additions and 4 deletions

BIN
bun.lockb

Binary file not shown.

View file

@ -19,8 +19,6 @@ if (Astro.url.href.includes('?platform=youtube')) {var SelectedPlatform = "YouTu
else if (Astro.url.href.includes('?platform=twitch')) {var SelectedPlatform = "Twitch"}
var FullCategoryName = SearchQuery.charAt(0).toUpperCase() + SearchQuery.slice(1)
// Fetch
if (Astro.url.href.includes('?platform=youtube')) {
var PlatformYouTube = true
@ -37,7 +35,23 @@ else if (Astro.url.href.includes('?platform=twitch')) {
---
<Base Title='MinPluto'>
<center><h2><u>{FullCategoryName}</u> on <u>{SelectedPlatform}</u></h2></center>
<div class="discover-heading">
{PlatformTwitch ?
<div>
<h2>{TwitchData.data.displayName}</h2>
<p>{TwitchData.data.viewers} Viewers</p>
</div>
<p>{TwitchData.data.description}</p>
<ul>
<p>Tags: </p>
{TwitchData.data.tags.map((tag) =>
<li>{tag}</li>
)}
</ul>
:
null
}
</div>
<hr/>
<div class="video-grid">
{PlatformYouTube ?
@ -69,4 +83,30 @@ else if (Astro.url.href.includes('?platform=twitch')) {
null
}
</div>
</Base>
</Base>
<style lang="scss">
.discover-heading {
display: flex;
flex-direction: column;
padding: 0px 24px;
div {
display: flex;
justify-content: space-between;
align-items: center;
}
ul {
display: flex;
align-items: center;
padding: 0px;
gap: 12px;
li {
background: #181818;
list-style: none;
padding: 12px 24px;
border-radius: 3rem;
cursor: default;
}
}
}
</style>

View file

@ -20,8 +20,10 @@ const UploadDate = video.published;
const Views = video.viewCount;
const VideoSeconds = video.lengthSeconds;
let DescriptionFormat = Description.replaceAll("\n", " <br/> ");
// Format Published Date
const DateFormat = new Date(UploadDate * 1000).toLocaleDateString();
// Format Video Length
// Thanks to "mingjunlu" for helping out with the time format
new Date(VideoSeconds * 1000)
@ -30,6 +32,7 @@ new Date(VideoSeconds * 1000)
.split(":")
.map(Number)
.join(":");
// Format Views
const ViewsConversion = Intl.NumberFormat("en", { notation: "compact" });
let ViewsFormat = ViewsConversion.format(Views);