so://phie

verbal

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

blob: 9047331c12f5525a1e0a744058e10d3510035624 (3918 bytes)[doc][blame][raw]

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

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

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

4

5export default {

6 props: ['station'],

7 components: {

8 VButton,

9 VIcon

10 },

11 methods: {

12 $lang,

13 async setLike(is_favorite) {

14 try {

15 await http`post::/api/favorite`(this.station.uuid);

16 this.station.is_favorite = is_favorite;

17 }

18 catch(error) {

19 console.log(error);

20 }

21 }

22 },

23 template: `

24 <div class="w-full gap-4 group flex items-center">

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

26 <img

27 v-if="station.favicon"

28 :alt="station.name"

29 :src="station.favicon"

30 @error="() => station.favicon = null"

31 class="w-full h-full object-contain"

32 >

33 <v-icon

34 v-else

35 id="access-point"

36 size="65%"

37 class="bg-gray-400"

38 ></v-icon>

39 </div>

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

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

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

43 <span

44 v-if="station.country"

45 class="text-gray-400 inline-flex items-center gap-[5px]"

46 :title="$lang('global.country')"

47 >

48 <v-icon

49 id="world"

50 class="w-[18px] h-[18px] !min-w-[18px] inline-flex bg-gray-400"

51 size="100%"

52 ></v-icon>

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

54 </span>

55 <span

56 v-if="station.votes"

57 class="text-gray-400 inline-flex items-center gap-[5px]"

58 :title="$lang('global.votes')"

59 >

60 <v-icon

61 id="thumb-up"

62 class="w-[18px] h-[18px] !min-w-[18px] inline-flex bg-gray-400"

63 size="100%"

64 ></v-icon>

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

66 </span>

67 <span

68 v-if="station.click_trend"

69 class="text-gray-400 hidden sm:inline-flex items-center gap-[5px]"

70 :title="$lang('global.trend')"

71 >

72 <v-icon

73 :id="[ station.click_trend >= 0 ? 'arrow-up-right' : 'arrow-down-right' ]"

74 class="w-[18px] h-[18px] !min-w-[18px] inline-flex bg-gray-400"

75 ></v-icon>

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

77 </span>

78 </span>

79 </div>

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

81 <v-button

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

83 :title="[ $lang(station.is_favorite ? 'global.unlike' : 'global.like') ]"

84 :active="station.is_favorite"

85 @click="() => setLike(!station.is_favorite)"

86 class="bg-zinc-900 hover:bg-white"

87 ></v-button>

88 <v-button

89 icon="player-play"

90 class="bg-zinc-900 hover:bg-white"

91 :title="$lang('global.play')"

92 ></v-button>

93 </div>

94 </div>

95 `

96}