Set up video and date elements

This commit is contained in:
Sam Carlton 2021-03-06 21:41:41 -06:00
parent 86f61b1251
commit aa28439519

View file

@ -3,6 +3,8 @@ import dotenv from 'dotenv'
import config from '../nuxt.config.js' import config from '../nuxt.config.js'
import { getAppType } from '../helpers/app-derived.js' import { getAppType } from '../helpers/app-derived.js'
import { makeLastUpdatedFriendly } from '../helpers/parse-date'
import VideoRow from '../components-eleventy/video/row.js' import VideoRow from '../components-eleventy/video/row.js'
@ -31,6 +33,7 @@ export class AppTemplate {
data: 'eleventy-endpoints', data: 'eleventy-endpoints',
size: 1, size: 1,
alias: 'app', alias: 'app',
before: function( data ) { before: function( data ) {
return data.filter( entry => { return data.filter( entry => {
const appType = getAppType( entry.payload.app ) const appType = getAppType( entry.payload.app )
@ -66,6 +69,8 @@ export class AppTemplate {
// console.log('video.payload', Object.keys(video.payload)) // console.log('video.payload', Object.keys(video.payload))
const lastUpdatedFriendly = makeLastUpdatedFriendly( app.lastUpdated )
const relatedLinksHtml = app.relatedLinks.map( (link, i) => { const relatedLinksHtml = app.relatedLinks.map( (link, i) => {
return /* html */` return /* html */`
<a <a
@ -97,34 +102,37 @@ export class AppTemplate {
</div> </div>
</div> </div>
<div ${ relatedVideos.length > 0 ? /* html */`
v-if="relatedVideos.length !== 0" <div
class="related-videos w-full" v-if="relatedVideos.length !== 0"
> class="related-videos w-full"
<h2 class="subtitle text-xl md:text-2xl font-bold mb-3"> >
Related Videos <h2 class="subtitle text-xl md:text-2xl font-bold mb-3">
</h2> Related Videos
</h2>
${ this.boundComponent(VideoRow)( relatedVideos ) } ${ this.boundComponent(VideoRow)( relatedVideos ) }
</div>
<div class="report-links py-24 text-xs shadow-none">
<div v-if="app.lastUpdated">
<time
datetime="${'app.lastUpdated.raw'}"
>
Last Updated {{ lastUpdatedFriendly }}
</time>
</div> </div>
` : '' }
<div class="report-update text-xs text-center w-full shadow-none py-24">
${ lastUpdatedFriendly !== null ? /* html */`
<div>
<time
datetime="${ app.lastUpdated.raw }"
>
Last Updated ${ lastUpdatedFriendly }
</time>
</div>
` : '' }
<!-- https://eric.blog/2016/01/08/prefilling-github-issues/ --> <!-- https://eric.blog/2016/01/08/prefilling-github-issues/ -->
<a <a
href="https://github.com/ThatGuySam/doesitarm/issues?q=is%3Aissue+is%3Aopen+${ app.name }" href="https://github.com/ThatGuySam/doesitarm/issues?q=is%3Aissue+${ app.name }"
target="_blank" target="_blank"
class="underline" class="underline"
rel="noopener" rel="noopener"
>Report Update</a> >Report Update</a>
</div> </div>
</section> </section>