so://phie

verbal

A mobile app for listening to radio stations from around the globe
git clone git://soophie.de/verbal

blob: 664ee699a60d0606dde631b527692b3988e6d9f5 (5683 bytes)[doc][blame][raw]

1import {$lang, http} from '../utils.js';

2import VIcon from '../element/icon.js';

3import VPlayer from '../component/player.js';

4import VTab from '../component/tab.js';

5import VStation from '../component/station.js';

6

7export default {

8 props: ['state'],

9 data() {

10 return {

11 results: [],

12 loading: false

13 };

14 },

15 components: {

16 VIcon,

17 VTab,

18 VPlayer,

19 VStation

20 },

21 methods: {

22 $lang,

23 async doFetch() {

24 this.loading = true;

25 const result = await http`get::/api/favorite`();

26 this.loading = false;

27 this.results = result.data;

28 }

29 },

30 mounted() {

31 this.doFetch();

32 },

33 template: `

34 <v-tab id="favorites" :tab="state.tab">

35 <v-player :station="state.station"></v-player>

36 <ul class="flex flex-col">

37 <li

38 :key="station.id"

39 v-for="station in results"

40 class="border-t sm:border-t-2 first:border-none border-zinc-900 py-5 first:pt-0"

41 >

42 <v-station :station="station"></v-station>

43 </li>

44 </ul>

45 <div

46 v-show="loading"

47 class="w-[60px] h-[60px] select-none pointer-events-none mx-auto"

48 >

49 <v-icon

50 id="loader"

51 class="bg-gray-400 animate-spin"

52 style="animation-duration: 2s;"

53 size="80%"

54 ></v-icon>

55 </div>

56 <!--

57 <ul v-if="account.info" class="flex flex-col">

58 <li v-bind:key="station.id" v-for="station in account.favorites" class="w-full py-5 gap-4 group flex items-center border-t sm:border-t-2 first:border-none border-zinc-900">

59 <div class="w-[54px] h-[54px] min-w-[54px] bg-zinc-900 rounded-lg overflow-hidden">

60 <img v-if="station.favicon" v-bind:src="station.favicon" v-on:error="doHideFavicon(station)" class="w-full h-full object-contain">

61 <div v-else class="w-full h-full bg-gray-400 [mask:url('https://cdn.typable.dev/tabler/access-point')]" style="-webkit-mask-repeat: no-repeat; -webkit-mask-position: center; -webkit-mask-size: 65%;"></div>

62 </div>

63 <div class="flex flex-col flex-1 min-w-0">

64 <p class="text-lg font-medium text-gray-100 pb-0 overflow-hidden text-ellipsis whitespace-nowrap">{{station.name}}</p>

65 <span class="text-md text-gray-400 overflow-hidden flex gap-2 sm:gap-3">

66 <span v-if="station.country" class="text-gray-400 inline-flex items-center gap-[5px]" v-bind:title="$('global.country')">

67 <div class="w-[18px] h-[18px] min-w-[18px] inline-flex bg-gray-400 [mask:url(https://cdn.typable.dev/tabler/world)]" style="-webkit-mask-repeat: no-repeat; -webkit-mask-position: center; -webkit-mask-size: 100%;"></div>

68 <p>{{station.country}}</p>

69 </span>

70 <span v-if="station.votes" class="text-gray-400 inline-flex items-center gap-[5px]" v-bind:title="$('global.votes')">

71 <div class="w-[18px] h-[18px] inline-flex bg-gray-400 [mask:url(https://cdn.typable.dev/tabler/thumb-up)]" style="-webkit-mask-repeat: no-repeat; -webkit-mask-position: center; -webkit-mask-size: 100%;"></div>

72 <p>{{station.votes}}</p>

73 </span>

74 <span v-if="station.click_trend" class="text-gray-400 hidden sm:inline-flex items-center gap-[5px]" v-bind:title="$('global.trend')">

75 <div class="w-[16px] h-[16px] inline-flex bg-gray-400" v-bind:class="[ station.click_trend >= 0 ? '[mask:url(https://cdn.typable.dev/tabler/arrow-up-right)]' : '[mask:url(https://cdn.typable.dev/tabler/arrow-down-right)]' ]" style="-webkit-mask-repeat: no-repeat; -webkit-mask-position: center;"></div>

76 <p>{{Math.abs(station.click_trend) ?? 'None'}}</p>

77 </span>

78 </span>

79 </div>

80 <div class="inline-flex gap-4">

81 <button v-on:click="doToggleFavorite(station, !station.is_favorite)" v-bind:title="[ station.is_favorite ? $('global.unlike') : $('global.like') ]" class="w-[46px] h-[46px] bg-zinc-900 hover:bg-white rounded-full inline-flex justify-center items-center cursor-pointer transition-colors">

82 <div class="w-full h-full bg-gray-400 hover:bg-red-600 transition-colors" v-bind:class="[ station.is_favorite ? '[mask:url(https://cdn.typable.dev/tabler/heart-solid)]' : '[mask:url(https://cdn.typable.dev/tabler/heart)]' ]" style="-webkit-mask-repeat: no-repeat; -webkit-mask-position: center;"></div>

83 </button>

84 <button v-on:click="doPlay(station)" v-bind:title="$('global.play')" class="w-[46px] h-[46px] bg-zinc-900 hover:bg-white rounded-full inline-flex justify-center items-center cursor-pointer transition-colors">

85 <div class="w-full h-full bg-gray-400 hover:bg-gray-700 transition-colors [mask:url('https://cdn.typable.dev/tabler/player-play')]" style="-webkit-mask-repeat: no-repeat; -webkit-mask-position: center;"></div>

86 </button>

87 </div>

88 </li>

89 </ul>

90 -->

91 </v-tab>

92 `

93}