2022-03-17 13:17:32 +00:00
// Buttons and methods for testing and demonstration purposes only. Uncomment them to see how it works. Remove to actually implement a implementation
2022-03-16 00:31:03 +00:00
< template >
2022-03-18 06:15:19 +00:00
< div >
2022-03-19 13:15:40 +00:00
< center style = "padding-top: 3em" v-if = "recommends == null" >
< v-progress-circular size = "50" indeterminate color = "primary" / >
2022-03-18 06:15:19 +00:00
< / center >
2022-03-18 11:50:44 +00:00
< center >
2022-03-19 13:15:40 +00:00
< v-list-item v-for ="(video, index) in recommends[0]" :key ="index" >
< v-card class = "entry" :to = "`/watch?v=${video.id}`" >
2022-03-18 11:50:44 +00:00
< v-card-text >
2022-03-19 13:15:40 +00:00
< div style = "position: relative" >
< v-img :src = "video.thumbnail" / >
< p
v - text = "video.metadata.overlay[0]"
class = "videoRuntimeFloat"
style = "color: #fff"
/ >
2022-03-18 11:50:44 +00:00
< / div >
2022-03-19 13:15:40 +00:00
< div v-text = "video.title" style="margin-top: 0.5em" / >
2022-03-19 13:47:08 +00:00
< div v-text = "parseBottom(video)" / >
2022-03-18 11:50:44 +00:00
< / v-card-text >
< / v-card >
< / v-list-item >
< / center >
2022-03-18 06:15:19 +00:00
< / div >
2022-03-16 00:31:03 +00:00
< / template >
2022-03-16 09:07:40 +00:00
< script >
export default {
2022-03-18 06:15:19 +00:00
data ( ) {
return {
2022-03-19 13:15:40 +00:00
recommends : [ ] ,
} ;
2022-03-18 06:15:19 +00:00
} ,
// The following code is only a demo for debugging purposes, note that each "shelfRenderer" has a "title" value that seems to align to the categories at the top of the vanilla yt app
mounted ( ) {
2022-03-19 13:15:40 +00:00
this . $youtube
. recommend ( )
. then ( ( result ) => {
console . log ( result ) ;
if ( result ) this . recommends = result ;
} )
. catch ( ( error ) => this . $logger ( "Home Page" , error , true ) ) ;
2022-03-18 11:50:44 +00:00
} ,
2022-03-19 13:47:08 +00:00
methods : {
parseBottom ( video ) {
const bottomText = [ video . channel , video . metadata . views ] ;
if ( video . metadata . published ) bottomText . push ( video . metadata . published ) ;
return bottomText . join ( " • " ) ;
} ,
} ,
2022-03-19 13:15:40 +00:00
} ;
2022-03-16 09:07:40 +00:00
< / script >