so://phie

verbal

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

blob: 55d994c7c2658f0e99b83c96a629f8241df203f1 (3987 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 -mb-6 sm:-mb-10">

35 <div

36 v-if="station"

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

38 >

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

40 <img

41 v-if="station.favicon"

42 :src="station.favicon"

43 :alt="station.name"

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

45 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"

46 >

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

48 <img

49 v-if="station.favicon"

50 :src="station.favicon"

51 :alt="station.name"

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

53 >

54 <v-icon

55 v-else

56 id="access-point"

57 size="65%"

58 class="bg-gray-400"

59 ></v-icon>

60 </div>

61 <div

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

63 >

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

65 {{station.name}}

66 </p>

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

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

69 </p>

70 </div>

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

72 <v-button

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

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

75 :active="station.is_favorite"

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

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

78 ></v-button>

79 <v-button

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

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

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

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

84 @click="setPlaying(!playing)"

85 ></v-button>

86 </div>

87 </div>

88 </div>

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

90 </div>

91 `

92}