so://phie

verbal

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

blob: 0916d8f1d683f5537bda95780b0e11c86a480feb (1624 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;

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 </v-tab>

57 `

58}