-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes pesky bug with youtube stats and vids
Signed-off-by: Cole Gentry <[email protected]>
- Loading branch information
1 parent
0b16533
commit aef448d
Showing
5 changed files
with
89 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,41 @@ | ||
<template> | ||
<div> | ||
<v-row> | ||
<h3 class="fancy-font-bold is-size-3 has-text-centered pb-5">Recent Videos</h3> | ||
|
||
<template v-if="isLoading"> | ||
<div class="columns is-multiline"> | ||
<div v-for="(item, index) in 2" :key="index" class="column is-half"> | ||
<div class="card"> | ||
<div class="card-image"> | ||
<o-skeleton height="100px"></o-skeleton> | ||
</div> | ||
<div class="card-content"> | ||
<div class="content"> | ||
<p class="title is-6"> | ||
<o-skeleton></o-skeleton> | ||
</p> | ||
<p class="subtitle is-7 pt-2"> | ||
<o-skeleton></o-skeleton> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<template v-if="pending"> | ||
<v-row> | ||
<v-col cols="12" md="3" v-for="item in 3"> | ||
<v-skeleton-loader class="mx-auto border" max-width="300" type="image, article"></v-skeleton-loader> | ||
</v-col> | ||
</v-row> | ||
</template> | ||
|
||
<div class="columns is-multiline"> | ||
<div class="column is-one-third-desktop" v-for="video in videos"> | ||
<div class="card"> | ||
<div class="card-image"> | ||
<figure class="image"> | ||
<a :href="video.videoUrl" target="_blank"> | ||
<picture :alt="video.title + ' thumbnail'"> | ||
<source media="(max-width: 799px)" :srcset="video.thumbs.medium" /> | ||
<source media="(max-width: 992px)" :srcset="video.thumbs.high" /> | ||
<source media="(max-width: 1200px)" :srcset="video.thumbs.standard" /> | ||
<img loading="lazy" :src="video.thumbs.maxres" :alt="'Thumbnail for ' + videos.title" /> | ||
</picture> | ||
</a> | ||
</figure> | ||
</div> | ||
<div class="card-content"> | ||
<div class="content"> | ||
<p class="title is-6"> | ||
{{ video.title }} | ||
</p> | ||
<p class="subtitle is-7 pt-2">published on {{ video.publishedOn }}</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<template v-else-if="error"> | ||
<p>Unable to load youtube data</p> | ||
</template> | ||
|
||
<v-row v-else-if="videos"> | ||
<v-col cols="12" md="4" v-for="video in videos"> | ||
<v-card class="mx-auto" max-width="344" :href="video.videoUrl"> | ||
<v-img :src="video.thumbnails.maxres" height="250px"> | ||
<template #sources> | ||
<source media="(max-width: 799px)" :srcset="video.thumbnails.medium" /> | ||
<source media="(max-width: 992px)" :srcset="video.thumbnails.high" /> | ||
<source media="(max-width: 1200px)" :srcset="video.thumbnails.standard" /> | ||
</template> | ||
</v-img> | ||
<v-card-title>{{ video.title }}</v-card-title> | ||
<v-card-subtitle class="pb-5"> published on {{ video.publishedOn }} </v-card-subtitle> | ||
</v-card> | ||
</v-col> | ||
</v-row> | ||
</v-row> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
let videos: any; | ||
let isLoading = true; | ||
await useFetch('/api/videos') | ||
.then((response: any) => { | ||
if (response?.data?._rawValue) { | ||
videos = response.data._rawValue.map((video: any) => { | ||
return { | ||
title: video.title, | ||
thumbs: video.thumbnails, | ||
publishedOn: DateTime.fromISO(video.publishedOn).toFormat('LLL dd, yyyy'), | ||
videoUrl: video.videoUrl, | ||
}; | ||
}); | ||
} else { | ||
videos = []; | ||
} | ||
}) | ||
.finally(() => { | ||
isLoading = false; | ||
}); | ||
import { VCol, VRow } from 'vuetify/components/VGrid'; | ||
import { VCard, VCardTitle, VCardSubtitle } from 'vuetify/components/VCard'; | ||
import { VImg } from 'vuetify/components/VImg'; | ||
import { VSkeletonLoader } from 'vuetify/components/VSkeletonLoader'; | ||
const { data: videos, pending, error } = await useFetch('/api/videos'); | ||
</script> | ||
|
||
<script lang="ts"> | ||
import { DateTime } from 'luxon'; | ||
export default defineComponent({}); | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.has-shadow { | ||
box-shadow: none; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters