Radio.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <f7-page name="radio">
  3. <img :src="radio().logo" id="logo" />
  4. <f7-block-title>{{ radio().name }}</f7-block-title>
  5. <f7-block-header>{{ radio().description }}</f7-block-header>
  6. <div v-if="loading()" strong class="text-align-center">
  7. <f7-preloader v-if="loading()" />
  8. </div>
  9. <f7-list v-else>
  10. <f7-list-item
  11. title="Diretta"
  12. :link="`/radio/${encodeURIComponent(radioUrl)}/live`"
  13. />
  14. <f7-list-item
  15. title="Trasmissioni"
  16. :link="`/radio/${encodeURIComponent(radioUrl)}/shows`"
  17. />
  18. <f7-list-item
  19. title="Contatti"
  20. :link="`/radio/${encodeURIComponent(radioUrl)}/contacts`"
  21. disabled
  22. />
  23. </f7-list>
  24. </f7-page>
  25. </template>
  26. <script>
  27. import { useRadioStore } from "../js/store";
  28. import { storeToRefs } from "pinia";
  29. export default {
  30. name: "radio",
  31. data() {
  32. return {
  33. isRadioReady: null,
  34. radioUrl: null,
  35. store: useRadioStore(),
  36. radio: () => {
  37. return this.store.radios[this.radioUrl] || {};
  38. },
  39. loading: () => {
  40. return this.isRadioReady === null || !this.isRadioReady(this.radioUrl);
  41. },
  42. };
  43. },
  44. props: { f7route: Object, f7router: Object },
  45. async mounted() {
  46. this.radioUrl = decodeURIComponent(this.f7route.params.radioUrl);
  47. const { isRadioReady } = storeToRefs(this.store);
  48. this.isRadioReady = isRadioReady;
  49. },
  50. };
  51. </script>
  52. <style>
  53. #logo {
  54. margin-left: 10px;
  55. max-width: 40px;
  56. }
  57. </style>