so://phie

verbal

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

blob: d2eab85441418bbb155716717cf74455172c7cec (4339 bytes)[doc][blame][raw]

1import {state} from '../main.js';

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

3import VButton from '../element/button.js';

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

5

6export default {

7 props: ['station'],

8 data() {

9 return {

10 playing: false,

11 loading: false,

12 title: '- No song title available -',

13 locale: 'en'

14 };

15 },

16 components: {

17 VButton,

18 VIcon

19 },

20 methods: {

21 $lang,

22 async setLike(is_favorite) {

23 try {

24 await http`${is_favorite ? 'post' : 'delete'}::/api/like`(this.station.uuid);

25 this.station.is_favorite = is_favorite;

26 state.app.$refs.favorites.doFetch();

27 }

28 catch(error) {

29 console.log(error);

30 }

31 },

32 },

33 template: `

34 <div class="sticky top-[98px] z-30">

35 <div

36 v-if="station"

37 class="flex flex-col bg-black pb-6"

38 >

39 <audio controls autoplay :src="station.stream_url" class="select-none pointer-events-none w-0 h-0 opacity-0">

40 <source :src="station.stream_url" type="audio/mpeg">

41 <source :src="station.stream_url" type="audio/ogg">

42 <source :src="station.stream_url" type="audio/aac">

43 </audio>

44 <div class="p-5 bg-zinc-800 rounded-xl flex gap-5 items-center relative overflow-hidden shadow-2xl z-30">

45 <img

46 v-if="station.favicon"

47 :src="station.favicon"

48 :alt="station.name"

49 :class="{ 'animate-pulse': playing }"

50 class="w-full h-full object-cover absolute top-0 left-0 right-0 bottom-0 blur-2xl opacity-30 z-0 pointer-events-none select-none"

51 >

52 <div class="w-[64px] h-[64px] min-w-[64px] bg-zinc-900 rounded-lg overflow-hidden z-10">

53 <img

54 v-if="station.favicon"

55 :src="station.favicon"

56 :alt="station.name"

57 class="w-full h-full object-contain select-none"

58 >

59 <v-icon

60 v-else

61 id="access-point"

62 size="65%"

63 class="bg-gray-400"

64 ></v-icon>

65 </div>

66 <div

67 class="flex flex-col flex-1 z-10 min-w-0 cursor-pointer"

68 >

69 <p class="text-xl font-semibold text-white pb-1 overflow-hidden text-ellipsis whitespace-nowrap select-none pointer-events-none">

70 {{station.name}}

71 </p>

72 <p class="text-md text-gray-400 overflow-hidden text-ellipsis whitespace-nowrap select-none pointer-events-none">

73 {{title ?? $lang('player.loading')}}

74 </p>

75 </div>

76 <div class="inline-flex gap-4 z-10 pr-2">

77 <v-button

78 :icon="[ station.is_favorite ? 'heart-solid' : 'heart' ]"

79 :title="$lang('global.favorites')"

80 :active="station.is_favorite"

81 class="bg-zinc-900 hover:bg-white focus:ring-[6px] ring-white/10"

82 @click="setLike(!station.is_favorite)"

83 ></v-button>

84 <v-button

85 :icon="[ loading ? 'rotate-clockwise' : (playing ? 'player-pause' : 'player-play') ]"

86 :title="[ playing ? $lang('global.pause') : $lang('global.play') ]"

87 :animation="[ loading ? 'animate-spin' : '' ]"

88 class="bg-zinc-900 hover:bg-white focus:ring-[6px] ring-white/10"

89 @click="setPlaying(!playing)"

90 ></v-button>

91 </div>

92 </div>

93 </div>

94 <div class="bg-gradient-to-b from-black h-2 sm:h-4"></div>

95 </div>

96 `

97}