<template>
  <f7-page name="radio">
    <img :src='Radio.logo' id='logo'/> 
    <f7-block-title>{{Radio.name}}</f7-block-title>
    <f7-block-header>{{Radio.description}}</f7-block-header>

    <f7-preloader v-if='loading' />
    <f7-list v-else>
        <f7-list-item v-for='show in Radio.shows' :key='show.name' :title='show.name' :link='`/radio/show/${show.name}`' :footer='show.description'/>
    </f7-list>
  </f7-page>    
</template>

<script>
import radiomanifest from '../js/radiomanifest'

export default {
  name: 'radio',
  data () {
    return {
      loading: true,
      radioId: null,
      radio: { name: '' },
      Radio: { }
    }
  },
  props: { f7route: Object, f7router: Object },
  async mounted () {
    try {
      this.Radio = await radiomanifest.get(this.f7route.params.radioName)
      // this.Radio.schedule.getNowShow(new Date())
      console.error(this.Radio)
      this.loading = false
    } catch (e) {
      console.error('le cose non vanno mai sempre bene!', e)
    }
  }
}

</script>
<style>
#logo {
  margin-left: 10px;
  max-width: 40px;
}
</style>